okx-api 0.0.1 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -173
- package/lib/constants/funding.d.ts +139 -0
- package/lib/constants/funding.js +143 -0
- package/lib/constants/funding.js.map +1 -0
- package/lib/constants/index.d.ts +1 -0
- package/lib/constants/index.js +18 -0
- package/lib/constants/index.js.map +1 -0
- package/lib/index.d.ts +3 -1
- package/lib/index.js +18 -13
- package/lib/index.js.map +1 -1
- package/lib/rest-client.d.ts +402 -0
- package/lib/rest-client.js +741 -0
- package/lib/rest-client.js.map +1 -0
- package/lib/types/rest/index.d.ts +3 -0
- package/lib/types/rest/index.js +20 -0
- package/lib/types/rest/index.js.map +1 -0
- package/lib/types/rest/request/account.d.ts +32 -0
- package/lib/types/rest/request/account.js +3 -0
- package/lib/types/rest/request/account.js.map +1 -0
- package/lib/types/rest/request/block-trading.d.ts +60 -0
- package/lib/types/rest/request/block-trading.js +3 -0
- package/lib/types/rest/request/block-trading.js.map +1 -0
- package/lib/types/rest/request/convert.d.ts +19 -0
- package/lib/types/rest/request/convert.js +3 -0
- package/lib/types/rest/request/convert.js.map +1 -0
- package/lib/types/rest/request/funding.d.ts +21 -0
- package/lib/types/rest/request/funding.js +3 -0
- package/lib/types/rest/request/funding.js.map +1 -0
- package/lib/types/rest/request/grid-trading.d.ts +30 -0
- package/lib/types/rest/request/grid-trading.js +3 -0
- package/lib/types/rest/request/grid-trading.js.map +1 -0
- package/lib/types/rest/request/index.d.ts +8 -0
- package/lib/types/rest/request/index.js +25 -0
- package/lib/types/rest/request/index.js.map +1 -0
- package/lib/types/rest/request/shared.d.ts +7 -0
- package/lib/types/rest/request/shared.js +3 -0
- package/lib/types/rest/request/shared.js.map +1 -0
- package/lib/types/rest/request/subaccount.d.ts +12 -0
- package/lib/types/rest/request/subaccount.js +3 -0
- package/lib/types/rest/request/subaccount.js.map +1 -0
- package/lib/types/rest/request/trade.d.ts +113 -0
- package/lib/types/rest/request/trade.js +3 -0
- package/lib/types/rest/request/trade.js.map +1 -0
- package/lib/types/rest/response/index.d.ts +6 -0
- package/lib/types/rest/response/index.js +23 -0
- package/lib/types/rest/response/index.js.map +1 -0
- package/lib/types/rest/response/private-account.d.ts +213 -0
- package/lib/types/rest/response/private-account.js +3 -0
- package/lib/types/rest/response/private-account.js.map +1 -0
- package/lib/types/rest/response/private-block-trading.d.ts +89 -0
- package/lib/types/rest/response/private-block-trading.js +3 -0
- package/lib/types/rest/response/private-block-trading.js.map +1 -0
- package/lib/types/rest/response/private-funding.d.ts +68 -0
- package/lib/types/rest/response/private-funding.js +3 -0
- package/lib/types/rest/response/private-funding.js.map +1 -0
- package/lib/types/rest/response/private-subaccount.d.ts +56 -0
- package/lib/types/rest/response/private-subaccount.js +3 -0
- package/lib/types/rest/response/private-subaccount.js.map +1 -0
- package/lib/types/rest/response/private-trade.d.ts +235 -0
- package/lib/types/rest/response/private-trade.js +3 -0
- package/lib/types/rest/response/private-trade.js.map +1 -0
- package/lib/types/rest/response/public-data.d.ts +70 -0
- package/lib/types/rest/response/public-data.js +3 -0
- package/lib/types/rest/response/public-data.js.map +1 -0
- package/lib/types/rest/shared.d.ts +40 -0
- package/lib/types/rest/shared.js +3 -0
- package/lib/types/rest/shared.js.map +1 -0
- package/lib/util/BaseRestClient.d.ts +34 -0
- package/lib/util/BaseRestClient.js +204 -0
- package/lib/util/BaseRestClient.js.map +1 -0
- package/lib/util/browser-support.d.ts +1 -0
- package/lib/util/browser-support.js +24 -0
- package/lib/util/browser-support.js.map +1 -0
- package/lib/util/node-support.d.ts +1 -0
- package/lib/util/node-support.js +9 -0
- package/lib/util/node-support.js.map +1 -0
- package/lib/util/requestUtils.d.ts +17 -0
- package/lib/util/requestUtils.js +52 -0
- package/lib/util/requestUtils.js.map +1 -0
- package/lib/util/typeGuards.d.ts +2 -0
- package/lib/util/typeGuards.js +14 -0
- package/lib/util/typeGuards.js.map +1 -0
- package/package.json +9 -9
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { OKXEnvironment, RestClientOptions } from './util/requestUtils';
|
|
3
|
+
import BaseRestClient, { APICredentials } from './util/BaseRestClient';
|
|
4
|
+
import { ContractGridDirection, GridAlgoOrderType, GridAlgoSubOrderType, InstrumentType, MarginMode, numberInString, Ticker, AlgoOrderRequest, AmendOrderRequest, CancelAlgoOrderRequest, OrderIdRequest, ClosePositionRequest, OrderRequest, OrderHistoryRequest, FillsHistoryRequest, AlgoRecentHistoryRequest, AlgoLongHistoryRequest, PaginatedSymbolRequest, OrderResult, CancelledOrderResult, AmendedOrder, ClosedPositions, OrderDetails, OrderListItem, HistoricOrder, OrderFill, AlgoOrderResult, AlgoOrderListItem, HistoricAlgoOrder, BlockCounterParty, CreateBlockRFQRequest, CreateRFQResult, CancelBlockRFQRequest, CancelBlockQuoteResult, CancelMultipleBlockRFQRequest, TimestampObject, ExecuteBlockQuoteResult, ExecuteBlockQuoteRequest, CreateBlockQuoteRequest, CreateBlockQuoteResult, CancelBlockRFQResult, CancelBlockQuoteRequest, CancelMultipleBlockQuoteRequest, BlockRFQResult, GetBlockRFQSParams, GetBlockQuoteParams, GetBlockQuoteResult, FundingCurrency, FundingBalance, AccountAssetValuation, FundTransferResult, FundTransferState, AssetBillDetails, AccountBalance, GetPositionsParams, AccountPosition, GetHistoricPositionParams, HistoricAccountPosition, AccountPositionRisk, AccountBill, AccountConfiguration, AccountPositionModeResult, AccountLeverageResult, AccountMaxOrderAmount, AccountMaxTradableAmount, AccountChangeMarginResult, AccountLeverage, AccountMaxLoan, AccountFeeRate, AccountIsolatedMode, SubAccount, SubAccountAPIReset, SubAccountBalances, SubAccountTransferResult, IndexTicker, OrderBook, Candle, CandleNoVolume, Trade, Pagination, APIResponse, GetGridAlgoOrdersRequest, FundsTransferRequest, WithdrawRequest, ConvertTradeRequest, ConvertQuoteEstimateRequest, SetLeverageRequest, ChangePositionMarginRequest, SubAccountTransferRequest, GridAlgoOrderRequest, StopGridAlgoOrderRequest } from './types/rest';
|
|
5
|
+
import { ASSET_BILL_TYPE } from './constants';
|
|
6
|
+
export declare class RestClient extends BaseRestClient {
|
|
7
|
+
/**
|
|
8
|
+
* @public Creates an instance of the REST API client.
|
|
9
|
+
*/
|
|
10
|
+
constructor(credentials?: APICredentials | null, environment?: OKXEnvironment, restClientOptions?: RestClientOptions, requestOptions?: AxiosRequestConfig);
|
|
11
|
+
getServerTime(): Promise<number>;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* Trade endpoints (private)
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
submitOrder(params: OrderRequest): Promise<OrderResult[]>;
|
|
18
|
+
submitMultipleOrders(params: OrderRequest[]): Promise<OrderResult[]>;
|
|
19
|
+
cancelOrder(params: OrderIdRequest): Promise<CancelledOrderResult[]>;
|
|
20
|
+
cancelMultipleOrders(params: OrderIdRequest[]): Promise<CancelledOrderResult[]>;
|
|
21
|
+
amendOrder(params: AmendOrderRequest): Promise<AmendedOrder[]>;
|
|
22
|
+
amendMultipleOrders(params: AmendOrderRequest[]): Promise<AmendedOrder[]>;
|
|
23
|
+
closePositions(params: ClosePositionRequest): Promise<ClosedPositions[]>;
|
|
24
|
+
getOrderDetails(params: OrderIdRequest): Promise<OrderDetails[]>;
|
|
25
|
+
getOrderList(params?: OrderHistoryRequest): Promise<OrderListItem[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Get history for last 7 days
|
|
28
|
+
*/
|
|
29
|
+
getOrderHistory(params: OrderHistoryRequest): Promise<HistoricOrder[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Get history for last 3 months
|
|
32
|
+
*/
|
|
33
|
+
getOrderHistoryArchive(params: OrderHistoryRequest): Promise<HistoricOrder[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Get history for last 7 days
|
|
36
|
+
*/
|
|
37
|
+
getFills(params?: FillsHistoryRequest): Promise<OrderFill[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Get history for last 3 months
|
|
40
|
+
*/
|
|
41
|
+
getFillsHistory(params: FillsHistoryRequest): Promise<OrderFill[]>;
|
|
42
|
+
placeAlgoOrder(params: AlgoOrderRequest): Promise<AlgoOrderResult[]>;
|
|
43
|
+
cancelAlgoOrder(params: CancelAlgoOrderRequest[]): Promise<AlgoOrderResult[]>;
|
|
44
|
+
cancelAdvanceAlgoOrder(params: CancelAlgoOrderRequest[]): Promise<AlgoOrderResult[]>;
|
|
45
|
+
getAlgoOrderList(params: AlgoRecentHistoryRequest): Promise<AlgoOrderListItem[]>;
|
|
46
|
+
getAlgoOrderHistory(params: AlgoLongHistoryRequest): Promise<HistoricAlgoOrder[]>;
|
|
47
|
+
/** Get easy convert currency list */
|
|
48
|
+
getEasyConvertCurrencies(): Promise<any>;
|
|
49
|
+
/**
|
|
50
|
+
* Place easy convert : Convert small currencies to mainstream currencies.
|
|
51
|
+
* Only applicable to the crypto balance less than $10.
|
|
52
|
+
*
|
|
53
|
+
* Maximum 5 currencies can be selected in one order.
|
|
54
|
+
* If there are multiple currencies, separate them with commas in the "from" field.
|
|
55
|
+
*/
|
|
56
|
+
submitEasyConvert(fromCcys: string[], toCcy: string): Promise<APIResponse<any>>;
|
|
57
|
+
/** Get easy convert history : Get the history and status of easy convert trades. */
|
|
58
|
+
getEasyConvertHistory(params?: Pagination): Promise<APIResponse<any>>;
|
|
59
|
+
/**
|
|
60
|
+
* Get one-click repay currency list : Get list of debt currency data and repay currencies.
|
|
61
|
+
* Debt currencies include both cross and isolated debts.
|
|
62
|
+
*/
|
|
63
|
+
getOneClickRepayCurrencyList(debtType?: 'cross' | 'isolated'): Promise<APIResponse<any>>;
|
|
64
|
+
/**
|
|
65
|
+
* Trade one-click repay to repay cross debts.
|
|
66
|
+
* Isolated debts are not applicable.
|
|
67
|
+
* The maximum repayment amount is based on the remaining available balance of funding and trading accounts.
|
|
68
|
+
*/
|
|
69
|
+
submitOneClickRepay(debtCcys: string[], repayCcy: string): Promise<APIResponse<any>>;
|
|
70
|
+
/** Get the history and status of one-click repay trades. */
|
|
71
|
+
getOneClickRepayHistory(params?: Pagination): Promise<APIResponse<any>>;
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
* Block trading endpoints (private)
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
getBlockCounterParties(): Promise<BlockCounterParty[]>;
|
|
78
|
+
createBlockRFQ(params: CreateBlockRFQRequest): Promise<CreateRFQResult[]>;
|
|
79
|
+
cancelBlockRFQ(params: CancelBlockRFQRequest): Promise<CancelBlockRFQResult[]>;
|
|
80
|
+
cancelMultipleBlockRFQs(params: CancelMultipleBlockRFQRequest): Promise<CancelBlockRFQResult[]>;
|
|
81
|
+
cancelAllRFQs(): Promise<TimestampObject[]>;
|
|
82
|
+
executeBlockQuote(params: ExecuteBlockQuoteRequest): Promise<ExecuteBlockQuoteResult[]>;
|
|
83
|
+
createBlockQuote(params: CreateBlockQuoteRequest): Promise<CreateBlockQuoteResult[]>;
|
|
84
|
+
cancelBlockQuote(params: CancelBlockQuoteRequest): Promise<CancelBlockQuoteResult[]>;
|
|
85
|
+
cancelMultipleBlockQuotes(params: CancelMultipleBlockQuoteRequest): Promise<CancelBlockQuoteResult[]>;
|
|
86
|
+
cancelAllBlockQuotes(): Promise<TimestampObject[]>;
|
|
87
|
+
getBlockRFQs(params?: GetBlockRFQSParams): Promise<BlockRFQResult[]>;
|
|
88
|
+
getBlockQuotes(params?: GetBlockQuoteParams): Promise<GetBlockQuoteResult[]>;
|
|
89
|
+
getBlockTrades(params?: unknown): Promise<unknown[]>;
|
|
90
|
+
getPublicRFQBlockTrades(params?: unknown): Promise<unknown[]>;
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
* Funding endpoints (private)
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
96
|
+
getCurrencies(ccy?: string): Promise<FundingCurrency[]>;
|
|
97
|
+
getBalances(ccy?: string): Promise<FundingBalance[]>;
|
|
98
|
+
getAccountAssetValuation(ccy?: string): Promise<AccountAssetValuation[]>;
|
|
99
|
+
fundsTransfer(params: FundsTransferRequest): Promise<FundTransferResult[]>;
|
|
100
|
+
/** Either parameter transId or clientId is required. */
|
|
101
|
+
getFundsTransferState(params: {
|
|
102
|
+
transId?: string;
|
|
103
|
+
clientId?: string;
|
|
104
|
+
type?: '0' | '1' | '2';
|
|
105
|
+
}): Promise<FundTransferState[]>;
|
|
106
|
+
getAssetBillsDetails(params?: {
|
|
107
|
+
ccy?: string;
|
|
108
|
+
type?: `${ASSET_BILL_TYPE}`;
|
|
109
|
+
clientId?: string;
|
|
110
|
+
after?: numberInString;
|
|
111
|
+
before?: numberInString;
|
|
112
|
+
limit?: numberInString;
|
|
113
|
+
}): Promise<AssetBillDetails[]>;
|
|
114
|
+
getLightningDeposits(ccy: string, amt: numberInString, to?: '6' | '18'): Promise<unknown[]>;
|
|
115
|
+
getDepositAddress(ccy: string): Promise<unknown[]>;
|
|
116
|
+
getDepositHistory(params?: unknown): Promise<unknown[]>;
|
|
117
|
+
submitWithdraw(params: WithdrawRequest): Promise<unknown[]>;
|
|
118
|
+
submitWithdrawLightning(ccy: string, invoice: string, memo?: string): Promise<unknown[]>;
|
|
119
|
+
cancelWithdrawal(wdId: string): Promise<unknown[]>;
|
|
120
|
+
getWithdrawalHistory(params?: unknown): Promise<unknown[]>;
|
|
121
|
+
smallAssetsConvert(ccy: string[]): Promise<unknown[]>;
|
|
122
|
+
getSavingBalance(ccy?: string): Promise<unknown[]>;
|
|
123
|
+
savingsPurchaseRedemption(ccy: string, amt: numberInString, side: 'purchase' | 'redempt', rate: numberInString): Promise<unknown[]>;
|
|
124
|
+
setLendingRate(ccy: string, rate: numberInString): Promise<unknown[]>;
|
|
125
|
+
getLendingHistory(params?: PaginatedSymbolRequest): Promise<unknown[]>;
|
|
126
|
+
getPublicBorrowInfo(ccy?: string): Promise<unknown[]>;
|
|
127
|
+
getPublicBorrowHistory(params?: PaginatedSymbolRequest): Promise<unknown[]>;
|
|
128
|
+
/**
|
|
129
|
+
*
|
|
130
|
+
* Convert endpoints (private)
|
|
131
|
+
*
|
|
132
|
+
*/
|
|
133
|
+
getConvertCurrencies(): Promise<unknown[]>;
|
|
134
|
+
getConvertCurrencyPair(fromCcy: string, toCcy: string): Promise<unknown[]>;
|
|
135
|
+
estimateConvertQuote(params: ConvertQuoteEstimateRequest): Promise<unknown[]>;
|
|
136
|
+
convertTrade(params: ConvertTradeRequest): Promise<unknown[]>;
|
|
137
|
+
getConvertHistory(params?: unknown): Promise<unknown[]>;
|
|
138
|
+
/**
|
|
139
|
+
*
|
|
140
|
+
* Account endpoints (private)
|
|
141
|
+
*
|
|
142
|
+
*/
|
|
143
|
+
getBalance(ccy?: string): Promise<AccountBalance[]>;
|
|
144
|
+
getPositions(params?: GetPositionsParams): Promise<AccountPosition[]>;
|
|
145
|
+
getPositionsHistory(params?: GetHistoricPositionParams): Promise<HistoricAccountPosition[]>;
|
|
146
|
+
getAccountPositionRisk(instType?: Omit<'SPOT', InstrumentType>): Promise<AccountPositionRisk[]>;
|
|
147
|
+
/** Up to last 7 days */
|
|
148
|
+
getBills(params?: unknown): Promise<AccountBill[]>;
|
|
149
|
+
/** Last 3 months */
|
|
150
|
+
getBillsArchive(params?: unknown): Promise<AccountBill[]>;
|
|
151
|
+
getAccountConfiguration(): Promise<AccountConfiguration[]>;
|
|
152
|
+
setPositionMode(posMode: 'long_short_mode' | 'net'): Promise<AccountPositionModeResult[]>;
|
|
153
|
+
setLeverage(params: SetLeverageRequest): Promise<AccountLeverageResult[]>;
|
|
154
|
+
/** Max buy/sell amount or open amount */
|
|
155
|
+
getMaxBuySellAmount(params: {
|
|
156
|
+
instId: string;
|
|
157
|
+
tdMode: 'cross' | 'isolated' | 'cash';
|
|
158
|
+
ccy?: string;
|
|
159
|
+
px?: string;
|
|
160
|
+
leverage?: string;
|
|
161
|
+
unSpotOffset?: boolean;
|
|
162
|
+
}): Promise<AccountMaxOrderAmount[]>;
|
|
163
|
+
getMaxAvailableTradableAmount(params: {
|
|
164
|
+
instId: string;
|
|
165
|
+
ccy?: string;
|
|
166
|
+
tdMode: 'cross' | 'isolated' | 'cash';
|
|
167
|
+
reduceOnly?: boolean;
|
|
168
|
+
unSpotOffset?: boolean;
|
|
169
|
+
}): Promise<AccountMaxTradableAmount[]>;
|
|
170
|
+
changePositionMargin(params: ChangePositionMarginRequest): Promise<AccountChangeMarginResult[]>;
|
|
171
|
+
getLeverage(instId: string, mgnMode: MarginMode): Promise<AccountLeverage[]>;
|
|
172
|
+
getMaxLoan(instId: string, mgnMode: MarginMode, mgnCcy?: string): Promise<AccountMaxLoan[]>;
|
|
173
|
+
getFeeRates(instType: InstrumentType, instId?: string, uly?: string): Promise<AccountFeeRate[]>;
|
|
174
|
+
getInterestAccrued(params?: unknown): Promise<unknown[]>;
|
|
175
|
+
getInterestRate(ccy?: string): Promise<unknown[]>;
|
|
176
|
+
setGreeksDisplayType(greeksType: 'PA' | 'BS'): Promise<unknown[]>;
|
|
177
|
+
setIsolatedMode(isoMode: 'automatic' | 'autonomy', type: 'MARGIN' | 'CONTRACTS'): Promise<AccountIsolatedMode[]>;
|
|
178
|
+
getMaxWithdrawals(ccy?: string): Promise<unknown[]>;
|
|
179
|
+
getAccountRiskState(): Promise<unknown[]>;
|
|
180
|
+
borrowRepayVIPLoan(ccy: string, side: 'borrow' | 'repay', amt: numberInString): Promise<unknown[]>;
|
|
181
|
+
getVIPLoanBorrowRepayHistory(params?: unknown): Promise<unknown[]>;
|
|
182
|
+
getBorrowInterestLimits(params?: {
|
|
183
|
+
type?: '1' | '2';
|
|
184
|
+
ccy?: string;
|
|
185
|
+
}): Promise<unknown[]>;
|
|
186
|
+
positionBuilder(params?: unknown): Promise<unknown[]>;
|
|
187
|
+
getGreeks(ccy?: string): Promise<unknown[]>;
|
|
188
|
+
getPMLimitation(params: {
|
|
189
|
+
instType: 'SWAP' | 'FUTURES' | 'OPTION';
|
|
190
|
+
uly?: string;
|
|
191
|
+
instFamily?: string;
|
|
192
|
+
}): Promise<unknown[]>;
|
|
193
|
+
/**
|
|
194
|
+
*
|
|
195
|
+
* SubAccount endpoints (private)
|
|
196
|
+
*
|
|
197
|
+
*/
|
|
198
|
+
/** View sub-account list */
|
|
199
|
+
getSubAccountList(params?: unknown): Promise<SubAccount[]>;
|
|
200
|
+
/** Reset the APIKey of a sub-account */
|
|
201
|
+
resetSubAccountAPIKey(subAcct: string, apiKey: string, options?: {
|
|
202
|
+
label?: string;
|
|
203
|
+
perm?: string;
|
|
204
|
+
ip?: string;
|
|
205
|
+
}): Promise<SubAccountAPIReset[]>;
|
|
206
|
+
/** Get sub-account trading balance */
|
|
207
|
+
getSubAccountBalances(subAcct: string): Promise<SubAccountBalances[]>;
|
|
208
|
+
/** Get sub-account funding balance */
|
|
209
|
+
getSubAccountFundingBalances(subAcct: string, ccy?: string): Promise<FundingBalance[]>;
|
|
210
|
+
/** History of sub-account transfer */
|
|
211
|
+
getSubAccountTransferHistory(params?: {
|
|
212
|
+
ccy?: string;
|
|
213
|
+
type?: '0' | '1';
|
|
214
|
+
subAcct?: string;
|
|
215
|
+
after?: string;
|
|
216
|
+
before?: string;
|
|
217
|
+
limit?: string;
|
|
218
|
+
}): Promise<unknown[]>;
|
|
219
|
+
/** Master accounts manage the transfers between sub-accounts */
|
|
220
|
+
transferSubAccountBalance(params: SubAccountTransferRequest): Promise<SubAccountTransferResult[]>;
|
|
221
|
+
/** Set Permission Of Transfer Out */
|
|
222
|
+
setSubAccountTransferOutPermission(subAcct: string, canTransOut?: boolean): Promise<unknown[]>;
|
|
223
|
+
/** Get custody trading sub-account list */
|
|
224
|
+
getSubAccountCustodyTradingList(subAcct?: string): Promise<unknown[]>;
|
|
225
|
+
/**
|
|
226
|
+
*
|
|
227
|
+
* Grid trading endpoints (private)
|
|
228
|
+
*
|
|
229
|
+
*/
|
|
230
|
+
placeGridAlgoOrder(params: GridAlgoOrderRequest): Promise<unknown[]>;
|
|
231
|
+
amendGridAlgoOrder(algoId: string, instId: string, triggerPx: {
|
|
232
|
+
slTriggerPx?: numberInString;
|
|
233
|
+
tpTriggerPx?: numberInString;
|
|
234
|
+
}): Promise<unknown[]>;
|
|
235
|
+
stopGridAlgoOrder(orders: StopGridAlgoOrderRequest[]): Promise<unknown[]>;
|
|
236
|
+
getGridAlgoOrderList(params: GetGridAlgoOrdersRequest): Promise<unknown[]>;
|
|
237
|
+
getGridAlgoOrderHistory(params: GetGridAlgoOrdersRequest): Promise<unknown[]>;
|
|
238
|
+
getGridAlgoOrderDetails(algoOrdType: GridAlgoOrderType, algoId: string): Promise<unknown[]>;
|
|
239
|
+
getGridAlgoSubOrders(algoOrdType: GridAlgoOrderType, algoId: string, type: GridAlgoSubOrderType, groupId?: string, pagination?: {
|
|
240
|
+
after?: numberInString;
|
|
241
|
+
before?: numberInString;
|
|
242
|
+
limit?: number;
|
|
243
|
+
}): Promise<unknown[]>;
|
|
244
|
+
/** Only contract grid supports this method */
|
|
245
|
+
getGridAlgoOrderPositions(algoOrdType: 'contract_grid', algoId: string): Promise<unknown[]>;
|
|
246
|
+
spotGridWithdrawIncome(algoId: string): Promise<unknown[]>;
|
|
247
|
+
computeGridMarginBalance(algoId: string, type: 'add' | 'reduce', amt?: numberInString): Promise<unknown[]>;
|
|
248
|
+
adjustGridMarginBalance(algoId: string, type: 'add' | 'reduce', change: {
|
|
249
|
+
amt?: numberInString;
|
|
250
|
+
percent?: numberInString;
|
|
251
|
+
}): Promise<unknown[]>;
|
|
252
|
+
getGridAIParameter(algoOrdType: GridAlgoOrderType, instId: string, direction: ContractGridDirection, duration?: '7D' | '30D' | '180D'): Promise<unknown[]>;
|
|
253
|
+
/**
|
|
254
|
+
*
|
|
255
|
+
* Earn/staking endpoints (private)
|
|
256
|
+
*
|
|
257
|
+
*/
|
|
258
|
+
/** Get earn offers */
|
|
259
|
+
getStakingOffers(params?: {
|
|
260
|
+
productId?: string;
|
|
261
|
+
protocolType?: 'staking' | 'defi';
|
|
262
|
+
ccy?: string;
|
|
263
|
+
}): Promise<APIResponse<any>>;
|
|
264
|
+
/** Earn/staking purchase */
|
|
265
|
+
submitStake(productId: string, investData: {
|
|
266
|
+
ccy: string;
|
|
267
|
+
amt: string;
|
|
268
|
+
}[], term?: string): Promise<APIResponse<any>>;
|
|
269
|
+
/** Earn/staking redeem */
|
|
270
|
+
redeemStake(ordId: string, protocolType: 'staking' | 'defi', allowEarlyRedeem?: boolean): Promise<APIResponse<any>>;
|
|
271
|
+
/** Earn/staking cancel purchases/redemptions */
|
|
272
|
+
cancelStakingRequest(ordId: string, protocolType: 'staking' | 'defi'): Promise<APIResponse<any>>;
|
|
273
|
+
/** Earn/staking get active orders */
|
|
274
|
+
getActiveStakingOrders(params?: {
|
|
275
|
+
productId?: string;
|
|
276
|
+
protocolType?: 'staking' | 'defi';
|
|
277
|
+
ccy?: string;
|
|
278
|
+
state?: '8' | '13' | '9' | '1' | '2';
|
|
279
|
+
}): Promise<APIResponse<any>>;
|
|
280
|
+
/** Earn/staking get order history */
|
|
281
|
+
getStakingOrderHistory(params?: {
|
|
282
|
+
productId?: string;
|
|
283
|
+
protocolType?: string;
|
|
284
|
+
ccy?: string;
|
|
285
|
+
after?: string;
|
|
286
|
+
before?: string;
|
|
287
|
+
limit?: string;
|
|
288
|
+
}): Promise<APIResponse<any>>;
|
|
289
|
+
/**
|
|
290
|
+
*
|
|
291
|
+
* Market data endpoints (public)
|
|
292
|
+
*
|
|
293
|
+
*/
|
|
294
|
+
getTickers(instrumentType: InstrumentType, uly?: string): Promise<Ticker[]>;
|
|
295
|
+
getTicker(instId: string): Promise<Ticker[]>;
|
|
296
|
+
getIndexTickers(params: {
|
|
297
|
+
quoteCcy?: string;
|
|
298
|
+
instId?: string;
|
|
299
|
+
}): Promise<IndexTicker[]>;
|
|
300
|
+
getOrderBook(instId: string, sz?: numberInString): Promise<OrderBook[]>;
|
|
301
|
+
getCandles(instId: string, bar?: string, pagination?: Pagination): Promise<Candle[]>;
|
|
302
|
+
getHistoricCandles(instId: string, bar?: string, pagination?: Pagination): Promise<Candle[]>;
|
|
303
|
+
getIndexCandles(instId: string, bar?: string, pagination?: Pagination): Promise<CandleNoVolume[]>;
|
|
304
|
+
getHistoricIndexCandles(instId: string, bar?: string, pagination?: Pagination): Promise<CandleNoVolume[]>;
|
|
305
|
+
getMarkPriceCandles(instId: string, bar?: string, pagination?: Pagination): Promise<CandleNoVolume[]>;
|
|
306
|
+
getHistoricMarkPriceCandles(instId: string, bar?: string, pagination?: Pagination): Promise<CandleNoVolume[]>;
|
|
307
|
+
getTrades(instId: string, limit?: number): Promise<Trade[]>;
|
|
308
|
+
getHistoricTrades(instId: string, pagination?: {
|
|
309
|
+
after?: numberInString;
|
|
310
|
+
before?: numberInString;
|
|
311
|
+
limit?: numberInString;
|
|
312
|
+
type?: '1' | '2';
|
|
313
|
+
}): Promise<Trade[]>;
|
|
314
|
+
get24hrTotalVolume(): Promise<unknown[]>;
|
|
315
|
+
getOracle(): Promise<unknown[]>;
|
|
316
|
+
getExchangeRate(): Promise<unknown[]>;
|
|
317
|
+
getIndexComponents(index: string): Promise<unknown[]>;
|
|
318
|
+
getBlockTickers(instType: InstrumentType, uly?: string): Promise<unknown[]>;
|
|
319
|
+
getBlockTicker(instId: string): Promise<unknown[]>;
|
|
320
|
+
getPublicBlockTrades(instId: string): Promise<unknown[]>;
|
|
321
|
+
/**
|
|
322
|
+
*
|
|
323
|
+
* Public data endpoints (public)
|
|
324
|
+
*
|
|
325
|
+
*/
|
|
326
|
+
getInstruments(params: unknown): Promise<unknown[]>;
|
|
327
|
+
getDeliveryExerciseHistory(params: unknown): Promise<unknown[]>;
|
|
328
|
+
getOpenInterest(params: unknown): Promise<unknown[]>;
|
|
329
|
+
getFundingRate(params: unknown): Promise<unknown[]>;
|
|
330
|
+
getFundingRateHistory(params: unknown): Promise<unknown[]>;
|
|
331
|
+
getMinMaxLimitPrice(params: unknown): Promise<unknown[]>;
|
|
332
|
+
getOptionMarketData(params: unknown): Promise<unknown[]>;
|
|
333
|
+
getEstimatedDeliveryExercisePrice(params: unknown): Promise<unknown[]>;
|
|
334
|
+
getDiscountRateAndInterestFreeQuota(params: unknown): Promise<unknown[]>;
|
|
335
|
+
getSystemTime(params: unknown): Promise<unknown[]>;
|
|
336
|
+
getLiquidationOrders(params: unknown): Promise<unknown[]>;
|
|
337
|
+
getMarkPrice(params: unknown): Promise<unknown[]>;
|
|
338
|
+
getPositionTiers(params: unknown): Promise<unknown[]>;
|
|
339
|
+
getInterestRateAndLoanQuota(params: unknown): Promise<unknown[]>;
|
|
340
|
+
getVIPInterestRateAndLoanQuota(params: unknown): Promise<unknown[]>;
|
|
341
|
+
getUnderlying(params: unknown): Promise<unknown[]>;
|
|
342
|
+
getInsuranceFund(params: unknown): Promise<unknown[]>;
|
|
343
|
+
getUnitConvert(params: unknown): Promise<unknown[]>;
|
|
344
|
+
/**
|
|
345
|
+
*
|
|
346
|
+
* Trading data endpoints (public)
|
|
347
|
+
*
|
|
348
|
+
*/
|
|
349
|
+
getSupportCoin(): Promise<unknown[]>;
|
|
350
|
+
getTakerVolume(): Promise<unknown[]>;
|
|
351
|
+
getMarginLendingRatio(params: {
|
|
352
|
+
ccy: string;
|
|
353
|
+
begin?: numberInString;
|
|
354
|
+
end?: numberInString;
|
|
355
|
+
period: '5m' | '1H' | '1D';
|
|
356
|
+
}): Promise<unknown[]>;
|
|
357
|
+
getLongShortRatio(params: {
|
|
358
|
+
ccy: string;
|
|
359
|
+
begin?: numberInString;
|
|
360
|
+
end?: numberInString;
|
|
361
|
+
period: '5m' | '1H' | '1D';
|
|
362
|
+
}): Promise<unknown[]>;
|
|
363
|
+
getContractsOpenInterestAndVolume(params: {
|
|
364
|
+
ccy: string;
|
|
365
|
+
begin?: numberInString;
|
|
366
|
+
end?: numberInString;
|
|
367
|
+
period: '5m' | '1H' | '1D';
|
|
368
|
+
}): Promise<unknown[]>;
|
|
369
|
+
getOptionsOpenInterestAndVolume(params: {
|
|
370
|
+
ccy: string;
|
|
371
|
+
period: '8H' | '1D';
|
|
372
|
+
}): Promise<unknown[]>;
|
|
373
|
+
getPutCallRatio(params: {
|
|
374
|
+
ccy: string;
|
|
375
|
+
period: '8H' | '1D';
|
|
376
|
+
}): Promise<unknown[]>;
|
|
377
|
+
getOpenInterestAndVolumeExpiry(params: {
|
|
378
|
+
ccy: string;
|
|
379
|
+
period: '8H' | '1D';
|
|
380
|
+
}): Promise<unknown[]>;
|
|
381
|
+
getOpenInterestAndVolumeStrike(params: {
|
|
382
|
+
ccy: string;
|
|
383
|
+
expTime: string;
|
|
384
|
+
period: '8H' | '1D';
|
|
385
|
+
}): Promise<unknown[]>;
|
|
386
|
+
getTakerFlow(params: {
|
|
387
|
+
ccy: string;
|
|
388
|
+
period: '8H' | '1D';
|
|
389
|
+
}): Promise<unknown[]>;
|
|
390
|
+
/**
|
|
391
|
+
*
|
|
392
|
+
* Status endpoints (public)
|
|
393
|
+
*
|
|
394
|
+
*/
|
|
395
|
+
getSystemStatus(state?: 'scheduled' | 'ongoing' | 'pre_open' | 'completed' | 'canceled'): Promise<unknown[]>;
|
|
396
|
+
/**
|
|
397
|
+
*
|
|
398
|
+
* Broker endpoints (private)
|
|
399
|
+
*
|
|
400
|
+
*/
|
|
401
|
+
getBrokerAccountInformation(): Promise<unknown[]>;
|
|
402
|
+
}
|