diff --git a/src/rest-client-v2.ts b/src/rest-client-v2.ts index f63693d..ebbbe10 100644 --- a/src/rest-client-v2.ts +++ b/src/rest-client-v2.ts @@ -23,16 +23,28 @@ import { CreateVirtualSubRequestV2, FundingAssetsV2, FuturesAccountBillRequestV2, + FuturesAccountBillV2, + FuturesAccountListV2, + FuturesAccountV2, FuturesActiveBuySellVolumeV2, FuturesActiveLongShortAccountV2, FuturesActiveLongShortPositionV2, FuturesBatchCancelOrderRequestV2, FuturesBatchOrderRequestV2, + FuturesBatchOrderResponseV2, FuturesCancelAllOrdersRequestV2, + FuturesCancelAllOrdersV2, FuturesCancelOrderRequestV2, FuturesCancelPlanOrderRequestV2, + FuturesCancelPlanOrderV2, FuturesCandlesRequestV2, + FuturesCandlestickV2, + FuturesClosePositionResponseV2, + FuturesContractConfigV2, + FuturesDiscountRateV2, + FuturesFillV2, FuturesFlashClosePositionsRequestV2, + FuturesFundingTimeV2, FuturesGetHistoricalFillsRequestV2, FuturesGetHistoryOrdersRequestV2, FuturesGetHistoryPlanOrdersRequestV2, @@ -40,17 +52,32 @@ import { FuturesGetOrderFillsRequestV2, FuturesGetOrderRequestV2, FuturesGetPlanOrdersRequestV2, + FuturesHistoricalFundingRateV2, FuturesHistoricalPositionsRequestV2, + FuturesHistoricalPositionV2, FuturesHistoricTradesRequestV2, + FuturesHistoryOrdersV2, + FuturesHistoryPlanOrderV2, + FuturesInterestExchangeRateV2, FuturesInterestHistoryRequestV2, + FuturesInterestHistoryV2, + FuturesInterestRateHistoryV2, FuturesLongShortRatioV2, FuturesMergeDepthRequestV2, + FuturesMergeDepthV2, FuturesModifyOrderRequestV2, FuturesModifyPlanOrderRequestV2, FuturesModifyTPSLOrderRequestV2, FuturesOpenCountRequestV2, + FuturesOpenInterestV2, + FuturesOpenOrdersV2, + FuturesOrderDetailV2, + FuturesOrderFillsV2, + FuturesPendingPlanOrderV2, FuturesPlaceOrderRequestV2, FuturesPlanOrderRequestV2, + FuturesPositionTierV2, + FuturesPositionV2, FuturesProductTypeV2, FuturesRecentTradesRequestV2, FuturesReversalOrderRequestV2, @@ -59,9 +86,14 @@ import { FuturesSetMarginModeRequestV2, FuturesSetPositionMarginRequestV2, FuturesSingleAccountRequestV2, + FuturesSubAccountAssetsV2, + FuturesSymbolPriceV2, + FuturesTickerV2, FuturesTPSLOrderRequestV2, FuturesTraderSymbolSettingRequestV2, FuturesTransactionRecordV2, + FuturesTriggerSubOrderV2, + FuturesVipFeeRateV2, GetAnnouncementsRequestV2, GetBorrowHistoryRequestV2, GetConvertBGBHistoryRequestV2, @@ -136,6 +168,8 @@ import { P2PMerchantOrderV2, RedeemSavingsRequestV2, RepayLoanRequestV2, + SetLeverageResponseV2, + SetMarginModeResponseV2, SpotAccountAssetV2, SpotAccountBillV2, SpotAccountInfoV2, @@ -990,97 +1024,99 @@ export class RestClientV2 extends BaseRestClient { * */ - getFuturesVIPFeeRate(): Promise> { + getFuturesVIPFeeRate(): Promise> { return this.get('/api/v2/mix/market/vip-fee-rate'); } getFuturesInterestRateHistory(params: { coin: string; - }): Promise> { + }): Promise> { return this.get('/api/v2/mix/market/union-interest-rate-history', params); } + getFuturesInterestExchangeRate(): Promise< + APIResponse + > { + return this.get('/api/v2/mix/market/exchange-rate'); + } + + getFuturesDiscountRate(): Promise> { + return this.get('/api/v2/mix/market/discount-rate'); + } + + getFuturesMergeDepth( + params: FuturesMergeDepthRequestV2, + ): Promise> { + return this.get('/api/v2/mix/market/merge-depth', params); + } + getFuturesTicker(params: { symbol: string; productType: FuturesProductTypeV2; - }): Promise> { + }): Promise> { return this.get('/api/v2/mix/market/ticker', params); } - getFuturesInterestExchangeRate(): Promise> { - return this.get('/api/v2/mix/market/exchange-rate'); - } - - getFuturesDiscountRate(): Promise> { - return this.get('/api/v2/mix/market/discount-rate'); - } - getFuturesAllTickers(params: { productType: FuturesProductTypeV2; - }): Promise> { + }): Promise> { return this.get('/api/v2/mix/market/tickers', params); } - getFuturesMergeDepth( - params: FuturesMergeDepthRequestV2, - ): Promise> { - return this.get('/api/v2/mix/market/merge-depth', params); - } - - getFuturesCandles( - params: FuturesCandlesRequestV2, - ): Promise> { - return this.get('/api/v2/mix/market/candles', params); - } - - getFuturesHistoricCandles( - params: FuturesCandlesRequestV2, - ): Promise> { - return this.get('/api/v2/mix/market/history-candles', params); - } - - getFuturesHistoricIndexPriceCandles( - params: FuturesCandlesRequestV2, - ): Promise> { - return this.get('/api/v2/mix/market/history-index-candles', params); - } - - getFuturesHistoricMarkPriceCandles( - params: FuturesCandlesRequestV2, - ): Promise> { - return this.get('/api/v2/mix/market/history-mark-candles', params); - } - getFuturesRecentTrades( params: FuturesRecentTradesRequestV2, - ): Promise> { + ): Promise> { return this.get('/api/v2/mix/market/fills', params); } getFuturesHistoricTrades( params: FuturesHistoricTradesRequestV2, - ): Promise> { + ): Promise> { return this.get('/api/v2/mix/market/fills-history', params); } + getFuturesCandles( + params: FuturesCandlesRequestV2, + ): Promise> { + return this.get('/api/v2/mix/market/candles', params); + } + + getFuturesHistoricCandles( + params: FuturesCandlesRequestV2, + ): Promise> { + return this.get('/api/v2/mix/market/history-candles', params); + } + + getFuturesHistoricIndexPriceCandles( + params: FuturesCandlesRequestV2, + ): Promise> { + return this.get('/api/v2/mix/market/history-index-candles', params); + } + + getFuturesHistoricMarkPriceCandles( + params: FuturesCandlesRequestV2, + ): Promise> { + return this.get('/api/v2/mix/market/history-mark-candles', params); + } + getFuturesOpenInterest(params: { symbol: string; productType: FuturesProductTypeV2; - }): Promise> { + }): Promise> { return this.get('/api/v2/mix/market/open-interest', params); } getFuturesNextFundingTime(params: { symbol: string; productType: FuturesProductTypeV2; - }): Promise> { + }): Promise> { return this.get('/api/v2/mix/market/funding-time', params); } getFuturesSymbolPrice(params: { symbol: string; productType: FuturesProductTypeV2; - }): Promise> { + }): Promise> { return this.get('/api/v2/mix/market/symbol-price', params); } @@ -1089,21 +1125,28 @@ export class RestClientV2 extends BaseRestClient { productType: FuturesProductTypeV2; pageSize?: string; pageNumber?: string; - }): Promise> { + }): Promise> { return this.get('/api/v2/mix/market/history-fund-rate', params); } getFuturesCurrentFundingRate(params: { symbol: string; productType: FuturesProductTypeV2; - }): Promise> { + }): Promise< + APIResponse< + { + symbol: string; + fundingRate: string; + }[] + > + > { return this.get('/api/v2/mix/market/current-fund-rate', params); } getFuturesContractConfig(params: { symbol: string; productType: FuturesProductTypeV2; - }): Promise> { + }): Promise> { return this.get('/api/v2/mix/market/contracts', params); } @@ -1115,75 +1158,81 @@ export class RestClientV2 extends BaseRestClient { getFuturesAccountAsset( params: FuturesSingleAccountRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate('/api/v2/mix/account/account', params); } getFuturesAccountAssets(params: { productType: FuturesProductTypeV2; - }): Promise> { + }): Promise> { return this.getPrivate('/api/v2/mix/account/accounts', params); } getFuturesSubAccountAssets(params: { productType: FuturesProductTypeV2; - }): Promise> { + }): Promise> { return this.getPrivate('/api/v2/mix/account/sub-account-assets', params); } getFuturesInterestHistory( params: FuturesInterestHistoryRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate('/api/v2/mix/account/interest-history', params); } - getFuturesOpenCount( - params: FuturesOpenCountRequestV2, - ): Promise> { + getFuturesOpenCount(params: FuturesOpenCountRequestV2): Promise< + APIResponse<{ + size: string; + }> + > { return this.getPrivate('/api/v2/mix/account/open-count', params); } - setFuturesLeverage( - params: FuturesSetLeverageRequestV2, - ): Promise> { - return this.postPrivate('/api/v2/mix/account/set-leverage', params); - } - setFuturesPositionAutoMargin( params: FuturesSetAutoMarginRequestV2, - ): Promise> { + ): Promise> { return this.postPrivate('/api/v2/mix/account/set-auto-margin', params); } + setFuturesLeverage( + params: FuturesSetLeverageRequestV2, + ): Promise> { + return this.postPrivate('/api/v2/mix/account/set-leverage', params); + } + setFuturesPositionMargin( params: FuturesSetPositionMarginRequestV2, - ): Promise> { + ): Promise> { return this.postPrivate('/api/v2/mix/account/set-margin', params); } setFuturesAssetMode(params: { productType: 'USDT-FUTURES' | 'SUSDT-FUTURES'; assetMode: 'single' | 'union'; - }): Promise> { + }): Promise> { return this.postPrivate('/api/v2/mix/account/set-asset-mode', params); } setFuturesMarginMode( params: FuturesSetMarginModeRequestV2, - ): Promise> { + ): Promise> { return this.postPrivate('/api/v2/mix/account/set-margin-mode', params); } setFuturesPositionMode(params: { productType: FuturesProductTypeV2; posMode: 'one_way_mode' | 'hedge_mode'; - }): Promise> { + }): Promise< + APIResponse<{ + posMode: 'one_way_mode' | 'hedge_mode'; + }> + > { return this.postPrivate('/api/v2/mix/account/set-position-mode', params); } getFuturesAccountBills( params: FuturesAccountBillRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate('/api/v2/mix/account/bill', params); } @@ -1196,7 +1245,7 @@ export class RestClientV2 extends BaseRestClient { getFuturesPositionTier(params: { productType: FuturesProductTypeV2; symbol: string; - }): Promise> { + }): Promise> { return this.get('/api/v2/mix/market/query-position-lever', params); } @@ -1204,20 +1253,20 @@ export class RestClientV2 extends BaseRestClient { productType: FuturesProductTypeV2; symbol: string; marginCoin: string; - }): Promise> { + }): Promise> { return this.getPrivate('/api/v2/mix/position/single-position', params); } getFuturesPositions(params: { productType: FuturesProductTypeV2; marginCoin?: string; - }): Promise> { + }): Promise> { return this.getPrivate('/api/v2/mix/position/all-position', params); } getFuturesHistoricPositions( params?: FuturesHistoricalPositionsRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate('/api/v2/mix/position/history-position', params); } @@ -1227,79 +1276,93 @@ export class RestClientV2 extends BaseRestClient { * */ - futuresSubmitOrder( - params: FuturesPlaceOrderRequestV2, - ): Promise> { + futuresSubmitOrder(params: FuturesPlaceOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { return this.postPrivate('/api/v2/mix/order/place-order', params); } - futuresCancelOrder( - params: FuturesCancelOrderRequestV2, - ): Promise> { - return this.postPrivate('/api/v2/mix/order/cancel-order', params); - } - - futuresSubmitReversal( - params: FuturesReversalOrderRequestV2, - ): Promise> { + futuresSubmitReversal(params: FuturesReversalOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { return this.postPrivate('/api/v2/mix/order/click-backhand', params); } futuresBatchSubmitOrders( params: FuturesBatchOrderRequestV2, - ): Promise> { + ): Promise> { return this.postPrivate('/api/v2/mix/order/batch-place-order', params); } - futuresModifyOrder( - params: FuturesModifyOrderRequestV2, - ): Promise> { + futuresModifyOrder(params: FuturesModifyOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { return this.postPrivate('/api/v2/mix/order/modify-order', params); } + futuresCancelOrder(params: FuturesCancelOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { + return this.postPrivate('/api/v2/mix/order/cancel-order', params); + } + futuresBatchCancelOrders( params: FuturesBatchCancelOrderRequestV2, - ): Promise> { + ): Promise> { return this.postPrivate('/api/v2/mix/order/batch-cancel-orders', params); } futuresFlashClosePositions( params: FuturesFlashClosePositionsRequestV2, - ): Promise> { + ): Promise> { return this.postPrivate('/api/v2/mix/order/close-positions', params); } - getFuturesOrder(params: FuturesGetOrderRequestV2): Promise> { + getFuturesOrder( + params: FuturesGetOrderRequestV2, + ): Promise> { return this.getPrivate('/api/v2/mix/order/detail', params); } getFuturesFills( params: FuturesGetOrderFillsRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate('/api/v2/mix/order/fills', params); } getFuturesHistoricOrderFills( params: FuturesGetHistoricalFillsRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate('/api/v2/mix/order/fill-history', params); } getFuturesOpenOrders( params: FuturesGetOpenOrdersRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate('/api/v2/mix/order/orders-pending', params); } getFuturesHistoricOrders( params: FuturesGetHistoryOrdersRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate('/api/v2/mix/order/orders-history', params); } futuresCancelAllOrders( params: FuturesCancelAllOrdersRequestV2, - ): Promise> { + ): Promise> { return this.postPrivate('/api/v2/mix/order/cancel-all-orders', params); } @@ -1309,53 +1372,65 @@ export class RestClientV2 extends BaseRestClient { * */ - futuresSubmitPlanSubOrder(params: { + getFuturesTriggerSubOrder(params: { planType: 'normal_plan' | 'track_plan'; planOrderId: string; productType: FuturesProductTypeV2; - }): Promise> { - return this.postPrivate('/api/v2/mix/order/plan-sub-order', params); + }): Promise> { + return this.getPrivate('/api/v2/mix/order/plan-sub-order', params); } - futuresSubmitTPSLOrder( - params: FuturesTPSLOrderRequestV2, - ): Promise> { + futuresSubmitTPSLOrder(params: FuturesTPSLOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { return this.postPrivate('/api/v2/mix/order/place-tpsl-order', params); } - futuresSubmitPlanOrder( - params: FuturesPlanOrderRequestV2, - ): Promise> { + futuresSubmitPlanOrder(params: FuturesPlanOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { return this.postPrivate('/api/v2/mix/order/place-plan-order', params); } - futuresModifyTPSLPOrder( - params: FuturesModifyTPSLOrderRequestV2, - ): Promise> { + futuresModifyTPSLPOrder(params: FuturesModifyTPSLOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { return this.postPrivate('/api/v2/mix/order/modify-tpsl-order', params); } - futuresModifyPlanOrder( - params: FuturesModifyPlanOrderRequestV2, - ): Promise> { + futuresModifyPlanOrder(params: FuturesModifyPlanOrderRequestV2): Promise< + APIResponse<{ + orderId: string; + clientOid: string; + }> + > { return this.postPrivate('/api/v2/mix/order/modify-plan-order', params); } - futuresCancelPlanOrder( - params: FuturesCancelPlanOrderRequestV2, - ): Promise> { - return this.postPrivate('/api/v2/mix/order/cancel-plan-order', params); - } - getFuturesPlanOrders( params: FuturesGetPlanOrdersRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate('/api/v2/mix/order/orders-plan-pending', params); } + futuresCancelPlanOrder( + params: FuturesCancelPlanOrderRequestV2, + ): Promise> { + return this.postPrivate('/api/v2/mix/order/cancel-plan-order', params); + } + getFuturesHistoricPlanOrders( params: FuturesGetHistoryPlanOrdersRequestV2, - ): Promise> { + ): Promise> { return this.getPrivate('/api/v2/mix/order/orders-plan-history', params); } diff --git a/src/types/response/index.ts b/src/types/response/index.ts index bc58c8c..f9c806c 100644 --- a/src/types/response/index.ts +++ b/src/types/response/index.ts @@ -2,4 +2,5 @@ export * from './v1/futures'; export * from './v1/shared'; export * from './v1/spot'; export * from './v2/common'; +export * from './v2/futures'; export * from './v2/spot'; diff --git a/src/types/response/v2/futures.ts b/src/types/response/v2/futures.ts new file mode 100644 index 0000000..fbe4d84 --- /dev/null +++ b/src/types/response/v2/futures.ts @@ -0,0 +1,614 @@ +/** + * + * * Futures | Market + * + */ + +export interface FuturesVipFeeRateV2 { + level: string; + dealAmount: string; + assetAmount: string; + takerFeeRate: string; + makerFeeRate: string; + btcWithdrawAmount: string; + usdtWithdrawAmount: string; +} + +export interface FuturesInterestRateHistoryV2 { + coin: string; + historyInterestRateList: { + ts: string; + annualInterestRate: string; + dailyInterestRate: string; + }[]; +} + +export interface FuturesInterestExchangeRateV2 { + coin: string; + exchangeRateList: { + tier: string; + minAmount: string; + maxAmount: string; + exchangeRate: string; + }[]; +} + +export interface FuturesDiscountRateV2 { + coin: string; + userLimit: string; + totalLimit: string; + discountRateList: { + tier: string; + minAmount: string; + maxAmount: string; + discountRate: string; + }[]; +} + +export interface FuturesMergeDepthV2 { + asks: [number, number][]; + bids: [number, number][]; + ts: string; + scale: string; + precision: string; + isMaxPrecision: string; +} + +export interface FuturesTickerV2 { + symbol: string; + lastPr: string; + askPr: string; + bidPr: string; + bidSz: string; + askSz: string; + high24h: string; + low24h: string; + ts: string; + change24h: string; + baseVolume: string; + quoteVolume: string; + usdtVolume: string; + openUtc: string; + changeUtc24h: string; + indexPrice: string; + fundingRate: string; + holdingAmount: string; + deliveryStartTime: string; + deliveryTime: string; + deliveryStatus: string; + open24h: string; + markPrice: string; +} + +export interface FuturesFillV2 { + tradeId: string; + price: string; + size: string; + side: string; + ts: string; + symbol: string; +} + +export interface FuturesCandlestickV2 { + [0]: string; // timestamp + [1]: string; // open + [2]: string; // high + [3]: string; // low + [4]: string; // close + [5]: string; // baseVolume + [6]: string; // quoteVolume +} + +export interface FuturesOpenInterestV2 { + openInterestList: { + symbol: string; + size: string; + }[]; + ts: string; +} + +export interface FuturesFundingTimeV2 { + symbol: string; + nextFundingTime: string; + ratePeriod: string; +} + +export interface FuturesSymbolPriceV2 { + symbol: string; + price: string; + indexPrice: string; + markPrice: string; + ts: string; +} + +export interface FuturesHistoricalFundingRateV2 { + symbol: string; + fundingRate: string; + fundingTime: string; +} + +export interface FuturesContractConfigV2 { + symbol: string; + baseCoin: string; + quoteCoin: string; + buyLimitPriceRatio: string; + sellLimitPriceRatio: string; + feeRateUpRatio: string; + makerFeeRate: string; + takerFeeRate: string; + openCostUpRatio: string; + supportMarginCoins: string[]; + minTradeNum: string; + priceEndStep: string; + volumePlace: string; + pricePlace: string; + sizeMultiplier: string; + symbolType: string; + minTradeUSDT: string; + maxSymbolOrderNum: string; + maxProductOrderNum: string; + maxPositionNum: string; + symbolStatus: string; + offTime: string; + limitOpenTime: string; + deliveryTime: string; + deliveryStartTime: string; + launchTime: string; + fundInterval: string; + minLever: string; + maxLever: string; + posLimit: string; + maintainTime: string; +} + +/** + * + * * Futures | Account + * + */ + +export interface FuturesAccountV2 { + marginCoin: string; + locked: string; + available: string; + crossedMaxAvailable: string; + isolatedMaxAvailable: string; + maxTransferOut: string; + accountEquity: string; + usdtEquity: string; + btcEquity: string; + crossedRiskRate: string; + crossedMarginLeverage: string; + isolatedLongLever: string; + isolatedShortLever: string; + marginMode: string; + posMode: string; + unrealizedPL: string; + coupon: string; + crossedUnrealizedPL: string; + isolatedUnrealizedPL: string; + assetMode: string; +} + +export interface FuturesAccountListV2 { + marginCoin: string; + locked: string; + available: string; + crossedMaxAvailable: string; + isolatedMaxAvailable: string; + maxTransferOut: string; + accountEquity: string; + usdtEquity: string; + btcEquity: string; + crossedRiskRate: string; + unrealizedPL: string; + coupon: string; + unionTotalMagin: string; + unionAvailable: string; + unionMm: string; + assetList: { + coin: string; + balance: string; + }[]; + isolatedMargin: string; + crossedMargin: string; + crossedUnrealizedPL: string; + isolatedUnrealizedPL: string; + assetMode: string; +} + +export interface FuturesSubAccountAssetsV2 { + userId: number; + assetList: { + marginCoin: string; + locked: string; + available: string; + crossedMaxAvailable: string; + isolatedMaxAvailable: string; + maxTransferOut: string; + accountEquity: string; + usdtEquity: string; + btcEquity: string; + unrealizedPL: string; + coupon: string; + }[]; +} + +export interface FuturesInterestHistoryV2 { + nextSettleTime: string; + borrowAmount: string; + borrowLimit: string; + interestList: { + coin: string; + liability: string; + interestFreeLimit: string; + interestLimit: string; + hourInterestRate: string; + interest: string; + cTime: string; + }[]; + endId: string; +} + +export interface SetLeverageResponseV2 { + symbol: string; + marginCoin: string; + longLeverage: string; + shortLeverage: string; + crossMarginLeverage: string; + marginMode: string; +} + +export interface SetMarginModeResponseV2 { + symbol: string; + marginCoin: string; + longLeverage: string; + shortLeverage: string; + marginMode: string; +} + +export interface FuturesAccountBillV2 { + bills: { + billId: string; + symbol: string; + amount: string; + fee: string; + feeByCoupon: string; + businessType: string; + coin: string; + balance: string; + cTime: string; + }[]; + endId: string; +} + +/** + * + * * Futures | Position + * + */ + +export interface FuturesPositionTierV2 { + symbol: string; + level: string; + startUnit: string; + endUnit: string; + leverage: string; + keepMarginRate: string; +} + +export interface FuturesPositionV2 { + marginCoin: string; + symbol: string; + holdSide: string; + openDelegateSize: string; + marginSize: string; + available: string; + locked: string; + total: string; + leverage: string; + achievedProfits: string; + openPriceAvg: string; + marginMode: string; + posMode: string; + unrealizedPL: string; + liquidationPrice: string; + keepMarginRate: string; + markPrice: string; + breakEvenPrice: string; + totalFee: string; + deductedFee: string; + marginRatio: string; + assetMode: string; + uTime: string; + autoMargin: string; + cTime: string; +} + +export interface FuturesHistoricalPositionV2 { + list: { + positionId: string; + marginCoin: string; + symbol: string; + holdSide: string; + openAvgPrice: string; + closeAvgPrice: string; + marginMode: string; + openTotalPos: string; + closeTotalPos: string; + pnl: string; + netProfit: string; + totalFunding: string; + openFee: string; + closeFee: string; + cTime: string; + uTime: string; + }[]; + endId: string; +} + +/** + * + * * Futures | Trade + * + */ + +export interface FuturesBatchOrderResponseV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + errorCode: string; + }[]; +} + +export interface FuturesClosePositionResponseV2 { + successList: { + orderId: string; + clientOid: string; + symbol: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + symbol: string; + errorMsg: string; + errorCode: string; + }[]; +} + +export interface FuturesOrderDetailV2 { + symbol: string; + size: string; + orderId: string; + clientOid: string; + baseVolume: string; + priceAvg: string; + fee: string; + price: string; + state: string; + side: string; + force: string; + totalProfits: string; + posSide: string; + marginCoin: string; + presetStopSurplusPrice: string; + presetStopLossPrice: string; + quoteVolume: string; + orderType: string; + leverage: string; + marginMode: string; + reduceOnly: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + orderSource: string; + cancelReason: string; + cTime: string; + uTime: string; +} + +export interface FuturesOrderFillsV2 { + fillList: { + tradeId: string; + symbol: string; + orderId: string; + price: string; + baseVolume: string; + feeDetail: { + deduction: string; + feeCoin: string; + totalDeductionFee: string; + totalFee: string; + }[]; + side: string; + quoteVolume: string; + profit: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + tradeScope: string; + cTime: string; + }[]; + endId: string; +} + +export interface FuturesOpenOrdersV2 { + entrustedList: { + symbol: string; + size: string; + orderId: string; + clientOid: string; + baseVolume: string; + fee: string; + price: string; + priceAvg: string; + status: string; + side: string; + force: string; + totalProfits: string; + posSide: string; + marginCoin: string; + quoteVolume: string; + leverage: string; + marginMode: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + orderType: string; + orderSource: string; + cTime: string; + uTime: string; + presetStopSurplusPrice: string; + presetStopSurplusType: string; + presetStopSurplusExecutePrice: string; + presetStopLossPrice: string; + presetStopLossType: string; + presetStopLossExecutePrice: string; + }[]; + endId: string; +} + +export interface FuturesHistoryOrdersV2 { + entrustedList: { + symbol: string; + size: string; + orderId: string; + clientOid: string; + baseVolume: string; + fee: string; + price: string; + priceAvg: string; + status: string; + side: string; + force: string; + totalProfits: string; + posSide: string; + marginCoin: string; + quoteVolume: string; + leverage: string; + marginMode: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + orderType: string; + orderSource: string; + cTime: string; + uTime: string; + presetStopSurplusPrice: string; + presetStopLossPrice: string; + }[]; + endId: string; +} + +export interface FuturesCancelAllOrdersV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + errorCode: string; + }[]; +} + +/** + * + * * Futures | Trigger Orders + * + */ + +export interface FuturesTriggerSubOrderV2 { + orderId: string; + price: string; + type: string; + status: string; +} + +export interface FuturesPendingPlanOrderV2 { + entrustedList: { + planType: string; + symbol: string; + size: string; + orderId: string; + clientOid: string; + price: string; + executePrice: string; + callbackRatio: string; + triggerPrice: string; + triggerType: string; + planStatus: string; + side: string; + posSide: string; + marginCoin: string; + marginMode: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + orderType: string; + orderSource: string; + cTime: string; + uTime: string; + stopSurplusExecutePrice: string; + stopSurplusTriggerPrice: string; + stopSurplusTriggerType: string; + stopLossExecutePrice: string; + stopLossTriggerPrice: string; + stopLossTriggerType: string; + }[]; + endId: string; +} + +export interface FuturesCancelPlanOrderV2 { + successList: { + orderId: string; + clientOid: string; + }[]; + failureList: { + orderId: string; + clientOid: string; + errorMsg: string; + }[]; +} + +export interface FuturesHistoryPlanOrderV2 { + entrustedList: { + planType: string; + symbol: string; + size: string; + orderId: string; + executeOrderId: string; + clientOid: string; + planStatus: string; + price: string; + executePrice: string; + priceAvg: string; + baseVolume: string; + callbackRatio: string; + triggerPrice: string; + triggerType: string; + side: string; + posSide: string; + marginCoin: string; + marginMode: string; + enterPointSource: string; + tradeSide: string; + posMode: string; + orderType: string; + cTime: string; + uTime: string; + stopSurplusExecutePrice: string; + stopSurplusTriggerPrice: string; + stopSurplusTriggerType: string; + stopLossExecutePrice: string; + stopLossTriggerPrice: string; + stopLossTriggerType: string; + }[]; + endId: string; +}