Merge pull request #53 from JJ-Cro/master

v2.1.0 feat(): added all request types
This commit is contained in:
Tiago
2024-12-10 16:58:37 +00:00
committed by GitHub
12 changed files with 2478 additions and 339 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "bitget-api",
"version": "2.0.13",
"version": "2.1.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "bitget-api",
"version": "2.0.13",
"version": "2.1.0",
"license": "MIT",
"dependencies": {
"axios": "^1.6.1",

View File

@@ -1,6 +1,6 @@
{
"name": "bitget-api",
"version": "2.0.13",
"version": "2.1.0",
"description": "Node.js & JavaScript SDK for Bitget REST APIs & WebSockets, with TypeScript & end-to-end tests.",
"main": "lib/index.js",
"types": "lib/index.d.ts",

File diff suppressed because it is too large Load Diff

View File

@@ -3,4 +3,9 @@ export * from './v1/futuresV1';
export * from './v1/spotV1';
export * from './v2/futures';
export * from './v2/spot';
export * from './v2/broker';
export * from './v2/margin';
export * from './v2/copytrading';
export * from './v2/earn';
export * from './shared';
export * from './v2/common';

View File

@@ -22,3 +22,18 @@ export interface GetHistoricTradesParams {
* The margin type, used directly in building the endpoint URL
*/
export type MarginType = 'crossed' | 'isolated';
export type FuturesProductTypeV2 =
| 'USDT-FUTURES'
| 'COIN-FUTURES'
| 'USDC-FUTURES'
| 'SUSDT-FUTURES'
| 'SCOIN-FUTURES'
| 'SUSDC-FUTURES';
export type FuturesPlanTypeV2 =
| 'profit_plan'
| 'loss_plan'
| 'moving_plan'
| 'pos_profit'
| 'pos_loss';

View File

@@ -0,0 +1,99 @@
/**
*
* * Broker | Subaccount
*
*/
export interface GetSubAccountsRequestV2 {
limit?: string;
idLessThan?: string;
status?: 'normal' | 'freeze' | 'del';
startTime?: string;
endTime?: string;
}
export type SubAccountPermissionV2 =
| 'withdraw'
| 'transfer'
| 'spot_trade'
| 'contract_trade'
| 'read'
| 'deposit'
| 'margin_trade';
export type SubAccountLanguageV2 =
| 'en_US'
| 'zh_CN'
| 'ja_JP'
| 'vi_VN'
| 'zh_TW'
| 'ru_RU'
| 'es_ES'
| 'tr_TR'
| 'fr_FR'
| 'de_DE'
| 'pt_PT'
| 'th_TH';
export type SubAccountStatusV2 = 'normal' | 'freeze';
export interface ModifySubRequestV2 {
subUid: string;
permList: SubAccountPermissionV2[];
status: SubAccountStatusV2;
language?: SubAccountLanguageV2;
}
export interface SubWithdrawalRequestV2 {
subUid: string;
coin: string;
dest: 'on_chain' | 'internal_transfer';
chain?: string;
address: string;
amount: string;
tag?: string;
clientOid?: string;
}
export interface SubDepositRecordsRequestV2 {
orderId?: string;
userId?: string;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface SubWithdrawalRecordsRequestV2 {
orderId?: string;
userId?: string;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
/**
*
* * Broker | Subaccount
*
*/
export interface CreateSubAccountApiKeyRequestV2 {
subUid: string;
passphrase: string;
label?: string;
ipList: string[];
permType: string;
permList: string[];
}
export interface ModifySubAccountApiKeyRequestV2 {
subUid: string;
apiKey: string;
label?: string;
passphrase: string;
ipList?: string[];
permType?: string;
permList: string[];
}

View File

@@ -0,0 +1,187 @@
import { FuturesProductTypeV2, MarginType } from '../shared';
/**
*
* * Common | Notice
*
*/
export interface GetAnnouncementsRequestV2 {
annType?: string;
startTime?: string;
endTime?: string;
language: string;
}
/**
*
* * Common | Public
*
*/
export interface GetTradeRateRequestV2 {
symbol: string;
businessType: string;
}
/**
*
* * Common | Tax
*
*/
export interface GetSpotTransactionsRequestV2 {
coin?: string;
startTime: string;
endTime: string;
limit?: string;
idLessThan?: string;
}
export interface GetFuturesTransactionsRequestV2 {
productType?: FuturesProductTypeV2;
marginCoin?: string;
startTime: string;
endTime: string;
limit?: string;
idLessThan?: string;
}
export interface GetMarginTransactionsRequestV2 {
marginType?: MarginType;
coin?: string;
startTime: string;
endTime: string;
limit?: string;
idLessThan?: string;
}
export interface GetP2PTransactionsRequestV2 {
coin?: string;
startTime: string;
endTime: string;
limit?: string;
idLessThan?: string;
}
/**
*
* * Common | P2P
*
*/
export interface GetP2PMerchantsRequestV2 {
online?: 'yes' | 'no';
idLessThan?: string;
limit?: string;
}
export interface GetMerchantP2POrdersRequestV2 {
startTime: string;
endTime?: string;
idLessThan?: string;
limit?: string;
status?: string;
advNo: string;
side?: string;
coin?: string;
language: string;
fiat?: string;
orderNo?: string;
}
export interface GetMerchantAdvertisementsRequestV2 {
startTime: string;
endTime?: string;
idLessThan?: string;
limit?: string;
status: string;
advNo?: string;
side: string;
coin: string;
language?: string;
fiat: string;
orderBy?: string;
payMethodId?: string;
sourceType?: string;
}
/**
*
* * Common | Virtual Subaccount
*
*/
export interface ModifyVirtualSubRequestV2 {
subAccountUid: string;
permList: string[];
status: string;
}
export interface CreateVirtualSubRequestV2 {
subAccountName: string;
passphrase: string;
label: string;
ipList?: string[];
permList?: string[];
}
export interface CreateVirtualSubApiKeyRequestV2 {
subAccountUid: string;
passphrase: string;
label: string;
ipList?: string[];
permList?: string[];
}
export interface ModifyVirtualSubApiKeyRequestV2 {
subAccountUid: string;
subAccountApiKey: string;
passphrase: string;
label: string;
ipList?: string[];
permList?: string[];
}
/**
*
* * Common | Convert
*
*/
export interface ConvertQuoteRequestV2 {
fromCoin: string;
fromCoinSize?: string;
toCoin: string;
toCoinSize?: string;
}
export interface ConvertRequestV2 {
fromCoin: string;
fromCoinSize: string;
cnvtPrice: string;
toCoin: string;
toCoinSize: string;
traceId: string;
}
export interface GetConvertHistoryRequestV2 {
startTime: string;
endTime: string;
limit?: string;
idLessThan?: string;
}
/**
*
* * Common | BGB Convert
*
*/
export interface GetConvertBGBHistoryRequestV2 {
orderId?: string;
startTime: string;
endTime: string;
limit?: string;
idLessThan?: string;
}

View File

@@ -0,0 +1,223 @@
/**
*
*
* Copy Trading | Future copy trading | Trader Api
*
*
*/
export type CopyTradingProductTypeV2 =
| 'USDT-FUTURES'
| 'COIN-FUTURES'
| 'USDC-FUTURES';
export interface GetFuturesTraderCurrentOrdersRequestV2 {
symbol?: string;
productType: CopyTradingProductTypeV2;
startTime?: string;
endTime?: string;
limit?: string;
idGreaterThan?: string;
idLessThan?: string;
}
export interface GetFuturesTraderHistoryOrdersRequestV2 {
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
order?: 'asc' | 'desc';
symbol?: string;
productType: CopyTradingProductTypeV2;
}
export interface ModifyFuturesTraderOrderTPSLRequestV2 {
trackingNo: string;
productType: CopyTradingProductTypeV2;
stopSurplusPrice?: string;
stopLossPrice?: string;
}
export interface GetFuturesTraderProfitShareDetailRequestV2 {
coin?: string;
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
}
export interface FuturesTraderSymbolSettingRequestV2 {
symbol: string;
productType: CopyTradingProductTypeV2;
settingType: 'ADD' | 'DELETE' | 'UPDATE';
stopSurplusRatio?: string;
stopLossRatio?: string;
}
export interface GetFuturesTraderFollowersRequestV2 {
pageNo?: string;
pageSize?: string;
startTime?: string;
endTime?: string;
}
/**
*
*
* Copy Trading | Future copy trading | Follower Api
*
*
*/
export interface GetFollowerFuturesCurrentTrackingOrdersRequestV2 {
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
symbol?: string;
productType: CopyTradingProductTypeV2;
traderId?: string;
}
export interface GetFollowerFuturesHistoryTrackingOrdersRequestV2 {
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
symbol?: string;
productType: CopyTradingProductTypeV2;
traderId?: string;
}
export interface UpdateFuturesFollowerTPSLRequestV2 {
trackingNo: string;
symbol?: string;
productType: CopyTradingProductTypeV2;
stopSurplusPrice?: string;
stopLossPrice?: string;
}
export type AutoCopyOption = 'on' | 'off';
export type FollowMode = 'basic' | 'advanced';
export type LeverageType = 'position' | 'specify' | 'trader';
export type TraceType = 'percent' | 'amount' | 'count';
export interface FollowerCopyTradeSettingRequestV2 {
symbol: string;
productType: CopyTradingProductTypeV2;
marginType: 'trader' | 'specify';
marginCoin?: string;
leverType: LeverageType;
longLeverage?: string;
shortLeverage?: string;
traceType: TraceType;
traceValue: string;
maxHoldSize?: string;
stopSurplusRatio?: string;
stopLossRatio?: string;
}
export interface UpdateFuturesFollowerSettingsRequestV2 {
traderId: string;
autoCopy?: AutoCopyOption;
mode?: FollowMode;
settings: FollowerCopyTradeSettingRequestV2[];
}
export interface CloseFuturesFollowerPositionsRequestV2 {
productType: CopyTradingProductTypeV2;
trackingNo?: string;
symbol?: string;
marginCoin?: string;
marginMode?: 'isolated' | 'cross';
holdSide?: 'long' | 'short';
}
export interface GetFuturesFollowerTradersRequestV2 {
startTime?: string;
endTime?: string;
pageNo?: string;
pageSize?: string;
}
/**
*
*
* Copy Trading | Spot copy trading | Trader api
*
*
*/
export interface GetSpotTraderHistoryProfitRequestV2 {
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
coin?: string;
}
export interface GetSpotTraderHistoryOrdersRequestV2 {
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
symbol?: string;
}
export interface GetSpotTraderCurrentOrdersRequestV2 {
symbol?: string;
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
}
export interface GetSpotTraderFollowersRequestV2 {
pageNo?: string;
pageSize?: string;
startTime?: string;
endTime?: string;
}
/**
*
*
* Copy Trading | Spot copy trading | Follower api
*
*
*/
export interface SpotFollowerCopyTradeSettingV2 {
symbol: string;
traceType: 'percent' | 'amount' | 'count';
maxHoldSize: string;
traceValue: string;
stopLossRatio?: string;
stopSurplusRatio?: string;
}
export interface GetSpotFollowerHistoryOrdersRequestV2 {
symbol?: string;
traderId?: string;
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
}
export interface GetSpotFollowerOpenOrdersRequestV2 {
symbol?: string;
traderId?: string;
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
}

View File

@@ -0,0 +1,136 @@
/**
*
*
* Earn | Savings
*
*
*/
export interface GetEarnSavingsAssetsRequestV2 {
periodType: string;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetEarnSavingsRecordsRequestV2 {
coin?: string;
periodType: string;
orderType?: string;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface RedeemSavingsRequestV2 {
productId: string;
orderId?: string;
periodType: string;
amount: string;
}
/**
*
*
* Earn | Shark Fin
*
*
*/
export interface GetSharkfinAssetsRequestV2 {
status: string;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetSharkfinRecordsRequestV2 {
coin?: string;
type: string;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
/**
*
*
* Earn | Loan
*
*
*/
export interface GetLoanEstInterestAndBorrowableRequestV2 {
loanCoin: string;
pledgeCoin: string;
daily: 'SEVEN' | 'THIRTY';
pledgeAmount?: string;
}
export interface BorrowLoanRequestV2 {
loanCoin: string;
pledgeCoin: string;
daily: 'SEVEN' | 'THIRTY';
pledgeAmount?: string;
loanAmount?: string;
}
export interface RepayLoanRequestV2 {
orderId: string;
amount?: string;
repayUnlock?: string;
repayAll: string;
}
export interface GetLoanRepayHistoryRequestV2 {
orderId?: string;
loanCoin?: string;
pledgeCoin?: string;
startTime: string;
endTime: string;
pageNo?: string;
pageSize?: string;
}
export interface ModifyLoanPledgeRateRequestV2 {
orderId: string;
amount: string;
pledgeCoin: string;
reviseType: string;
}
export interface GetLoanPledgeRateHistoryRequestV2 {
orderId?: string;
reviseSide?: string;
pledgeCoin?: string;
startTime: string;
endTime: string;
pageNo?: string;
pageSize?: string;
}
export interface GetLoanHistoryRequestV2 {
orderId?: string;
loanCoin?: string;
pledgeCoin?: string;
status?: string;
startTime: string;
endTime: string;
pageNo?: string;
pageSize?: string;
}
export interface GetLiquidationRecordsRequestV2 {
orderId?: string;
loanCoin?: string;
pledgeCoin?: string;
status?: string;
startTime: string;
endTime: string;
pageNo?: string;
pageSize?: string;
}

View File

@@ -1,13 +1,6 @@
import { FuturesPlanTypeV2, FuturesProductTypeV2 } from '../shared';
import { FuturesKlineInterval } from '../v1/futuresV1';
export type FuturesProductTypeV2 =
| 'USDT-FUTURES'
| 'COIN-FUTURES'
| 'USDC-FUTURES'
| 'SUSDT-FUTURES'
| 'SCOIN-FUTURES'
| 'SUSDC-FUTURES';
export type FuturesKlineTypeV2 = 'MARKET' | 'MARK' | 'INDEX';
export interface FuturesAccountBillRequestV2 {
@@ -21,6 +14,34 @@ export interface FuturesAccountBillRequestV2 {
limit?: string;
}
/**
*
* * Futures | Market
*
*/
export interface FuturesMergeDepthRequestV2 {
symbol: string;
productType: FuturesProductTypeV2;
precision?: 'scale0' | 'scale1' | 'scale2' | 'scale3';
limit?: '1' | '5' | '15' | '50' | 'max';
}
export interface FuturesRecentTradesRequestV2 {
symbol: string;
productType: FuturesProductTypeV2;
limit?: string;
}
export interface FuturesHistoricTradesRequestV2 {
symbol: string;
productType: FuturesProductTypeV2;
limit?: string;
idLessThan?: string;
startTime?: string;
endTime?: string;
}
export interface FuturesCandlesRequestV2 {
symbol: string;
productType: FuturesProductTypeV2;
@@ -30,3 +51,391 @@ export interface FuturesCandlesRequestV2 {
kLineType?: FuturesKlineTypeV2;
limit?: string;
}
/**
*
* * Futures | Account
*
*/
export interface FuturesSingleAccountRequestV2 {
symbol: string;
productType: FuturesProductTypeV2;
marginCoin: string;
}
export interface FuturesInterestHistoryRequestV2 {
productType: 'USDT-FUTURES' | 'SUSDT-FUTURES';
coin?: string;
idLessThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
}
export interface FuturesOpenCountRequestV2 {
symbol: string;
productType: FuturesProductTypeV2;
marginCoin: string;
openAmount: string;
openPrice: string;
leverage?: string;
}
export interface FuturesSetAutoMarginRequestV2 {
symbol: string;
autoMargin: 'on' | 'off';
marginCoin: string;
amount: string;
holdSide?: 'long' | 'short';
}
export interface FuturesSetLeverageRequestV2 {
symbol: string;
productType: FuturesProductTypeV2;
marginCoin: string;
leverage: string;
holdSide?: 'long' | 'short';
}
export interface FuturesSetPositionMarginRequestV2 {
symbol: string;
productType: FuturesProductTypeV2;
marginCoin: string;
holdSide: 'long' | 'short';
amount: string;
}
export interface FuturesSetMarginModeRequestV2 {
symbol: string;
productType: FuturesProductTypeV2;
marginCoin: string;
marginMode: 'isolated' | 'crossed';
}
/**
*
* * Futures | Position
*
*/
export interface FuturesHistoricalPositionsRequestV2 {
symbol?: string;
productType?: FuturesProductTypeV2;
idLessThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
}
/**
*
* * Futures | Trade
*
*/
export interface FuturesPlaceOrderRequestV2 {
symbol: string;
productType: FuturesProductTypeV2;
marginMode: 'isolated' | 'crossed';
marginCoin: string;
size: string;
price?: string;
side: 'buy' | 'sell';
tradeSide?: 'open' | 'close';
orderType: 'limit' | 'market';
force?: 'ioc' | 'fok' | 'gtc' | 'post_only';
clientOid?: string;
reduceOnly?: 'YES' | 'NO';
presetStopSurplusPrice?: string;
presetStopLossPrice?: string;
stpMode?: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both';
}
export interface FuturesReversalOrderRequestV2 {
symbol: string;
productType: FuturesProductTypeV2;
marginCoin: string;
size: string;
side?: 'buy' | 'sell';
tradeSide?: 'open' | 'close';
clientOid?: string;
}
interface FuturesBatchOrderItem {
size: string;
price?: string;
side: 'buy' | 'sell';
tradeSide?: 'open' | 'close';
orderType: 'limit' | 'market';
force?: 'ioc' | 'fok' | 'gtc' | 'post_only';
clientOid?: string;
reduceOnly?: 'YES' | 'NO';
presetStopSurplusPrice?: string;
presetStopLossPrice?: string;
stpMode?: 'none' | 'cancel_taker' | 'cancel_maker' | 'cancel_both';
}
export interface FuturesBatchOrderRequestV2 {
symbol: string;
productType: FuturesProductTypeV2;
marginCoin: string;
marginMode: 'isolated' | 'crossed';
orderList: FuturesBatchOrderItem[];
}
export interface FuturesModifyOrderRequestV2 {
orderId?: string;
clientOid?: string;
symbol: string;
productType: FuturesProductTypeV2;
newClientOid: string;
newSize?: string;
newPrice?: string;
newPresetStopSurplusPrice?: string;
newPresetStopLossPrice?: string;
}
export interface FuturesCancelOrderRequestV2 {
symbol: string;
productType: FuturesProductTypeV2;
marginCoin?: string;
orderId?: string;
clientOid?: string;
}
interface FuturesBatchCancelOrderItem {
orderId?: string;
clientOid?: string;
}
export interface FuturesBatchCancelOrderRequestV2 {
orderIdList?: FuturesBatchCancelOrderItem[];
symbol?: string;
productType: FuturesProductTypeV2;
marginCoin?: string;
}
export interface FuturesFlashClosePositionsRequestV2 {
symbol?: string;
productType: FuturesProductTypeV2;
holdSide?: 'long' | 'short';
}
export interface FuturesGetOrderRequestV2 {
symbol: string;
productType: FuturesProductTypeV2;
orderId?: string;
clientOid?: string;
}
export interface FuturesGetOrderFillsRequestV2 {
orderId?: string;
symbol?: string;
productType: FuturesProductTypeV2;
idLessThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
}
export interface FuturesGetHistoricalFillsRequestV2 {
orderId?: string;
symbol?: string;
productType: FuturesProductTypeV2;
startTime?: string;
endTime?: string;
idLessThan?: string;
limit?: string;
}
export interface FuturesGetOpenOrdersRequestV2 {
orderId?: string;
clientOid?: string;
symbol?: string;
productType: FuturesProductTypeV2;
status?: 'live' | 'partially_filled';
idLessThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
}
export type FuturesOrderSourceV2 =
| 'normal'
| 'market'
| 'profit_market'
| 'loss_market'
| 'Trader_delegate'
| 'trader_profit'
| 'trader_loss'
| 'reverse'
| 'trader_reverse'
| 'profit_limit'
| 'loss_limit'
| 'liquidation'
| 'delivery_close_long'
| 'delivery_close_short'
| 'pos_profit_limit'
| 'pos_profit_market'
| 'pos_loss_limit'
| 'pos_loss_market';
export interface FuturesGetHistoryOrdersRequestV2 {
orderId?: string;
clientOid?: string;
symbol?: string;
productType: FuturesProductTypeV2;
idLessThan?: string;
orderSource?: FuturesOrderSourceV2;
startTime?: string;
endTime?: string;
limit?: string;
}
export interface FuturesCancelAllOrdersRequestV2 {
symbol?: string;
productType: FuturesProductTypeV2;
marginCoin?: string;
requestTime?: string;
receiveWindow?: string;
}
/**
*
* * Futures | Trigger Orders
*
*/
export type FuturesTriggerTypeV2 = 'fill_price' | 'mark_price';
export type FuturesStpModeV2 =
| 'none'
| 'cancel_taker'
| 'cancel_maker'
| 'cancel_both';
export interface FuturesTPSLOrderRequestV2 {
marginCoin: string;
productType: FuturesProductTypeV2;
symbol: string;
planType: FuturesPlanTypeV2;
triggerPrice: string;
triggerType?: FuturesTriggerTypeV2;
executePrice?: string;
holdSide: 'long' | 'short' | 'buy' | 'sell';
size: string;
rangeRate?: string;
clientOid?: string;
stpMode?: FuturesStpModeV2;
}
export type FuturesTriggerPriceTypeV2 =
| 'fill_price'
| 'mark_price'
| 'index_price';
export interface FuturesPlanOrderRequestV2 {
planType: 'normal_plan' | 'track_plan';
symbol: string;
productType: FuturesProductTypeV2;
marginMode: 'isolated' | 'crossed';
marginCoin: string;
size: string;
price?: string;
callbackRatio?: string;
triggerPrice: string;
triggerType: 'mark_price' | 'fill_price';
side: 'buy' | 'sell';
tradeSide?: 'open' | 'close';
orderType: 'limit' | 'market';
clientOid?: string;
reduceOnly?: 'YES' | 'NO';
stopSurplusTriggerPrice?: string;
stopSurplusExecutePrice?: string;
stopSurplusTriggerType?: FuturesTriggerPriceTypeV2;
stopLossTriggerPrice?: string;
stopLossExecutePrice?: string;
stopLossTriggerType?: FuturesTriggerPriceTypeV2;
stpMode?: FuturesStpModeV2;
}
export interface FuturesModifyTPSLOrderRequestV2 {
orderId?: string;
clientOid?: string;
marginCoin: string;
productType: FuturesProductTypeV2;
symbol: string;
triggerPrice: string;
triggerType?: 'fill_price' | 'mark_price';
executePrice?: string;
size: string;
rangeRate?: string;
}
export interface FuturesModifyPlanOrderRequestV2 {
planType: 'normal_plan' | 'track_plan';
orderId?: string;
clientOid?: string;
symbol: string;
productType: FuturesProductTypeV2;
newSize?: string;
newPrice?: string;
newCallbackRatio?: string;
newTriggerPrice?: string;
newTriggerType?: 'fill_price' | 'mark_price';
newStopSurplusTriggerPrice?: string;
newStopSurplusExecutePrice?: string;
newStopSurplusTriggerType?: FuturesTriggerPriceTypeV2;
newStopLossTriggerPrice?: string;
newStopLossExecutePrice?: string;
newStopLossTriggerType?: FuturesTriggerPriceTypeV2;
}
export interface FuturesGetPlanOrdersRequestV2 {
orderId?: string;
clientOid?: string;
symbol?: string;
planType: 'normal_plan' | 'track_plan' | 'profit_loss';
productType: FuturesProductTypeV2;
idLessThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
}
interface FuturesCancelPlanOrderItemV2 {
orderId?: string;
clientOid?: string;
}
export type FuturesPlanOrderTypeV2 =
| 'normal_plan'
| 'profit_plan'
| 'loss_plan'
| 'pos_profit'
| 'pos_loss'
| 'moving_plan';
export interface FuturesCancelPlanOrderRequestV2 {
orderIdList?: FuturesCancelPlanOrderItemV2[];
symbol?: string;
productType: FuturesProductTypeV2;
marginCoin?: string;
planType?: FuturesPlanOrderTypeV2;
}
export type FuturesPlanStatusV2 = 'executed' | 'fail_trigger' | 'cancelled';
export interface FuturesGetHistoryPlanOrdersRequestV2 {
orderId?: string;
clientOid?: string;
planType: 'normal_plan' | 'track_plan' | 'profit_loss';
planStatus?: FuturesPlanStatusV2;
symbol?: string;
productType: FuturesProductTypeV2;
idLessThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
}

View File

@@ -0,0 +1,148 @@
/**
*
* * Margin | Cross/Isolated | Order Record
*
*/
export interface GetBorrowHistoryRequestV2 {
loanId?: string;
coin?: string;
startTime: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetRepayHistoryRequestV2 {
repayId?: string;
coin?: string;
startTime: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetInterestHistoryRequestV2 {
coin?: string;
startTime: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetLiquidationHistoryRequestV2 {
startTime: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetFinancialHistoryRequestV2 {
marginType?: string;
coin?: string;
startTime: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
/**
*
* * Margin | Cross/Isolated | Account
*
*/
/**
*
* * Margin | Cross/Isolated | Trade
*
*/
export type MarginOrderTypeV2 = 'limit' | 'market';
export type MarginLoanTypeV2 =
| 'normal'
| 'autoLoan'
| 'autoRepay'
| 'autoLoanAndRepay';
export type MarginTimeInForceV2 = 'gtc' | 'post_only' | 'fok' | 'ioc';
export type MarginOrderSideV2 = 'buy' | 'sell';
export type MarginSTPModeV2 =
| 'none'
| 'cancel_taker'
| 'cancel_maker'
| 'cancel_both';
export interface MarginPlaceOrderRequestV2 {
symbol: string;
orderType: MarginOrderTypeV2;
price?: string;
loanType: MarginLoanTypeV2;
force: MarginTimeInForceV2;
baseSize?: string;
quoteSize?: string;
clientOid?: string;
side: MarginOrderSideV2;
stpMode?: MarginSTPModeV2;
}
export interface MarginBatchOrderEntry {
orderType: MarginOrderTypeV2;
price?: string;
loanType: MarginLoanTypeV2;
force: MarginTimeInForceV2;
baseSize?: string;
quoteSize?: string;
clientOid?: string;
side: MarginOrderSideV2;
stpMode?: MarginSTPModeV2;
}
export interface MarginBatchOrdersRequestV2 {
symbol: string;
orderList: MarginBatchOrderEntry[];
}
export interface GetMarginCurrentOrdersRequestV2 {
symbol: string;
orderId?: string;
clientOid?: string;
startTime: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetHistoryOrdersRequestV2 {
symbol: string;
orderId?: string;
enterPointSource?: string;
clientOid?: string;
startTime: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetMarginOrderFillsRequestV2 {
symbol: string;
orderId?: string;
idLessThan?: string;
startTime: string;
endTime?: string;
limit?: string;
}
export interface GetMarginLiquidationOrdersRequestV2 {
type?: 'swap' | 'place_order';
symbol?: string;
fromCoin?: string;
toCoin?: string;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}

View File

@@ -25,3 +25,327 @@ export interface SpotCandlesRequestV2 {
endTime?: string;
limit?: string;
}
export interface SpotHistoricCandlesRequestV2 {
symbol: string;
granularity: SpotKlineIntervalV2;
endTime?: string;
limit?: string;
}
export interface SpotHistoricTradesRequestV2 {
symbol: string;
limit?: string;
idLessThan?: string;
startTime?: string;
endTime?: string;
}
/**
*
* * Spot | Trade
*
*/
export type SpotOrderSideV2 = 'buy' | 'sell';
export type SpotOrderTypeV2 = 'limit' | 'market';
export type SpotOrderForceV2 = 'gtc' | 'post_only' | 'fok' | 'ioc';
export type SpotTPSLTypeV2 = 'normal' | 'tpsl';
export type SpotSTPModeV2 =
| 'none'
| 'cancel_taker'
| 'cancel_maker'
| 'cancel_both';
export type SpotBatchModeV2 = 'single' | 'multiple';
export interface SpotOrderRequestV2 {
symbol: string;
side: SpotOrderSideV2;
orderType: SpotOrderTypeV2;
force: SpotOrderForceV2;
price?: string;
size: string;
clientOid?: string;
triggerPrice?: string;
tpslType?: SpotTPSLTypeV2;
requestTime?: string;
receiveWindow?: string;
stpMode?: SpotSTPModeV2;
presetTakeProfitPrice?: string;
executeTakeProfitPrice?: string;
presetStopLossPrice?: string;
executeStopLossPrice?: string;
}
export interface SpotCancelandSubmitOrderRequestV2 {
symbol: string;
price: string;
size: string;
orderId?: string;
clientOid?: string;
newClientOid?: string;
presetTakeProfitPrice?: string;
executeTakeProfitPrice?: string;
presetStopLossPrice?: string;
executeStopLossPrice?: string;
}
export interface SpotCancelOrderRequestV2 {
symbol: string;
tpslType?: SpotTPSLTypeV2;
orderId?: string;
clientOid?: string;
}
export interface SpotBatchOrderRequestItemV2 {
symbol?: string;
side: SpotOrderSideV2;
orderType: SpotOrderTypeV2;
force: SpotOrderForceV2;
price?: string;
size: string;
clientOid?: string;
stpMode?: SpotSTPModeV2;
presetTakeProfitPrice?: string;
executeTakeProfitPrice?: string;
presetStopLossPrice?: string;
executeStopLossPrice?: string;
}
export interface SpotBatchOrderRequestV2 {
symbol?: string;
batchMode?: SpotBatchModeV2;
orderList: SpotBatchOrderRequestItemV2[];
}
export interface SpotBatchCancelOrderRequestV2 {
symbol?: string;
batchMode?: SpotBatchModeV2;
orderList: {
symbol?: string;
orderId?: string;
clientOid?: string;
}[];
}
export interface GetSpotOrderInfoRequestV2 {
orderId?: string;
clientOid?: string;
requestTime?: string;
receiveWindow?: string;
}
export interface GetSpotOpenOrdersRequestV2 {
symbol?: string;
startTime?: string;
endTime?: string;
idLessThan?: string;
limit?: string;
orderId?: string;
tpslType?: SpotTPSLTypeV2;
requestTime?: string;
receiveWindow?: string;
}
export interface GetSpotHistoryOrdersRequestV2 {
symbol?: string;
startTime?: string;
endTime?: string;
idLessThan?: string;
limit?: string;
orderId?: string;
tpslType?: SpotTPSLTypeV2;
requestTime?: string;
receiveWindow?: string;
}
export interface GetSpotFillsRequestV2 {
symbol: string;
orderId?: string;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
/**
*
* * Spot | Trigger Orders
*
*/
export type SpotPlanTypeV2 = 'amount' | 'total';
export type SpotTriggerTypeV2 = 'fill_price' | 'mark_price';
export interface SpotPlanOrderRequestV2 {
symbol: string;
side: SpotOrderSideV2;
triggerPrice: string;
orderType: SpotOrderTypeV2;
executePrice?: string;
planType?: SpotPlanTypeV2;
size: string;
triggerType: SpotTriggerTypeV2;
clientOid?: string;
force?: SpotOrderForceV2;
stpMode?: SpotSTPModeV2;
}
export interface SpotModifyPlanOrderRequestV2 {
orderId?: string;
clientOid?: string;
triggerPrice: string;
orderType: SpotOrderTypeV2;
executePrice?: string;
size: string;
}
export interface GetSpotCurrentPlanOrdersRequestV2 {
symbol: string;
limit?: string;
idLessThan?: string;
startTime?: string;
endTime?: string;
}
export interface GetSpotHistoryPlanOrdersRequestV2 {
symbol: string;
startTime: string;
endTime: string;
limit?: string;
}
/**
*
* * Spot | Account
*
*/
export type SpotBillGroupTypeV2 =
| 'deposit'
| 'withdraw'
| 'transaction'
| 'transfer'
| 'other';
export type SpotBusinessTypeV2 =
| 'deposit'
| 'withdraw'
| 'buy'
| 'sell'
| 'deduction of handling fee'
| 'transfer-in'
| 'transfer-out'
| 'rebate rewards'
| 'airdrop rewards'
| 'USDT contract rewards'
| 'mix contract rewards'
| 'system lock'
| 'user lock';
export type SpotAccountTypeV2 =
| 'spot'
| 'p2p'
| 'coin_futures'
| 'usdt_futures'
| 'usdc_futures'
| 'crossed_margin'
| 'isolated_margin';
export interface GetSpotAccountBillsRequestV2 {
coin?: string;
groupType?: SpotBillGroupTypeV2;
businessType?: SpotBusinessTypeV2;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface SpotTransferRequestV2 {
fromType: SpotAccountTypeV2;
toType: SpotAccountTypeV2;
amount: string;
coin: string;
symbol: string;
clientOid?: string;
}
export interface SpotSubAccountTransferRequestV2 {
fromType: SpotAccountTypeV2;
toType: SpotAccountTypeV2;
amount: string;
coin: string;
symbol?: string;
clientOid?: string;
fromUserId: string;
toUserId: string;
}
export interface SpotWithdrawalRequestV2 {
coin: string;
transferType: 'on_chain' | 'internal_transfer';
address: string;
chain?: string;
innerToType?: 'email' | 'mobile' | 'uid';
areaCode?: string;
tag?: string;
size: string;
remark?: string;
clientOid?: string;
}
export interface SpotMainSubTransferRecordRequestV2 {
coin?: string;
role?: 'initiator' | 'receiver';
subUid?: string;
startTime?: string;
endTime?: string;
clientOid?: string;
limit?: string;
idLessThan?: string;
}
export interface GetSpotTransferRecordRequestV2 {
coin: string;
fromType: SpotAccountTypeV2;
startTime?: string;
endTime?: string;
clientOid?: string;
limit?: string;
idLessThan?: string;
}
export interface GetSpotSubAccountDepositRecordRequestV2 {
subUid: string;
coin?: string;
startTime?: string;
endTime?: string;
idLessThan?: string;
limit?: string;
}
export interface GetSpotWithdrawalRecordRequestV2 {
coin?: string;
clientOid?: string;
startTime: string;
endTime: string;
idLessThan?: string;
orderId?: string;
limit?: string;
}
export interface GetSpotDepositRecordRequestV2 {
coin?: string;
orderId?: string;
startTime: string;
endTime: string;
idLessThan?: string;
limit?: string;
}