binance 3.0.0-beta.1 → 3.0.0-beta.10
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 +305 -75
- package/index.js +1 -1
- package/lib/coinm-client.d.ts +40 -22
- package/lib/coinm-client.js +4 -16
- package/lib/coinm-client.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/main-client.d.ts +94 -30
- package/lib/main-client.js +68 -36
- package/lib/main-client.js.map +1 -1
- package/lib/portfolio-client.js.map +1 -1
- package/lib/types/coin.d.ts +1 -0
- package/lib/types/futures.d.ts +15 -5
- package/lib/types/futures.js.map +1 -1
- package/lib/types/portfolio-margin.d.ts +0 -9
- package/lib/types/shared.d.ts +14 -13
- package/lib/types/spot.d.ts +174 -11
- package/lib/types/spot.js.map +1 -1
- package/lib/types/websockets/ws-api-requests.d.ts +480 -2
- package/lib/types/websockets/ws-api-responses.d.ts +565 -1
- package/lib/types/websockets/ws-api.d.ts +157 -60
- package/lib/types/websockets/ws-api.js +47 -3
- package/lib/types/websockets/ws-api.js.map +1 -1
- package/lib/types/websockets/ws-events-formatted.d.ts +18 -14
- package/lib/types/websockets/ws-events-raw.d.ts +4 -2
- package/lib/types/websockets/ws-general.d.ts +8 -18
- package/lib/usdm-client.d.ts +45 -27
- package/lib/usdm-client.js +7 -19
- package/lib/usdm-client.js.map +1 -1
- package/lib/util/BaseRestClient.js +20 -6
- package/lib/util/BaseRestClient.js.map +1 -1
- package/lib/util/BaseWSClient.d.ts +14 -3
- package/lib/util/BaseWSClient.js +87 -30
- package/lib/util/BaseWSClient.js.map +1 -1
- package/lib/util/beautifier-maps.d.ts +32 -0
- package/lib/util/beautifier-maps.js +41 -0
- package/lib/util/beautifier-maps.js.map +1 -1
- package/lib/util/beautifier.d.ts +1 -0
- package/lib/util/beautifier.js +44 -9
- package/lib/util/beautifier.js.map +1 -1
- package/lib/util/browser-support.d.ts +1 -1
- package/lib/util/browser-support.js +1 -41
- package/lib/util/browser-support.js.map +1 -1
- package/lib/util/node-support.js +7 -5
- package/lib/util/node-support.js.map +1 -1
- package/lib/util/requestUtils.d.ts +22 -4
- package/lib/util/requestUtils.js +76 -25
- package/lib/util/requestUtils.js.map +1 -1
- package/lib/util/rounding.d.ts +8 -0
- package/lib/util/rounding.js +41 -0
- package/lib/util/rounding.js.map +1 -0
- package/lib/util/typeGuards.d.ts +31 -3
- package/lib/util/typeGuards.js +105 -8
- package/lib/util/typeGuards.js.map +1 -1
- package/lib/util/webCryptoAPI.js +20 -45
- package/lib/util/webCryptoAPI.js.map +1 -1
- package/lib/util/websockets/WsStore.js +7 -2
- package/lib/util/websockets/WsStore.js.map +1 -1
- package/lib/util/websockets/enum.d.ts +11 -0
- package/lib/util/websockets/enum.js +24 -0
- package/lib/util/websockets/enum.js.map +1 -0
- package/lib/util/websockets/rest-client-cache.d.ts +3 -3
- package/lib/util/websockets/rest-client-cache.js +9 -9
- package/lib/util/websockets/rest-client-cache.js.map +1 -1
- package/lib/util/websockets/user-data-stream-manager.js +7 -8
- package/lib/util/websockets/user-data-stream-manager.js.map +1 -1
- package/lib/util/websockets/websocket-util.d.ts +27 -6
- package/lib/util/websockets/websocket-util.js +147 -52
- package/lib/util/websockets/websocket-util.js.map +1 -1
- package/lib/websocket-api-client.d.ts +401 -0
- package/lib/websocket-api-client.js +647 -0
- package/lib/websocket-api-client.js.map +1 -0
- package/lib/websocket-client-legacy.d.ts +5 -3
- package/lib/websocket-client-legacy.js +11 -10
- package/lib/websocket-client-legacy.js.map +1 -1
- package/lib/websocket-client.d.ts +26 -11
- package/lib/websocket-client.js +185 -139
- package/lib/websocket-client.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { ExchangeInfo, OrderResponse, SpotAmendKeepPriorityResult } from './types/spot';
|
|
2
|
+
import { WSAPIResponse, WSAPIUserDataListenKeyRequest } from './types/websockets/ws-api';
|
|
3
|
+
import { WSAPIAccountCommissionWSAPIRequest, WSAPIAccountInformationRequest, WSAPIAllOrderListsRequest, WSAPIAllOrdersRequest, WSAPIAvgPriceRequest, WSAPIExchangeInfoRequest, WSAPIFuturesOrderBookRequest, WSAPIFuturesOrderCancelRequest, WSAPIFuturesOrderModifyRequest, WSAPIFuturesOrderStatusRequest, WSAPIFuturesPositionRequest, WSAPIFuturesPositionV2Request, WSAPIFuturesTickerBookRequest, WSAPIFuturesTickerPriceRequest, WSAPIKlinesRequest, WSAPIMyAllocationsRequest, WSAPIMyPreventedMatchesRequest, WSAPIMyTradesRequest, WSAPINewFuturesOrderRequest, WSAPINewSpotOrderRequest, WSAPIOpenOrdersCancelAllRequest, WSAPIOpenOrdersStatusRequest, WSAPIOrderAmendKeepPriorityRequest, WSAPIOrderBookRequest, WSAPIOrderCancelReplaceRequest, WSAPIOrderCancelRequest, WSAPIOrderListCancelRequest, WSAPIOrderListPlaceOCORequest, WSAPIOrderListPlaceOTOCORequest, WSAPIOrderListPlaceOTORequest, WSAPIOrderListPlaceRequest, WSAPIOrderListStatusRequest, WSAPIOrderStatusRequest, WSAPIOrderTestRequest, WSAPIRecvWindowTimestamp, WSAPISOROrderPlaceRequest, WSAPISOROrderTestRequest, WSAPITicker24hrRequest, WSAPITickerBookRequest, WSAPITickerPriceRequest, WSAPITickerRequest, WSAPITickerTradingDayRequest, WSAPITradesAggregateRequest, WSAPITradesHistoricalRequest, WSAPITradesRecentRequest } from './types/websockets/ws-api-requests';
|
|
4
|
+
import { WSAPIAccountCommission, WSAPIAccountInformation, WSAPIAggregateTrade, WSAPIAllocation, WSAPIAvgPrice, WSAPIBookTicker, WSAPIFullTicker, WSAPIFuturesAccountBalanceItem, WSAPIFuturesAccountStatus, WSAPIFuturesBookTicker, WSAPIFuturesOrder, WSAPIFuturesOrderBook, WSAPIFuturesPosition, WSAPIFuturesPositionV2, WSAPIFuturesPriceTicker, WSAPIKline, WSAPIMiniTicker, WSAPIOrder, WSAPIOrderBook, WSAPIOrderCancel, WSAPIOrderCancelReplaceResponse, WSAPIOrderListCancelResponse, WSAPIOrderListPlaceResponse, WSAPIOrderListStatusResponse, WSAPIOrderTestResponse, WSAPIOrderTestWithCommission, WSAPIPreventedMatch, WSAPIPriceTicker, WSAPIRateLimit, WSAPIServerTime, WSAPISessionStatus, WSAPISOROrderPlaceResponse, WSAPISOROrderTestResponse, WSAPISOROrderTestResponseWithCommission, WSAPITrade } from './types/websockets/ws-api-responses';
|
|
5
|
+
import { WSClientConfigurableOptions } from './types/websockets/ws-general';
|
|
6
|
+
import { DefaultLogger } from './util/logger';
|
|
7
|
+
import { WSAPIWsKey, WSAPIWsKeyMain } from './util/websockets/websocket-util';
|
|
8
|
+
import { WebsocketClient } from './websocket-client';
|
|
9
|
+
/**
|
|
10
|
+
* Configurable options specific to only the REST-like WebsocketAPIClient
|
|
11
|
+
*/
|
|
12
|
+
export interface WSAPIClientConfigurableOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Default: true
|
|
15
|
+
*
|
|
16
|
+
* If requestSubscribeUserDataStream() was used, automatically resubscribe if reconnected
|
|
17
|
+
*/
|
|
18
|
+
resubscribeUserDataStreamAfterReconnect: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Default: 2 seconds
|
|
21
|
+
*
|
|
22
|
+
* Delay automatic userdata resubscribe by x seconds.
|
|
23
|
+
*/
|
|
24
|
+
resubscribeUserDataStreamDelaySeconds: number;
|
|
25
|
+
/**
|
|
26
|
+
* Default: true
|
|
27
|
+
*
|
|
28
|
+
* Attach default event listeners, which will console log any high level
|
|
29
|
+
* events (opened/reconnecting/reconnected/etc).
|
|
30
|
+
*
|
|
31
|
+
* If you disable this, you should set your own event listeners
|
|
32
|
+
* on the embedded WS Client `wsApiClient.getWSClient().on(....)`.
|
|
33
|
+
*/
|
|
34
|
+
attachEventListeners: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* This is a minimal Websocket API wrapper around the WebsocketClient.
|
|
38
|
+
*
|
|
39
|
+
* Some methods support passing in a custom "wsKey". This is a reference to which WS connection should
|
|
40
|
+
* be used to transmit that message. This is only useful if you wish to use an alternative wss
|
|
41
|
+
* domain that is supported by the SDK.
|
|
42
|
+
*
|
|
43
|
+
* Note: To use testnet, don't set the wsKey - use `testnet: true` in
|
|
44
|
+
* the constructor instead.
|
|
45
|
+
*
|
|
46
|
+
* Note: You can also directly use the sendWSAPIRequest() method to make WS API calls, but some
|
|
47
|
+
* may find the below methods slightly more intuitive.
|
|
48
|
+
*
|
|
49
|
+
* Refer to the WS API promises example for a more detailed example on using sendWSAPIRequest() directly:
|
|
50
|
+
* https://github.com/tiagosiebler/binance/blob/wsapi/examples/ws-api-promises.ts#L52-L61
|
|
51
|
+
*/
|
|
52
|
+
export declare class WebsocketAPIClient {
|
|
53
|
+
/**
|
|
54
|
+
* Minimal state store around automating sticky "userDataStream.subscribe" sessions
|
|
55
|
+
*/
|
|
56
|
+
private subscribedUserDataStreamState;
|
|
57
|
+
private wsClient;
|
|
58
|
+
private logger;
|
|
59
|
+
private options;
|
|
60
|
+
constructor(options?: WSClientConfigurableOptions & Partial<WSAPIClientConfigurableOptions>, logger?: DefaultLogger);
|
|
61
|
+
getWSClient(): WebsocketClient;
|
|
62
|
+
setTimeOffsetMs(newOffset: number): void;
|
|
63
|
+
/**
|
|
64
|
+
* Test connectivity to the WebSocket API
|
|
65
|
+
*/
|
|
66
|
+
testSpotConnectivity(wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<object>>;
|
|
67
|
+
/**
|
|
68
|
+
* Test connectivity to the WebSocket API and get the current server time
|
|
69
|
+
*/
|
|
70
|
+
getSpotServerTime(wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIServerTime>>;
|
|
71
|
+
/**
|
|
72
|
+
* Query current exchange trading rules, rate limits, and symbol information
|
|
73
|
+
*/
|
|
74
|
+
getSpotExchangeInfo(params?: WSAPIExchangeInfoRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<ExchangeInfo>>;
|
|
75
|
+
/**
|
|
76
|
+
* Get current order book
|
|
77
|
+
* Note: If you need to continuously monitor order book updates, consider using WebSocket Streams
|
|
78
|
+
*/
|
|
79
|
+
getSpotOrderBook(params: WSAPIOrderBookRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIOrderBook>>;
|
|
80
|
+
/**
|
|
81
|
+
* Get recent trades
|
|
82
|
+
* Note: If you need access to real-time trading activity, consider using WebSocket Streams
|
|
83
|
+
*/
|
|
84
|
+
getSpotRecentTrades(params: WSAPITradesRecentRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPITrade[]>>;
|
|
85
|
+
/**
|
|
86
|
+
* Get historical trades
|
|
87
|
+
* Note: If fromId is not specified, the most recent trades are returned
|
|
88
|
+
*/
|
|
89
|
+
getSpotHistoricalTrades(params: WSAPITradesHistoricalRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPITrade[]>>;
|
|
90
|
+
/**
|
|
91
|
+
* Get aggregate trades
|
|
92
|
+
* Note: An aggregate trade represents one or more individual trades that fill at the same time
|
|
93
|
+
*/
|
|
94
|
+
getSpotAggregateTrades(params: WSAPITradesAggregateRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIAggregateTrade[]>>;
|
|
95
|
+
/**
|
|
96
|
+
* Get klines (candlestick bars)
|
|
97
|
+
* Note: If you need access to real-time kline updates, consider using WebSocket Streams
|
|
98
|
+
*/
|
|
99
|
+
getSpotKlines(params: WSAPIKlinesRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIKline[]>>;
|
|
100
|
+
/**
|
|
101
|
+
* Get klines (candlestick bars) optimized for presentation
|
|
102
|
+
* Note: This request is similar to klines, having the same parameters and response
|
|
103
|
+
*/
|
|
104
|
+
getSpotUIKlines(params: WSAPIKlinesRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIKline[]>>;
|
|
105
|
+
/**
|
|
106
|
+
* Get current average price for a symbol
|
|
107
|
+
*/
|
|
108
|
+
getSpotAveragePrice(params: WSAPIAvgPriceRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIAvgPrice>>;
|
|
109
|
+
/**
|
|
110
|
+
* Get 24-hour rolling window price change statistics
|
|
111
|
+
* Note: If you need to continuously monitor trading statistics, consider using WebSocket Streams
|
|
112
|
+
*/
|
|
113
|
+
getSpot24hrTicker(params?: WSAPITicker24hrRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIFullTicker | WSAPIMiniTicker | WSAPIFullTicker[] | WSAPIMiniTicker[]>>;
|
|
114
|
+
/**
|
|
115
|
+
* Get price change statistics for a trading day
|
|
116
|
+
*/
|
|
117
|
+
getSpotTradingDayTicker(params: WSAPITickerTradingDayRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIFullTicker | WSAPIMiniTicker | WSAPIFullTicker[] | WSAPIMiniTicker[]>>;
|
|
118
|
+
/**
|
|
119
|
+
* Get rolling window price change statistics with a custom window
|
|
120
|
+
* Note: Window size precision is limited to 1 minute
|
|
121
|
+
*/
|
|
122
|
+
getSpotTicker(params: WSAPITickerRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIFullTicker | WSAPIMiniTicker | WSAPIFullTicker[] | WSAPIMiniTicker[]>>;
|
|
123
|
+
/**
|
|
124
|
+
* Get the latest market price for a symbol
|
|
125
|
+
* Note: If you need access to real-time price updates, consider using WebSocket Streams
|
|
126
|
+
*/
|
|
127
|
+
getSpotSymbolPriceTicker(params?: WSAPITickerPriceRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIPriceTicker | WSAPIPriceTicker[]>>;
|
|
128
|
+
/**
|
|
129
|
+
* Get the current best price and quantity on the order book
|
|
130
|
+
* Note: If you need access to real-time order book ticker updates, consider using WebSocket Streams
|
|
131
|
+
*/
|
|
132
|
+
getSpotSymbolOrderBookTicker(params?: WSAPITickerBookRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIBookTicker | WSAPIBookTicker[]>>;
|
|
133
|
+
getSpotSessionStatus(wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPISessionStatus>>;
|
|
134
|
+
/**
|
|
135
|
+
* Submit a spot order
|
|
136
|
+
*/
|
|
137
|
+
submitNewSpotOrder(params: WSAPINewSpotOrderRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<OrderResponse>>;
|
|
138
|
+
/**
|
|
139
|
+
* Test order placement
|
|
140
|
+
* Note: Validates new order parameters and verifies your signature but does not send the order into the matching engine
|
|
141
|
+
*/
|
|
142
|
+
testSpotOrder(params: WSAPIOrderTestRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIOrderTestResponse | WSAPIOrderTestWithCommission>>;
|
|
143
|
+
/**
|
|
144
|
+
* Check execution status of an order
|
|
145
|
+
* Note: If both orderId and origClientOrderId parameters are specified, only orderId is used
|
|
146
|
+
*/
|
|
147
|
+
getSpotOrderStatus(params: WSAPIOrderStatusRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIOrder>>;
|
|
148
|
+
/**
|
|
149
|
+
* Cancel an active order
|
|
150
|
+
* Note: If both orderId and origClientOrderId parameters are specified, only orderId is used
|
|
151
|
+
*/
|
|
152
|
+
cancelSpotOrder(params: WSAPIOrderCancelRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIOrderCancel>>;
|
|
153
|
+
/**
|
|
154
|
+
* Cancel an existing order and immediately place a new order
|
|
155
|
+
* Note: If both cancelOrderId and cancelOrigClientOrderId parameters are specified, only cancelOrderId is used
|
|
156
|
+
*/
|
|
157
|
+
cancelReplaceSpotOrder(params: WSAPIOrderCancelReplaceRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIOrderCancelReplaceResponse>>;
|
|
158
|
+
/**
|
|
159
|
+
* Reduce the quantity of an existing open order.
|
|
160
|
+
*
|
|
161
|
+
* Read for more info: https://developers.binance.com/docs/binance-spot-api-docs/faqs/order_amend_keep_priority
|
|
162
|
+
*/
|
|
163
|
+
amendSpotOrderKeepPriority(params: WSAPIOrderAmendKeepPriorityRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<SpotAmendKeepPriorityResult>>;
|
|
164
|
+
/**
|
|
165
|
+
* Query execution status of all open orders
|
|
166
|
+
* Note: If you need to continuously monitor order status updates, consider using WebSocket Streams
|
|
167
|
+
*/
|
|
168
|
+
getSpotOpenOrders(params: WSAPIOpenOrdersStatusRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIOrder[]>>;
|
|
169
|
+
/**
|
|
170
|
+
* Cancel all open orders on a symbol
|
|
171
|
+
* Note: This includes orders that are part of an order list
|
|
172
|
+
*/
|
|
173
|
+
cancelAllSpotOpenOrders(params: WSAPIOpenOrdersCancelAllRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<(WSAPIOrderCancel | WSAPIOrderListCancelResponse)[]>>;
|
|
174
|
+
/**
|
|
175
|
+
* Place a new order list
|
|
176
|
+
* Note: This is a deprecated endpoint, consider using placeOCOOrderList instead
|
|
177
|
+
*/
|
|
178
|
+
placeSpotOrderList(params: WSAPIOrderListPlaceRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIOrderListPlaceResponse>>;
|
|
179
|
+
/**
|
|
180
|
+
* Place a new OCO (One-Cancels-the-Other) order list
|
|
181
|
+
* Note: Activation of one order immediately cancels the other
|
|
182
|
+
*/
|
|
183
|
+
placeSpotOCOOrderList(params: WSAPIOrderListPlaceOCORequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIOrderListPlaceResponse>>;
|
|
184
|
+
/**
|
|
185
|
+
* Place a new OTO (One-Triggers-the-Other) order list
|
|
186
|
+
* Note: The pending order is placed only when the working order is fully filled
|
|
187
|
+
*/
|
|
188
|
+
placeSpotOTOOrderList(params: WSAPIOrderListPlaceOTORequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIOrderListPlaceResponse>>;
|
|
189
|
+
/**
|
|
190
|
+
* Place a new OTOCO (One-Triggers-One-Cancels-the-Other) order list
|
|
191
|
+
* Note: The pending orders are placed only when the working order is fully filled
|
|
192
|
+
*/
|
|
193
|
+
placeSpotOTOCOOrderList(params: WSAPIOrderListPlaceOTOCORequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIOrderListPlaceResponse>>;
|
|
194
|
+
/**
|
|
195
|
+
* Check execution status of an order list
|
|
196
|
+
* Note: If both origClientOrderId and orderListId parameters are specified, only origClientOrderId is used
|
|
197
|
+
*/
|
|
198
|
+
getSpotOrderListStatus(params: WSAPIOrderListStatusRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIOrderListStatusResponse>>;
|
|
199
|
+
/**
|
|
200
|
+
* Cancel an active order list
|
|
201
|
+
* Note: If both orderListId and listClientOrderId parameters are specified, only orderListId is used
|
|
202
|
+
*/
|
|
203
|
+
cancelSpotOrderList(params: WSAPIOrderListCancelRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIOrderListCancelResponse>>;
|
|
204
|
+
/**
|
|
205
|
+
* Query execution status of all open order lists
|
|
206
|
+
* Note: If you need to continuously monitor order status updates, consider using WebSocket Streams
|
|
207
|
+
*/
|
|
208
|
+
getSpotOpenOrderLists(params: WSAPIRecvWindowTimestamp, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIOrderListStatusResponse[]>>;
|
|
209
|
+
/**
|
|
210
|
+
* Place a new order using Smart Order Routing (SOR)
|
|
211
|
+
* Note: Only supports LIMIT and MARKET orders. quoteOrderQty is not supported
|
|
212
|
+
*/
|
|
213
|
+
placeSpotSOROrder(params: WSAPISOROrderPlaceRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPISOROrderPlaceResponse>>;
|
|
214
|
+
/**
|
|
215
|
+
* Test new order creation and signature/recvWindow using Smart Order Routing (SOR)
|
|
216
|
+
* Note: Creates and validates a new order but does not send it into the matching engine
|
|
217
|
+
*/
|
|
218
|
+
testSpotSOROrder(params: WSAPISOROrderTestRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPISOROrderTestResponse | WSAPISOROrderTestResponseWithCommission>>;
|
|
219
|
+
/**
|
|
220
|
+
* Query information about your account, including balances
|
|
221
|
+
* Note: Weight: 20
|
|
222
|
+
*/
|
|
223
|
+
getSpotAccountInformation(params: WSAPIAccountInformationRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIAccountInformation>>;
|
|
224
|
+
/**
|
|
225
|
+
* Query your current unfilled order count for all intervals
|
|
226
|
+
* Note: Weight: 40
|
|
227
|
+
*/
|
|
228
|
+
getSpotOrderRateLimits(params: WSAPIRecvWindowTimestamp, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIRateLimit[]>>;
|
|
229
|
+
/**
|
|
230
|
+
* Query information about all your orders – active, canceled, filled – filtered by time range
|
|
231
|
+
* Note: Weight: 20
|
|
232
|
+
*/
|
|
233
|
+
getSpotAllOrders(params: WSAPIAllOrdersRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIOrder[]>>;
|
|
234
|
+
/**
|
|
235
|
+
* Query information about all your order lists, filtered by time range
|
|
236
|
+
* Note: Weight: 20
|
|
237
|
+
*/
|
|
238
|
+
getSpotAllOrderLists(params: WSAPIAllOrderListsRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIOrderListStatusResponse[]>>;
|
|
239
|
+
/**
|
|
240
|
+
* Query information about all your trades, filtered by time range
|
|
241
|
+
* Note: Weight: 20
|
|
242
|
+
*/
|
|
243
|
+
getSpotMyTrades(params: WSAPIMyTradesRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPITrade[]>>;
|
|
244
|
+
/**
|
|
245
|
+
* Displays the list of orders that were expired due to STP
|
|
246
|
+
* Note: Weight varies based on query type (2-20)
|
|
247
|
+
*/
|
|
248
|
+
getSpotPreventedMatches(params: WSAPIMyPreventedMatchesRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIPreventedMatch[]>>;
|
|
249
|
+
/**
|
|
250
|
+
* Retrieves allocations resulting from SOR order placement
|
|
251
|
+
* Note: Weight: 20
|
|
252
|
+
*/
|
|
253
|
+
getSpotAllocations(params: WSAPIMyAllocationsRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIAllocation[]>>;
|
|
254
|
+
/**
|
|
255
|
+
* Get current account commission rates
|
|
256
|
+
* Note: Weight: 20
|
|
257
|
+
*/
|
|
258
|
+
getSpotAccountCommission(params: WSAPIAccountCommissionWSAPIRequest, wsKey?: WSAPIWsKeyMain): Promise<WSAPIResponse<WSAPIAccountCommission>>;
|
|
259
|
+
/**
|
|
260
|
+
* Get current order book for futures
|
|
261
|
+
* Note: If you need to continuously monitor order book updates, consider using WebSocket Streams
|
|
262
|
+
*/
|
|
263
|
+
getFuturesOrderBook(params: WSAPIFuturesOrderBookRequest): Promise<WSAPIResponse<WSAPIFuturesOrderBook>>;
|
|
264
|
+
/**
|
|
265
|
+
* Get latest price for a futures symbol or symbols
|
|
266
|
+
* Note: If symbol is not provided, prices for all symbols will be returned
|
|
267
|
+
*/
|
|
268
|
+
getFuturesSymbolPriceTicker(params?: WSAPIFuturesTickerPriceRequest): Promise<WSAPIResponse<WSAPIFuturesPriceTicker | WSAPIFuturesPriceTicker[]>>;
|
|
269
|
+
/**
|
|
270
|
+
* Get best price/qty on the order book for a futures symbol or symbols
|
|
271
|
+
* Note: If symbol is not provided, bookTickers for all symbols will be returned
|
|
272
|
+
*/
|
|
273
|
+
getFuturesSymbolOrderBookTicker(params?: WSAPIFuturesTickerBookRequest): Promise<WSAPIResponse<WSAPIFuturesBookTicker | WSAPIFuturesBookTicker[]>>;
|
|
274
|
+
/**
|
|
275
|
+
* Submit a futures order
|
|
276
|
+
*
|
|
277
|
+
* This endpoint is used for both USDM and COINM futures.
|
|
278
|
+
*/
|
|
279
|
+
submitNewFuturesOrder(market: 'usdm' | 'coinm', params: WSAPINewFuturesOrderRequest): Promise<WSAPIResponse<WSAPIFuturesOrder>>;
|
|
280
|
+
/**
|
|
281
|
+
* Modify an existing futures order
|
|
282
|
+
*
|
|
283
|
+
* This endpoint is used for both USDM and COINM futures.
|
|
284
|
+
*/
|
|
285
|
+
modifyFuturesOrder(market: 'usdm' | 'coinm', params: WSAPIFuturesOrderModifyRequest): Promise<WSAPIResponse<WSAPIFuturesOrder>>;
|
|
286
|
+
/**
|
|
287
|
+
* Cancel a futures order
|
|
288
|
+
*
|
|
289
|
+
* This endpoint is used for both USDM and COINM futures.
|
|
290
|
+
*/
|
|
291
|
+
cancelFuturesOrder(market: 'usdm' | 'coinm', params: WSAPIFuturesOrderCancelRequest): Promise<WSAPIResponse<WSAPIFuturesOrder>>;
|
|
292
|
+
/**
|
|
293
|
+
* Query futures order status
|
|
294
|
+
*
|
|
295
|
+
* This endpoint is used for both USDM and COINM futures.
|
|
296
|
+
*/
|
|
297
|
+
getFuturesOrderStatus(market: 'usdm' | 'coinm', params: WSAPIFuturesOrderStatusRequest): Promise<WSAPIResponse<WSAPIFuturesOrder>>;
|
|
298
|
+
/**
|
|
299
|
+
* Get current position information (V2)
|
|
300
|
+
* Note: Only symbols that have positions or open orders will be returned
|
|
301
|
+
*/
|
|
302
|
+
getFuturesPositionV2(params: WSAPIFuturesPositionV2Request): Promise<WSAPIResponse<WSAPIFuturesPositionV2[]>>;
|
|
303
|
+
/**
|
|
304
|
+
* Get current position information
|
|
305
|
+
* Note: Only symbols that have positions or open orders will be returned
|
|
306
|
+
*
|
|
307
|
+
* This endpoint is used for both USDM and COINM futures.
|
|
308
|
+
*/
|
|
309
|
+
getFuturesPosition(market: 'usdm' | 'coinm', params: WSAPIFuturesPositionRequest): Promise<WSAPIResponse<WSAPIFuturesPosition[]>>;
|
|
310
|
+
/**
|
|
311
|
+
* Get account balance information (V2)
|
|
312
|
+
* Note: Returns balance information for all assets
|
|
313
|
+
*/
|
|
314
|
+
getFuturesAccountBalanceV2(params: WSAPIRecvWindowTimestamp): Promise<WSAPIResponse<WSAPIFuturesAccountBalanceItem[]>>;
|
|
315
|
+
/**
|
|
316
|
+
* Get account balance information
|
|
317
|
+
* Note: Returns balance information for all assets
|
|
318
|
+
*
|
|
319
|
+
* This endpoint is used for both USDM and COINM futures.
|
|
320
|
+
*/
|
|
321
|
+
getFuturesAccountBalance(market: 'usdm' | 'coinm', params: WSAPIRecvWindowTimestamp): Promise<WSAPIResponse<WSAPIFuturesAccountBalanceItem[]>>;
|
|
322
|
+
/**
|
|
323
|
+
* Get account information (V2)
|
|
324
|
+
* Note: Returns detailed account information including positions and assets
|
|
325
|
+
*/
|
|
326
|
+
getFuturesAccountStatusV2(params: WSAPIRecvWindowTimestamp): Promise<WSAPIResponse<WSAPIFuturesAccountStatus>>;
|
|
327
|
+
/**
|
|
328
|
+
* Get account information
|
|
329
|
+
* Note: Returns detailed account information including positions and assets
|
|
330
|
+
*
|
|
331
|
+
* This endpoint is used for both USDM and COINM futures.
|
|
332
|
+
*/
|
|
333
|
+
getFuturesAccountStatus(market: 'usdm' | 'coinm', params: WSAPIRecvWindowTimestamp): Promise<WSAPIResponse<WSAPIFuturesAccountStatus>>;
|
|
334
|
+
/**
|
|
335
|
+
* Start the user data stream for an apiKey (passed as param).
|
|
336
|
+
*
|
|
337
|
+
* Note: for "Spot" markets, the listenKey workflow is deprecated, use `subscribeUserDataStream()` instead.
|
|
338
|
+
*
|
|
339
|
+
* @param params
|
|
340
|
+
* @param wsKey
|
|
341
|
+
* @returns listenKey
|
|
342
|
+
*/
|
|
343
|
+
startUserDataStreamForKey(params: {
|
|
344
|
+
apiKey: string;
|
|
345
|
+
}, wsKey?: WSAPIWsKey): Promise<WSAPIResponse<{
|
|
346
|
+
listenKey: string;
|
|
347
|
+
}>>;
|
|
348
|
+
/**
|
|
349
|
+
* Attempt to "ping" a listen key.
|
|
350
|
+
*
|
|
351
|
+
* Note: for "Spot" markets, the listenKey workflow is deprecated, use `subscribeUserDataStream()` instead.
|
|
352
|
+
*
|
|
353
|
+
* @param params
|
|
354
|
+
* @param wsKey
|
|
355
|
+
* @returns
|
|
356
|
+
*/
|
|
357
|
+
pingUserDataStreamForKey(params: WSAPIUserDataListenKeyRequest, wsKey?: WSAPIWsKey): Promise<WSAPIResponse<object>>;
|
|
358
|
+
/**
|
|
359
|
+
* Stop the user data stream listen key.
|
|
360
|
+
*
|
|
361
|
+
* @param params
|
|
362
|
+
* @param wsKey
|
|
363
|
+
* @returns
|
|
364
|
+
*/
|
|
365
|
+
stopUserDataStreamForKey(params: WSAPIUserDataListenKeyRequest, wsKey?: WSAPIWsKey): Promise<WSAPIResponse<object>>;
|
|
366
|
+
/**
|
|
367
|
+
* Request user data stream subscription on the currently authenticated connection.
|
|
368
|
+
*
|
|
369
|
+
* If reconnected, this will automatically resubscribe unless you unsubscribe manually.
|
|
370
|
+
*/
|
|
371
|
+
subscribeUserDataStream(wsKey: WSAPIWsKey): Promise<WSAPIResponse<object>>;
|
|
372
|
+
/**
|
|
373
|
+
* Unsubscribe from the user data stream subscription on the currently authenticated connection.
|
|
374
|
+
*
|
|
375
|
+
* If reconnected, this will also stop it from automatically resubscribing after reconnect.
|
|
376
|
+
*/
|
|
377
|
+
unsubscribeUserDataStream(wsKey: WSAPIWsKey): Promise<WSAPIResponse<{
|
|
378
|
+
listenKey: string;
|
|
379
|
+
}>>;
|
|
380
|
+
/**
|
|
381
|
+
*
|
|
382
|
+
*
|
|
383
|
+
*
|
|
384
|
+
*
|
|
385
|
+
*
|
|
386
|
+
*
|
|
387
|
+
*
|
|
388
|
+
* Private methods for handling some of the convenience/automation provided by the WS API Client
|
|
389
|
+
*
|
|
390
|
+
*
|
|
391
|
+
*
|
|
392
|
+
*
|
|
393
|
+
*
|
|
394
|
+
*
|
|
395
|
+
*
|
|
396
|
+
*/
|
|
397
|
+
private setupDefaultEventListeners;
|
|
398
|
+
private tryResubscribeUserDataStream;
|
|
399
|
+
private getSubscribedUserDataStreamState;
|
|
400
|
+
private handleWSReconnectedEvent;
|
|
401
|
+
}
|