binance 3.0.0-beta.3 → 3.0.0-beta.5

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