v2.1.0 feat(): added all request types

This commit is contained in:
JJ-Cro
2024-12-10 12:16:28 +01:00
parent 96f2ebe3c8
commit cf2464a210
12 changed files with 2500 additions and 363 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 GetSubaccountsRequest {
limit?: string;
idLessThan?: string;
status?: 'normal' | 'freeze' | 'del';
startTime?: string;
endTime?: string;
}
export type SubaccountPermission =
| 'withdraw'
| 'transfer'
| 'spot_trade'
| 'contract_trade'
| 'read'
| 'deposit'
| 'margin_trade';
export type SubaccountLanguage =
| '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 SubaccountStatus = 'normal' | 'freeze';
export interface ModifySubRequest {
subUid: string;
permList: SubaccountPermission[];
status: SubaccountStatus;
language?: SubaccountLanguage;
}
export interface SubWithdrawalRequest {
subUid: string;
coin: string;
dest: 'on_chain' | 'internal_transfer';
chain?: string;
address: string;
amount: string;
tag?: string;
clientOid?: string;
}
export interface SubDepositRecordsRequest {
orderId?: string;
userId?: string;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface SubWithdrawalRecordsRequest {
orderId?: string;
userId?: string;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
/**
*
* * Broker | Subaccount
*
*/
export interface CreateSubaccountApiKeyRequest {
subUid: string;
passphrase: string;
label?: string;
ipList: string[];
permType: string;
permList: string[];
}
export interface ModifySubaccountApiKeyRequest {
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 GetAnnouncementsRequest {
annType?: string;
startTime?: string;
endTime?: string;
language: string;
}
/**
*
* * Common | Public
*
*/
export interface GetTradeRateRequest {
symbol: string;
businessType: string;
}
/**
*
* * Common | Tax
*
*/
export interface GetSpotTransactionsRequest {
coin?: string;
startTime: string;
endTime: string;
limit?: string;
idLessThan?: string;
}
export interface GetFuturesTransactionsRequest {
productType?: FuturesProductTypeV2;
marginCoin?: string;
startTime: string;
endTime: string;
limit?: string;
idLessThan?: string;
}
export interface GetMarginTransactionsRequest {
marginType?: MarginType;
coin?: string;
startTime: string;
endTime: string;
limit?: string;
idLessThan?: string;
}
export interface GetP2PTransactionsRequest {
coin?: string;
startTime: string;
endTime: string;
limit?: string;
idLessThan?: string;
}
/**
*
* * Common | P2P
*
*/
export interface GetP2PMerchantsRequest {
online?: 'yes' | 'no';
idLessThan?: string;
limit?: string;
}
export interface GetMerchantP2POrdersRequest {
startTime: string;
endTime?: string;
idLessThan?: string;
limit?: string;
status?: string;
advNo: string;
side?: string;
coin?: string;
language: string;
fiat?: string;
orderNo?: string;
}
export interface GetMerchantAdvertisementsRequest {
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 ModifyVirtualSubRequest {
subAccountUid: string;
permList: string[];
status: string;
}
export interface CreateVirtualSubRequest {
subAccountName: string;
passphrase: string;
label: string;
ipList?: string[];
permList?: string[];
}
export interface CreateVirtualSubApiKeyRequest {
subAccountUid: string;
passphrase: string;
label: string;
ipList?: string[];
permList?: string[];
}
export interface ModifyVirtualSubApiKeyRequest {
subAccountUid: string;
subAccountApiKey: string;
passphrase: string;
label: string;
ipList?: string[];
permList?: string[];
}
/**
*
* * Common | Convert
*
*/
export interface ConvertQuoteRequest {
fromCoin: string;
fromCoinSize?: string;
toCoin: string;
toCoinSize?: string;
}
export interface ConvertRequest {
fromCoin: string;
fromCoinSize: string;
cnvtPrice: string;
toCoin: string;
toCoinSize: string;
traceId: string;
}
export interface GetConvertHistoryRequest {
startTime: string;
endTime: string;
limit?: string;
idLessThan?: string;
}
/**
*
* * Common | BGB Convert
*
*/
export interface GetConvertBGBHistoryRequest {
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 CopyTradingProductType =
| 'USDT-FUTURES'
| 'COIN-FUTURES'
| 'USDC-FUTURES';
export interface GetFuturesTraderCurrentOrdersRequest {
symbol?: string;
productType: CopyTradingProductType;
startTime?: string;
endTime?: string;
limit?: string;
idGreaterThan?: string;
idLessThan?: string;
}
export interface GetFuturesTraderHistoryOrdersRequest {
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
order?: 'asc' | 'desc';
symbol?: string;
productType: CopyTradingProductType;
}
export interface ModifyFuturesTraderOrderTPSLRequest {
trackingNo: string;
productType: CopyTradingProductType;
stopSurplusPrice?: string;
stopLossPrice?: string;
}
export interface GetFuturesTraderProfitShareDetailRequest {
coin?: string;
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
}
export interface FuturesTraderSymbolSettingReq {
symbol: string;
productType: CopyTradingProductType;
settingType: 'ADD' | 'DELETE' | 'UPDATE';
stopSurplusRatio?: string;
stopLossRatio?: string;
}
export interface GetFuturesTraderFollowers {
pageNo?: string;
pageSize?: string;
startTime?: string;
endTime?: string;
}
/**
*
*
* Copy Trading | Future copy trading | Follower Api
*
*
*/
export interface GetFollowerFuturesCurrentTrackingOrdersRequest {
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
symbol?: string;
productType: CopyTradingProductType;
traderId?: string;
}
export interface GetFollowerFuturesHistoryTrackingOrdersRequest {
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
symbol?: string;
productType: CopyTradingProductType;
traderId?: string;
}
export interface UpdateFuturesFollowerTPSLRequest {
trackingNo: string;
symbol?: string;
productType: CopyTradingProductType;
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 FollowerCopyTradeSetting {
symbol: string;
productType: CopyTradingProductType;
marginType: 'trader' | 'specify';
marginCoin?: string;
leverType: LeverageType;
longLeverage?: string;
shortLeverage?: string;
traceType: TraceType;
traceValue: string;
maxHoldSize?: string;
stopSurplusRatio?: string;
stopLossRatio?: string;
}
export interface UpdateFuturesFollowerSettingsRequest {
traderId: string;
autoCopy?: AutoCopyOption;
mode?: FollowMode;
settings: FollowerCopyTradeSetting[];
}
export interface CloseFuturesFollowerPositionsRequest {
productType: CopyTradingProductType;
trackingNo?: string;
symbol?: string;
marginCoin?: string;
marginMode?: 'isolated' | 'cross';
holdSide?: 'long' | 'short';
}
export interface GetFuturesFollowerTradersRequest {
startTime?: string;
endTime?: string;
pageNo?: string;
pageSize?: string;
}
/**
*
*
* Copy Trading | Spot copy trading | Trader api
*
*
*/
export interface getSpotTraderHistoryProfitReq {
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
coin?: string;
}
export interface GetSpotTraderHistoryOrdersReq {
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
symbol?: string;
}
export interface GetSpotTraderCurrentOrdersReq {
symbol?: string;
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
}
export interface GetSpotTraderFollowersRequest {
pageNo?: string;
pageSize?: string;
startTime?: string;
endTime?: string;
}
/**
*
*
* Copy Trading | Spot copy trading | Follower api
*
*
*/
export interface SpotFollowerCopyTradeSetting {
symbol: string;
traceType: 'percent' | 'amount' | 'count';
maxHoldSize: string;
traceValue: string;
stopLossRatio?: string;
stopSurplusRatio?: string;
}
export interface GetSpotFollowerHistoryOrdersRequest {
symbol?: string;
traderId?: string;
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
}
export interface GetSpotFollowerOpenOrdersRequest {
symbol?: string;
traderId?: string;
idLessThan?: string;
idGreaterThan?: string;
startTime?: string;
endTime?: string;
limit?: string;
}

View File

@@ -0,0 +1,136 @@
/**
*
*
* Earn | Savings
*
*
*/
export interface GetEarnSavingsAssetsRequest {
periodType: string;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetEarnSavingsRecordsRequest {
coin?: string;
periodType: string;
orderType?: string;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface RedeemSavingsRequest {
productId: string;
orderId?: string;
periodType: string;
amount: string;
}
/**
*
*
* Earn | Shark Fin
*
*
*/
export interface GetSharkfinAssetsRequest {
status: string;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetSharkfinRecordsRequest {
coin?: string;
type: string;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
/**
*
*
* Earn | Loan
*
*
*/
export interface GetLoanEstInterestAndBorrowableRequest {
loanCoin: string;
pledgeCoin: string;
daily: 'SEVEN' | 'THIRTY';
pledgeAmount?: string;
}
export interface BorrowLoanRequest {
loanCoin: string;
pledgeCoin: string;
daily: 'SEVEN' | 'THIRTY';
pledgeAmount?: string;
loanAmount?: string;
}
export interface RepayLoanRequest {
orderId: string;
amount?: string;
repayUnlock?: string;
repayAll: string;
}
export interface GetLoanRepayHistoryRequest {
orderId?: string;
loanCoin?: string;
pledgeCoin?: string;
startTime: string;
endTime: string;
pageNo?: string;
pageSize?: string;
}
export interface ModifyLoanPledgeRateRequest {
orderId: string;
amount: string;
pledgeCoin: string;
reviseType: string;
}
export interface GetLoanPledgeRateHistoryRequest {
orderId?: string;
reviseSide?: string;
pledgeCoin?: string;
startTime: string;
endTime: string;
pageNo?: string;
pageSize?: string;
}
export interface GetLoanHistoryRequest {
orderId?: string;
loanCoin?: string;
pledgeCoin?: string;
status?: string;
startTime: string;
endTime: string;
pageNo?: string;
pageSize?: string;
}
export interface GetLiquidationRecordsRequest {
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 FuturesOrderSource =
| '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?: FuturesOrderSource;
startTime?: string;
endTime?: string;
limit?: string;
}
export interface FuturesCancelAllOrdersRequestV2 {
symbol?: string;
productType: FuturesProductTypeV2;
marginCoin?: string;
requestTime?: string;
receiveWindow?: string;
}
/**
*
* * Futures | Trigger Orders
*
*/
export type FuturesTriggerType = 'fill_price' | 'mark_price';
export type FuturesStpMode =
| 'none'
| 'cancel_taker'
| 'cancel_maker'
| 'cancel_both';
export interface FuturesTPSLOrderRequestV2 {
marginCoin: string;
productType: FuturesProductTypeV2;
symbol: string;
planType: FuturesPlanTypeV2;
triggerPrice: string;
triggerType?: FuturesTriggerType;
executePrice?: string;
holdSide: 'long' | 'short' | 'buy' | 'sell';
size: string;
rangeRate?: string;
clientOid?: string;
stpMode?: FuturesStpMode;
}
export type FuturesTriggerPriceType =
| '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?: FuturesTriggerPriceType;
stopLossTriggerPrice?: string;
stopLossExecutePrice?: string;
stopLossTriggerType?: FuturesTriggerPriceType;
stpMode?: FuturesStpMode;
}
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?: FuturesTriggerPriceType;
newStopLossTriggerPrice?: string;
newStopLossExecutePrice?: string;
newStopLossTriggerType?: FuturesTriggerPriceType;
}
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 FuturesCancelPlanOrderItem {
orderId?: string;
clientOid?: string;
}
export type FuturesPlanOrderType =
| 'normal_plan'
| 'profit_plan'
| 'loss_plan'
| 'pos_profit'
| 'pos_loss'
| 'moving_plan';
export interface FuturesCancelPlanOrderRequestV2 {
orderIdList?: FuturesCancelPlanOrderItem[];
symbol?: string;
productType: FuturesProductTypeV2;
marginCoin?: string;
planType?: FuturesPlanOrderType;
}
export type FuturesPlanStatus = 'executed' | 'fail_trigger' | 'cancelled';
export interface FuturesGetHistoryPlanOrdersRequestV2 {
orderId?: string;
clientOid?: string;
planType: 'normal_plan' | 'track_plan' | 'profit_loss';
planStatus?: FuturesPlanStatus;
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 GetBorrowHistoryRequest {
loanId?: string;
coin?: string;
startTime: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetRepayHistoryRequest {
repayId?: string;
coin?: string;
startTime: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetInterestHistoryRequest {
coin?: string;
startTime: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetLiquidationHistoryRequest {
startTime: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetFinancialHistoryRequest {
marginType?: string;
coin?: string;
startTime: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
/**
*
* * Margin | Cross/Isolated | Account
*
*/
/**
*
* * Margin | Cross/Isolated | Trade
*
*/
export type MarginOrderType = 'limit' | 'market';
export type MarginLoanType =
| 'normal'
| 'autoLoan'
| 'autoRepay'
| 'autoLoanAndRepay';
export type MarginTimeInForce = 'gtc' | 'post_only' | 'fok' | 'ioc';
export type MarginOrderSide = 'buy' | 'sell';
export type MarginSTPMode =
| 'none'
| 'cancel_taker'
| 'cancel_maker'
| 'cancel_both';
export interface MarginPlaceOrderRequest {
symbol: string;
orderType: MarginOrderType;
price?: string;
loanType: MarginLoanType;
force: MarginTimeInForce;
baseSize?: string;
quoteSize?: string;
clientOid?: string;
side: MarginOrderSide;
stpMode?: MarginSTPMode;
}
export interface MarginBatchOrderEntry {
orderType: MarginOrderType;
price?: string;
loanType: MarginLoanType;
force: MarginTimeInForce;
baseSize?: string;
quoteSize?: string;
clientOid?: string;
side: MarginOrderSide;
stpMode?: MarginSTPMode;
}
export interface MarginBatchOrdersRequest {
symbol: string;
orderList: MarginBatchOrderEntry[];
}
export interface GetMarginCurrentOrdersRequest {
symbol: string;
orderId?: string;
clientOid?: string;
startTime: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetHistoryOrdersRequest {
symbol: string;
orderId?: string;
enterPointSource?: string;
clientOid?: string;
startTime: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface GetMarginOrderFillsRequest {
symbol: string;
orderId?: string;
idLessThan?: string;
startTime: string;
endTime?: string;
limit?: string;
}
export interface GetMarginLiquidationOrdersRequest {
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 SpotHistoricTradesRequest {
symbol: string;
limit?: string;
idLessThan?: string;
startTime?: string;
endTime?: string;
}
/**
*
* * Spot | Trade
*
*/
export type SpotOrderSide = 'buy' | 'sell';
export type SpotOrderType = 'limit' | 'market';
export type SpotOrderForce = 'gtc' | 'post_only' | 'fok' | 'ioc';
export type SpotTPSLType = 'normal' | 'tpsl';
export type SpotSTPMode =
| 'none'
| 'cancel_taker'
| 'cancel_maker'
| 'cancel_both';
export type SpotBatchMode = 'single' | 'multiple';
export interface SpotOrderRequest {
symbol: string;
side: SpotOrderSide;
orderType: SpotOrderType;
force: SpotOrderForce;
price?: string;
size: string;
clientOid?: string;
triggerPrice?: string;
tpslType?: SpotTPSLType;
requestTime?: string;
receiveWindow?: string;
stpMode?: SpotSTPMode;
presetTakeProfitPrice?: string;
executeTakeProfitPrice?: string;
presetStopLossPrice?: string;
executeStopLossPrice?: string;
}
export interface SpotCancelandSubmitOrderRequest {
symbol: string;
price: string;
size: string;
orderId?: string;
clientOid?: string;
newClientOid?: string;
presetTakeProfitPrice?: string;
executeTakeProfitPrice?: string;
presetStopLossPrice?: string;
executeStopLossPrice?: string;
}
export interface SpotCancelOrderRequest {
symbol: string;
tpslType?: SpotTPSLType;
orderId?: string;
clientOid?: string;
}
export interface SpotBatchOrderRequestItem {
symbol?: string;
side: SpotOrderSide;
orderType: SpotOrderType;
force: SpotOrderForce;
price?: string;
size: string;
clientOid?: string;
stpMode?: SpotSTPMode;
presetTakeProfitPrice?: string;
executeTakeProfitPrice?: string;
presetStopLossPrice?: string;
executeStopLossPrice?: string;
}
export interface SpotBatchOrderRequest {
symbol?: string;
batchMode?: SpotBatchMode;
orderList: SpotBatchOrderRequestItem[];
}
export interface SpotBatchCancelOrderRequest {
symbol?: string;
batchMode?: SpotBatchMode;
orderList: {
symbol?: string;
orderId?: string;
clientOid?: string;
}[];
}
export interface GetSpotOrderInfoRequest {
orderId?: string;
clientOid?: string;
requestTime?: string;
receiveWindow?: string;
}
export interface GetSpotOpenOrdersRequest {
symbol?: string;
startTime?: string;
endTime?: string;
idLessThan?: string;
limit?: string;
orderId?: string;
tpslType?: SpotTPSLType;
requestTime?: string;
receiveWindow?: string;
}
export interface GetSpotHistoryOrdersRequest {
symbol?: string;
startTime?: string;
endTime?: string;
idLessThan?: string;
limit?: string;
orderId?: string;
tpslType?: SpotTPSLType;
requestTime?: string;
receiveWindow?: string;
}
export interface GetSpotFillsRequest {
symbol: string;
orderId?: string;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
/**
*
* * Spot | Trigger Orders
*
*/
export type SpotPlanType = 'amount' | 'total';
export type SpotTriggerType = 'fill_price' | 'mark_price';
export interface SpotPlanOrderRequest {
symbol: string;
side: SpotOrderSide;
triggerPrice: string;
orderType: SpotOrderType;
executePrice?: string;
planType?: SpotPlanType;
size: string;
triggerType: SpotTriggerType;
clientOid?: string;
force?: SpotOrderForce;
stpMode?: SpotSTPMode;
}
export interface SpotModifyPlanOrderRequest {
orderId?: string;
clientOid?: string;
triggerPrice: string;
orderType: SpotOrderType;
executePrice?: string;
size: string;
}
export interface GetSpotCurrentPlanOrdersRequest {
symbol: string;
limit?: string;
idLessThan?: string;
startTime?: string;
endTime?: string;
}
export interface GetSpotHistoryPlanOrdersRequest {
symbol: string;
startTime: string;
endTime: string;
limit?: string;
}
/**
*
* * Spot | Account
*
*/
export type SpotBillGroupType =
| 'deposit'
| 'withdraw'
| 'transaction'
| 'transfer'
| 'other';
export type SpotBusinessType =
| '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 SpotAccountType =
| 'spot'
| 'p2p'
| 'coin_futures'
| 'usdt_futures'
| 'usdc_futures'
| 'crossed_margin'
| 'isolated_margin';
export interface GetSpotAccountBillsRequest {
coin?: string;
groupType?: SpotBillGroupType;
businessType?: SpotBusinessType;
startTime?: string;
endTime?: string;
limit?: string;
idLessThan?: string;
}
export interface SpotTransferRequest {
fromType: SpotAccountType;
toType: SpotAccountType;
amount: string;
coin: string;
symbol: string;
clientOid?: string;
}
export interface SpotSubAccountTransferRequest {
fromType: SpotAccountType;
toType: SpotAccountType;
amount: string;
coin: string;
symbol?: string;
clientOid?: string;
fromUserId: string;
toUserId: string;
}
export interface SpotWithdrawalRequest {
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 SpotMainSubTransferRecordRequest {
coin?: string;
role?: 'initiator' | 'receiver';
subUid?: string;
startTime?: string;
endTime?: string;
clientOid?: string;
limit?: string;
idLessThan?: string;
}
export interface GetSpotTransferRecordRequest {
coin: string;
fromType: SpotAccountType;
startTime?: string;
endTime?: string;
clientOid?: string;
limit?: string;
idLessThan?: string;
}
export interface GetSpotSubAccountDepositRecordRequest {
subUid: string;
coin?: string;
startTime?: string;
endTime?: string;
idLessThan?: string;
limit?: string;
}
export interface GetSpotWithdrawalRecordRequest {
coin?: string;
clientOid?: string;
startTime: string;
endTime: string;
idLessThan?: string;
orderId?: string;
limit?: string;
}
export interface GetSpotDepositRecordRequest {
coin?: string;
orderId?: string;
startTime: string;
endTime: string;
idLessThan?: string;
limit?: string;
}