diff --git a/src/rest-client-v2.ts b/src/rest-client-v2.ts index f5a5861..0c6f5af 100644 --- a/src/rest-client-v2.ts +++ b/src/rest-client-v2.ts @@ -28,6 +28,28 @@ import { CrossMaxBorrowableResponseV2, CrossMaxTransferableResponseV2, CrossTierConfigurationResponseV2, + CTFuturesFollowerCurrentOrdersV2, + CTFuturesFollowerHistoryOrdersV2, + CTFuturesFollowerMyTradersV2, + CTFuturesFollowerSettingsV2, + CTFuturesTraderCurrentOrderV2, + CTFuturesTraderHistoryOrderV2, + CTFuturesTraderHistoryProfitSummaryV2, + CTFuturesTraderMyFollowersV2, + CTFuturesTraderProfitShareHistoryV2, + CTFuturesTraderSymbolSettingsV2, + CTFuturesTraderTotalOrderSummaryV2, + CTSpotFollowerCurrentOrdersV2, + CTSpotFollowerFollowConfigurationV2, + CTSpotFollowerHistoryOrdersV2, + CTSpotFollowerMyTradersV2, + CTSpotTraderCurrentTrackingOrdersV2, + CTSpotTraderFollowerListV2, + CTSpotTraderHistoryOrdersV2, + CTSpotTraderHistoryProfitSharingV2, + CTSpotTraderProfitSummaryV2, + CTSpotTraderTotalOrderDetailV2, + CTSpotTraderUnrealizedProfitV2, FundingAssetsV2, FuturesAccountBillRequestV2, FuturesAccountBillV2, @@ -1993,7 +2015,7 @@ export class RestClientV2 extends BaseRestClient { getFuturesTraderCurrentOrder( params: GetFuturesTraderCurrentOrdersRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate( '/api/v2/copy/mix-trader/order-current-track', params, @@ -2002,7 +2024,7 @@ export class RestClientV2 extends BaseRestClient { getFuturesTraderHistoryOrders( params: GetFuturesTraderHistoryOrdersRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate( '/api/v2/copy/mix-trader/order-history-track', params, @@ -2011,24 +2033,28 @@ export class RestClientV2 extends BaseRestClient { modifyFuturesTraderOrderTPSL( params: ModifyFuturesTraderOrderTPSLRequestV2, - ): Promise> { + ): Promise> { return this.postPrivate( '/api/v2/copy/mix-trader/order-modify-tpsl', params, ); } - getFuturesTraderOrder(): Promise> { + getFuturesTraderOrder(): Promise< + APIResponse + > { return this.getPrivate('/api/v2/copy/mix-trader/order-total-detail'); } - getFuturesTraderProfitHistory(): Promise> { + getFuturesTraderProfitHistory(): Promise< + APIResponse + > { return this.getPrivate('/api/v2/copy/mix-trader/profit-history-summarys'); } getFuturesTraderProfitShareHistory( params: GetFuturesTraderProfitShareDetailRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate( '/api/v2/copy/mix-trader/profit-history-details', params, @@ -2039,7 +2065,15 @@ export class RestClientV2 extends BaseRestClient { trackingNo: string; symbol: string; productType: CopyTradingProductTypeV2; - }): Promise> { + }): Promise< + APIResponse< + { + trackingNo: string; + symbol: string; + productType: string; + }[] + > + > { return this.postPrivate( '/api/v2/copy/mix-trader/order-close-positions', params, @@ -2050,14 +2084,30 @@ export class RestClientV2 extends BaseRestClient { coin?: string; pageSize?: string; pageNo?: string; - }): Promise> { + }): Promise< + APIResponse< + { + coin: string; + profit: string; + nickName: string; + }[] + > + > { return this.getPrivate('/api/v2/copy/mix-trader/profit-details', params); } getFuturesTraderProfitShareGroup(params?: { pageSize?: string; pageNo?: string; - }): Promise> { + }): Promise< + APIResponse< + { + coin: string; + profit: string; + profitTime: string; + }[] + > + > { return this.getPrivate( '/api/v2/copy/mix-trader/profits-group-coin-date', params, @@ -2066,7 +2116,7 @@ export class RestClientV2 extends BaseRestClient { getFuturesTraderSymbolSettings(params: { productType: CopyTradingProductTypeV2; - }): Promise> { + }): Promise> { return this.getPrivate( '/api/v2/copy/mix-trader/config-query-symbols', params, @@ -2075,7 +2125,7 @@ export class RestClientV2 extends BaseRestClient { updateFuturesTraderSymbolSettings(params: { settingList: FuturesTraderSymbolSettingRequestV2[]; - }): Promise> { + }): Promise> { return this.postPrivate( '/api/v2/copy/mix-trader/config-setting-symbols', params, @@ -2086,7 +2136,7 @@ export class RestClientV2 extends BaseRestClient { enable?: 'YES' | 'NO'; showTotalEquity?: 'YES' | 'NO'; showTpsl?: 'YES' | 'NO'; - }): Promise> { + }): Promise> { return this.postPrivate( '/api/v2/copy/mix-trader/config-settings-base', params, @@ -2095,7 +2145,7 @@ export class RestClientV2 extends BaseRestClient { getFuturesTraderFollowers( params?: GetFuturesTraderFollowersRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate( '/api/v2/copy/mix-trader/config-query-followers', params, @@ -2104,7 +2154,7 @@ export class RestClientV2 extends BaseRestClient { removeFuturesTraderFollower(params: { followerUid: string; - }): Promise> { + }): Promise> { return this.postPrivate( '/api/v2/copy/mix-trader/config-remove-follower', params, @@ -2121,7 +2171,7 @@ export class RestClientV2 extends BaseRestClient { getFuturesFollowerCurrentOrders( params: GetFollowerFuturesCurrentTrackingOrdersRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate( '/api/v2/copy/mix-follower/query-current-orders', params, @@ -2130,7 +2180,7 @@ export class RestClientV2 extends BaseRestClient { getFuturesFollowerHistoryOrders( params: GetFollowerFuturesHistoryTrackingOrdersRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate( '/api/v2/copy/mix-follower/query-history-orders', params, @@ -2139,25 +2189,29 @@ export class RestClientV2 extends BaseRestClient { updateFuturesFollowerTPSL( params: UpdateFuturesFollowerTPSLRequestV2, - ): Promise> { + ): Promise> { return this.postPrivate('/api/v2/copy/mix-follower/setting-tpsl', params); } updateFuturesFollowerSettings( params: UpdateFuturesFollowerSettingsRequestV2, - ): Promise> { + ): Promise> { return this.postPrivate('/api/v2/copy/mix-follower/settings', params); } getFuturesFollowerSettings(params: { traderId: string; - }): Promise> { + }): Promise> { return this.getPrivate('/api/v2/copy/mix-follower/query-settings', params); } closeFuturesFollowerPositions( params: CloseFuturesFollowerPositionsRequestV2, - ): Promise> { + ): Promise< + APIResponse<{ + orderIdList: string[]; + }> + > { return this.postPrivate( '/api/v2/copy/mix-follower/close-positions', params, @@ -2166,14 +2220,22 @@ export class RestClientV2 extends BaseRestClient { getFuturesFollowerTraders( params: GetFuturesFollowerTradersRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate('/api/v2/copy/mix-follower/query-traders', params); } getFuturesFollowerFollowLimit(params: { symbol: string; productType: CopyTradingProductTypeV2; - }): Promise> { + }): Promise< + APIResponse< + { + maxFollowSize: string; + minFollowSize: string; + symbol: string; + }[] + > + > { return this.getPrivate( '/api/v2/copy/mix-follower/query-quantity-limit', params, @@ -2182,7 +2244,7 @@ export class RestClientV2 extends BaseRestClient { unfollowFuturesTrader(params: { traderId: string; - }): Promise> { + }): Promise> { return this.postPrivate('/api/v2/copy/mix-follower/cancel-trader', params); } @@ -2220,13 +2282,13 @@ export class RestClientV2 extends BaseRestClient { * */ - getSpotTraderProfit(): Promise> { + getSpotTraderProfit(): Promise> { return this.getPrivate('/api/v2/copy/spot-trader/profit-summarys'); } getSpotTraderHistoryProfit( params: GetSpotTraderHistoryProfitRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate( '/api/v2/copy/spot-trader/profit-history-details', params, @@ -2237,11 +2299,11 @@ export class RestClientV2 extends BaseRestClient { coin?: string; pageNo?: string; pageSize?: string; - }): Promise> { + }): Promise> { return this.getPrivate('/api/v2/copy/spot-trader/profit-details', params); } - getSpotTraderOrder(): Promise> { + getSpotTraderOrder(): Promise> { return this.getPrivate('/api/v2/copy/spot-trader/order-total-detail'); } @@ -2249,7 +2311,7 @@ export class RestClientV2 extends BaseRestClient { trackingNo: string; stopSurplusPrice?: string; stopLossPrice?: string; - }): Promise> { + }): Promise> { return this.postPrivate( '/api/v2/copy/spot-trader/order-modify-tpsl', params, @@ -2258,7 +2320,7 @@ export class RestClientV2 extends BaseRestClient { getSpotTraderHistoryOrders( params: GetSpotTraderHistoryOrdersRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate( '/api/v2/copy/spot-trader/order-history-track', params, @@ -2267,7 +2329,7 @@ export class RestClientV2 extends BaseRestClient { getSpotTraderCurrentOrders( params: GetSpotTraderCurrentOrdersRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate( '/api/v2/copy/spot-trader/order-current-track', params, @@ -2277,7 +2339,7 @@ export class RestClientV2 extends BaseRestClient { sellSpotTrader(params: { trackingNoList: string[]; symbol: string; - }): Promise> { + }): Promise> { return this.postPrivate( '/api/v2/copy/spot-trader/order-close-tracking', params, @@ -2287,7 +2349,7 @@ export class RestClientV2 extends BaseRestClient { getSpotTraderSymbolSettings(params: { symbolList: string[]; settingType: 'add' | 'delete'; - }): Promise> { + }): Promise> { return this.postPrivate( '/api/v2/copy/spot-trader/config-setting-symbols', params, @@ -2296,7 +2358,7 @@ export class RestClientV2 extends BaseRestClient { removeSpotTraderFollowers(params: { followerUid: string; - }): Promise> { + }): Promise> { return this.postPrivate( '/api/v2/copy/spot-trader/config-remove-follower', params, @@ -2309,7 +2371,7 @@ export class RestClientV2 extends BaseRestClient { getSpotTraderFollowers( params: GetSpotTraderFollowersRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate( '/api/v2/copy/spot-trader/config-query-followers', params, @@ -2326,7 +2388,7 @@ export class RestClientV2 extends BaseRestClient { cancelSpotFollowerOrder(params: { trackingNoList: string[]; - }): Promise> { + }): Promise> { return this.postPrivate('/api/v2/copy/spot-follower/stop-order', params); } @@ -2335,7 +2397,7 @@ export class RestClientV2 extends BaseRestClient { autoCopy?: 'on' | 'off'; mode?: 'basic' | 'advanced'; settings: SpotFollowerCopyTradeSettingV2[]; - }): Promise> { + }): Promise> { return this.postPrivate('/api/v2/copy/spot-follower/settings', params); } @@ -2343,7 +2405,7 @@ export class RestClientV2 extends BaseRestClient { trackingNo: string; stopSurplusPrice?: string; stopLossPrice?: string; - }): Promise> { + }): Promise> { return this.postPrivate('/api/v2/copy/spot-follower/setting-tpsl', params); } @@ -2352,13 +2414,15 @@ export class RestClientV2 extends BaseRestClient { pageSize?: string; startTime?: string; endTime?: string; - }): Promise> { + }): Promise> { return this.getPrivate('/api/v2/copy/spot-follower/query-traders', params); } - getSpotFollowerCurrentTraderSymbols(params: { - traderId: string; - }): Promise> { + getSpotFollowerCurrentTraderSymbols(params: { traderId: string }): Promise< + APIResponse<{ + currentTradingList: string[]; + }> + > { return this.getPrivate( '/api/v2/copy/spot-follower/query-trader-symbols', params, @@ -2367,13 +2431,13 @@ export class RestClientV2 extends BaseRestClient { getSpotFollowerSettings(params: { traderId: string; - }): Promise> { + }): Promise> { return this.getPrivate('/api/v2/copy/spot-follower/query-settings', params); } getSpotFollowerHistoryOrders( params: GetSpotFollowerHistoryOrdersRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate( '/api/v2/copy/spot-follower/query-history-orders', params, @@ -2382,7 +2446,7 @@ export class RestClientV2 extends BaseRestClient { getSpotFollowerOpenOrders( params: GetSpotFollowerOpenOrdersRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate( '/api/v2/copy/spot-follower/query-current-orders', params, @@ -2392,14 +2456,16 @@ export class RestClientV2 extends BaseRestClient { sellSpotFollower(params: { trackingNoList: string[]; symbol: string; - }): Promise> { + }): Promise> { return this.postPrivate( '/api/v2/copy/spot-follower/order-close-tracking', params, ); } - unfollowSpotTrader(params: { traderId: string }): Promise> { + unfollowSpotTrader(params: { + traderId: string; + }): Promise> { return this.postPrivate('/api/v2/copy/spot-follower/cancel-trader', params); } diff --git a/src/types/response/index.ts b/src/types/response/index.ts index 34af543..e1eef1e 100644 --- a/src/types/response/index.ts +++ b/src/types/response/index.ts @@ -3,6 +3,7 @@ export * from './v1/shared'; export * from './v1/spot'; export * from './v2/broker'; export * from './v2/common'; +export * from './v2/copy-trading'; export * from './v2/futures'; export * from './v2/margin'; export * from './v2/spot'; diff --git a/src/types/response/v2/copy-trading.ts b/src/types/response/v2/copy-trading.ts new file mode 100644 index 0000000..7c51776 --- /dev/null +++ b/src/types/response/v2/copy-trading.ts @@ -0,0 +1,416 @@ +/** + * + * + * Copy Trading | Future copy trading | Trader Api + * + * + */ + +export interface CTFuturesTraderCurrentOrderV2 { + trackingList: { + trackingNo: string; + openOrderId: string; + symbol: string; + posSide: string; + openLeverage: string; + openPriceAvg: string; + openTime: string; + openSize: string; + presetStopSurplusPrice: string; + presetStopLossPrice: string; + openFee: string; + followCount: string; + }[]; + endId: string; +} + +export interface CTFuturesTraderHistoryOrderV2 { + trackingList: { + trackingNo: string; + symbol: string; + openOrderId: string; + closeOrderId: string; + productType: string; + posSide: string; + openLeverage: string; + openPriceAvg: string; + openTime: string; + openSize: string; + closeSize: string; + closeTime: string; + closePriceAvg: string; + stopType: string; + achievedPL: string; + openFee: string; + closeFee: string; + cTime: string; + }[]; + endId: string; +} + +export interface CTFuturesTraderTotalOrderSummaryV2 { + roi: string; + tradingOrderNum: string; + totalFollowerNum: string; + currentFollowerNum: string; + totalpl: string; + gainNum: string; + lossNum: string; + winRate: string; + tradingPairsAvailableList: string[]; + lastWeekRoiList: { + rate: string; + ctime: string; + }[]; + lastWeekProfitList: { + amount: string; + ctime: string; + }[]; + lastMonthRoiList: { + rate: string; + ctime: string; + }[]; + lastMonthProfitList: { + amount: string; + ctime: string; + }[]; + totalEquity: string; +} + +export interface CTFuturesTraderHistoryProfitSummaryV2 { + profitSummary: { + yesterdayProfit: string; + sumProfit: string; + waitProfit: string; + yesterdayTime: string; + }; + profitHistoryList: { + coin: string; + profitCount: string; + lastProfitTime: string; + }[]; +} + +export interface CTFuturesTraderProfitShareHistoryV2 { + profitList: { + profitId: string; + coin: string; + profit: string; + nickName: string; + profitTime: string; + }[]; + endId: string; +} + +export interface CTFuturesTraderSymbolSettingsV2 { + symbol: string; + openTrader: string; + minOpenCount: string; + maxLeverage: string; + stopSurplusRatio: string; + stopLossRatio: string; +} + +export interface CTFuturesTraderMyFollowersV2 { + accountEquity: string; + isRemove: string; + followerHeadPic: string; + followerName: string; + followerUid: string; + followerTime: string; +} + +/** + * + * + * Copy Trading | Future copy trading | Follower Api + * + * + */ + +export interface CTFuturesFollowerCurrentOrdersV2 { + trackingNo: string; + traderName: string; + openOrderId: string; + closeOrderId: string; + traderId: string; + symbol: string; + posSide: string; + openLeverage: string; + openAvgPrice: string; + openTime: string; + openSize: string; + closeAvgPrice: string; + closeSize: string; + openMarginSz: string; + closeTime: string; +} + +export interface CTFuturesFollowerHistoryOrdersV2 { + trackingList: { + trackingNo: string; + posSide: string; + openLeverage: string; + openSize: string; + closeSize: string; + openPriceAvg: string; + closePriceAvg: string; + achievedPL: string; + openFee: string; + closeFee: string; + symbol: string; + profitRate: string; + netProfit: string; + openOrderId: string; + closeOrderId: string; + openTime: string; + closeTime: string; + traderId: string; + productType: string; + }[]; + endId: string; +} + +export interface CTFuturesFollowerSettingsV2 { + followerEnable: string; + detailList: { + symbol: string; + productType: string; + marginType: string; + marginCoin: string; + leverType: string; + longLeverage: string; + shortLeverage: string; + traceType: string; + traceValue: string; + maxHoldSize: string; + stopSurplusRatio: string; + stopLossRatio: string; + }[]; +} + +export interface CTFuturesFollowerMyTradersV2 { + certificationType: string; + traderId: string; + traderName: string; + maxFollowLimit: string; + followCount: string; + traceTotalMarginAmount: string; + traceTotalNetProfit: string; + traceTotalProfit: string; + currentTradingPairs: string[]; + followerTime: string; + bgbMaxFollowLimit: string; + bgbFollowCount: string; +} + +/** + * + * + * Copy Trading | Spot copy trading | Trader api + * + * + */ + +export interface CTSpotTraderProfitSummaryV2 { + profitSummarys: { + yesterdayProfit: string; + yesterdayTime: string; + sumProfit: string; + waitProfit: string; + }; + profitHistoryList: { + coin: string; + profitCount: string; + lastProfitTime: string; + historysByDateList: { + profit: string; + profitTime: string; + }[]; + }[]; +} + +export interface CTSpotTraderHistoryProfitSharingV2 { + endId: string; + profitList: { + profitId: string; + coin: string; + distributeRatio: string; + profit: string; + followerName: string; + profitTime: string; + }[]; +} + +export interface CTSpotTraderUnrealizedProfitV2 { + distributeRatio: string; + coin: string; + profit: string; + followerName: string; +} + +export interface CTSpotTraderTotalOrderDetailV2 { + totalFollowerNum: string; + currentFollowerNum: string; + maxFollowerNum: string; + tradingOrderNum: string; + totalpl: string; + gainNum: string; + lossNum: string; + totalEquity: string; + winRate: string; + lastWeekRoiList: { + rate: string; + ctime: string; + }[]; + lastMonthRoiList: { + rate: string; + ctime: string; + }[]; + lastWeekProfitList: { + amount: string; + ctime: string; + }[]; + lastMonthProfitList: { + amount: string; + ctime: string; + }[]; +} + +export interface CTSpotTraderHistoryOrdersV2 { + endId: string; + trackingList: { + trackingNo: string; + fillSize: string; + buyPrice: string; + sellPrice: string; + achievedPL: string; + buyTime: string; + sellTime: string; + buyFee: string; + sellFee: string; + achievedPLR: string; + symbol: string; + netProfit: string; + followCount: string; + }[]; +} + +export interface CTSpotTraderCurrentTrackingOrdersV2 { + endId: string; + trackingList: { + trackingNo: string; + orderId: string; + buyFillSize: string; + buyDelegateSize: string; + buyPrice: string; + unrealizedPL: string; + buyTime: string; + buyFee: string; + unrealizedPLR: string; + symbol: string; + stopLossPrice: string | null; + stopSurplusPrice: string | null; + followCount: string; + }[]; +} + +export interface CTSpotTraderFollowerListV2 { + accountEquity: string; + isRemove: string; + followerHeadPic: string | null; + followerName: string; + followerUid: string; + followerTime: string; +} + +/** + * + * + * Copy Trading | Spot copy trading | Follower api + * + * + */ + +export interface CTSpotFollowerMyTradersV2 { + resultList: { + certificationType: string; + traceTotalAmount: string; + traceTotalNetProfit: string; + traceTotalProfit: string; + traderName: string; + traderId: string; + maxFollowLimit: string; + bgbMaxFollowLimit: string; + followCount: string; + bgbFollowCount: string; + followerTime: string; + }[]; +} + +export interface CTSpotFollowerFollowConfigurationV2 { + enable: string; + profitRate: string; + settledInDays: string; + tradeSettingList: { + maxTraceAmount: string; + stopLossRation: string; + stopSurplusRation: string; + symbol: string; + traceType: string; + }[]; + tradeSymbolSettingList: { + maxStopLossRation: string; + maxStopSurplusRation: string; + maxTraceAmount: string; + maxTraceAmountSystem: string; + maxTraceSize: string; + maxTraceRation: string; + minStopLossRation: string; + minStopSurplusRation: string; + minTraceAmount: string; + minTraceSize: string; + minTraceRation: string; + sliderMaxStopLossRatio: string; + sliderMaxStopSurplusRatio: string; + symbol: string; + }[]; + traderHeadPic: string; + traderName: string; +} + +export interface CTSpotFollowerHistoryOrdersV2 { + endId: string; + trackingList: { + trackingNo: string; + traderId: string; + fillSize: string; + buyPrice: string; + sellPrice: string; + buyFee: string; + sellFee: string; + achievedPL: string; + achievedPLR: string; + symbol: string; + buyTime: string; + sellTime: string; + }[]; +} + +export interface CTSpotFollowerCurrentOrdersV2 { + endId: string; + trackingList: { + trackingNo: string; + traderId: string; + buyFillSize: string; + buyDelegateSize: string; + buyPrice: string; + unrealizedPL: string; + buyTime: string; + buyFee: string; + unrealizedPLR: string; + symbol: string; + stopSurplusPrice: string | null; + stopLossPrice: string | null; + }[]; +}