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