ccxt 4.4.33 → 4.4.35
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 +8 -7
- package/dist/ccxt.browser.min.js +6 -6
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/src/abstract/ellipx.js +9 -0
- package/dist/cjs/src/alpaca.js +2 -0
- package/dist/cjs/src/base/Exchange.js +32 -6
- package/dist/cjs/src/binance.js +19 -14
- package/dist/cjs/src/bingx.js +495 -153
- package/dist/cjs/src/bitbank.js +5 -0
- package/dist/cjs/src/bitbns.js +2 -0
- package/dist/cjs/src/bitfinex2.js +2 -1
- package/dist/cjs/src/bitget.js +177 -44
- package/dist/cjs/src/bitmex.js +3 -1
- package/dist/cjs/src/bitopro.js +3 -0
- package/dist/cjs/src/bitrue.js +3 -2
- package/dist/cjs/src/btcmarkets.js +5 -3
- package/dist/cjs/src/btcturk.js +19 -19
- package/dist/cjs/src/bybit.js +14 -11
- package/dist/cjs/src/cex.js +13 -4
- package/dist/cjs/src/coinbase.js +3 -2
- package/dist/cjs/src/coinex.js +1 -0
- package/dist/cjs/src/coinone.js +7 -7
- package/dist/cjs/src/coinsph.js +7 -7
- package/dist/cjs/src/coinspot.js +39 -39
- package/dist/cjs/src/cryptocom.js +36 -34
- package/dist/cjs/src/ellipx.js +1871 -0
- package/dist/cjs/src/gate.js +145 -41
- package/dist/cjs/src/hyperliquid.js +75 -11
- package/dist/cjs/src/idex.js +3 -3
- package/dist/cjs/src/kraken.js +71 -54
- package/dist/cjs/src/krakenfutures.js +3 -1
- package/dist/cjs/src/kucoin.js +1 -1
- package/dist/cjs/src/okcoin.js +2 -0
- package/dist/cjs/src/okx.js +16 -11
- package/dist/cjs/src/onetrading.js +34 -396
- package/dist/cjs/src/paradex.js +2 -0
- package/dist/cjs/src/phemex.js +23 -0
- package/dist/cjs/src/poloniex.js +3 -1
- package/dist/cjs/src/poloniexfutures.js +3 -1
- package/dist/cjs/src/pro/bitrue.js +13 -11
- package/dist/cjs/src/pro/idex.js +5 -0
- package/dist/cjs/src/pro/probit.js +62 -68
- package/dist/cjs/src/pro/woo.js +15 -15
- package/dist/cjs/src/vertex.js +2 -0
- package/dist/cjs/src/woo.js +69 -69
- package/dist/cjs/src/xt.js +5 -5
- package/examples/js/cli.js +1 -1
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/bingx.d.ts +17 -0
- package/js/src/abstract/bitbank.d.ts +5 -0
- package/js/src/abstract/bitfinex2.d.ts +1 -0
- package/js/src/abstract/bitpanda.d.ts +0 -12
- package/js/src/abstract/bitrue.d.ts +3 -3
- package/js/src/abstract/ellipx.d.ts +28 -0
- package/js/src/abstract/ellipx.js +11 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/abstract/onetrading.d.ts +0 -12
- package/js/src/alpaca.js +2 -0
- package/js/src/base/Exchange.d.ts +8 -0
- package/js/src/base/Exchange.js +32 -6
- package/js/src/binance.js +19 -14
- package/js/src/bingx.d.ts +11 -1
- package/js/src/bingx.js +495 -153
- package/js/src/bitbank.js +5 -0
- package/js/src/bitbns.js +2 -0
- package/js/src/bitfinex2.js +2 -1
- package/js/src/bitget.d.ts +4 -4
- package/js/src/bitget.js +177 -44
- package/js/src/bitmex.js +3 -1
- package/js/src/bitopro.d.ts +1 -0
- package/js/src/bitopro.js +3 -0
- package/js/src/bitrue.js +3 -2
- package/js/src/btcmarkets.d.ts +1 -0
- package/js/src/btcmarkets.js +5 -3
- package/js/src/btcturk.js +19 -19
- package/js/src/bybit.d.ts +3 -2
- package/js/src/bybit.js +14 -11
- package/js/src/cex.d.ts +1 -0
- package/js/src/cex.js +13 -4
- package/js/src/coinbase.d.ts +2 -1
- package/js/src/coinbase.js +3 -2
- package/js/src/coinex.js +1 -0
- package/js/src/coinone.js +7 -7
- package/js/src/coinsph.js +7 -7
- package/js/src/coinspot.js +39 -39
- package/js/src/cryptocom.d.ts +1 -1
- package/js/src/cryptocom.js +36 -34
- package/js/src/ellipx.d.ts +236 -0
- package/js/src/ellipx.js +1874 -0
- package/js/src/gate.d.ts +7 -7
- package/js/src/gate.js +145 -41
- package/js/src/hyperliquid.d.ts +10 -0
- package/js/src/hyperliquid.js +77 -13
- package/js/src/idex.js +4 -4
- package/js/src/kraken.d.ts +11 -8
- package/js/src/kraken.js +71 -54
- package/js/src/krakenfutures.js +3 -1
- package/js/src/kucoin.js +1 -1
- package/js/src/okcoin.js +2 -0
- package/js/src/okx.d.ts +1 -1
- package/js/src/okx.js +16 -11
- package/js/src/onetrading.d.ts +20 -67
- package/js/src/onetrading.js +35 -397
- package/js/src/paradex.js +2 -0
- package/js/src/phemex.js +23 -0
- package/js/src/poloniex.d.ts +1 -1
- package/js/src/poloniex.js +3 -1
- package/js/src/poloniexfutures.d.ts +1 -1
- package/js/src/poloniexfutures.js +3 -1
- package/js/src/pro/bitrue.js +13 -11
- package/js/src/pro/idex.d.ts +5 -0
- package/js/src/pro/idex.js +5 -0
- package/js/src/pro/probit.d.ts +2 -1
- package/js/src/pro/probit.js +62 -68
- package/js/src/pro/woo.d.ts +11 -11
- package/js/src/pro/woo.js +15 -15
- package/js/src/vertex.js +2 -0
- package/js/src/woo.d.ts +60 -60
- package/js/src/woo.js +69 -69
- package/js/src/xt.js +5 -5
- package/package.json +4 -3
package/dist/cjs/src/poloniex.js
CHANGED
|
@@ -36,6 +36,8 @@ class poloniex extends poloniex$1 {
|
|
|
36
36
|
'createMarketOrderWithCost': false,
|
|
37
37
|
'createMarketSellOrderWithCost': false,
|
|
38
38
|
'createOrder': true,
|
|
39
|
+
'createStopOrder': true,
|
|
40
|
+
'createTriggerOrder': true,
|
|
39
41
|
'editOrder': true,
|
|
40
42
|
'fetchBalance': true,
|
|
41
43
|
'fetchClosedOrder': false,
|
|
@@ -1266,7 +1268,7 @@ class poloniex extends poloniex$1 {
|
|
|
1266
1268
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
1267
1269
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
1268
1270
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1269
|
-
* @param {float} [params.triggerPrice]
|
|
1271
|
+
* @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
|
|
1270
1272
|
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
1271
1273
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1272
1274
|
*/
|
|
@@ -31,6 +31,8 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
31
31
|
'future': false,
|
|
32
32
|
'option': undefined,
|
|
33
33
|
'createOrder': true,
|
|
34
|
+
'createStopOrder': true,
|
|
35
|
+
'createTriggerOrder': true,
|
|
34
36
|
'fetchBalance': true,
|
|
35
37
|
'fetchClosedOrders': true,
|
|
36
38
|
'fetchCurrencies': false,
|
|
@@ -835,7 +837,7 @@ class poloniexfutures extends poloniexfutures$1 {
|
|
|
835
837
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
836
838
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
837
839
|
* @param {float} [params.leverage] Leverage size of the order
|
|
838
|
-
* @param {float} [params.
|
|
840
|
+
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
839
841
|
* @param {bool} [params.reduceOnly] A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true.
|
|
840
842
|
* @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only
|
|
841
843
|
* @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
|
|
@@ -30,15 +30,17 @@ class bitrue extends bitrue$1 {
|
|
|
30
30
|
},
|
|
31
31
|
'api': {
|
|
32
32
|
'open': {
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
'
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
'
|
|
33
|
+
'v1': {
|
|
34
|
+
'private': {
|
|
35
|
+
'post': {
|
|
36
|
+
'poseidon/api/v1/listenKey': 1,
|
|
37
|
+
},
|
|
38
|
+
'put': {
|
|
39
|
+
'poseidon/api/v1/listenKey/{listenKey}': 1,
|
|
40
|
+
},
|
|
41
|
+
'delete': {
|
|
42
|
+
'poseidon/api/v1/listenKey/{listenKey}': 1,
|
|
43
|
+
},
|
|
42
44
|
},
|
|
43
45
|
},
|
|
44
46
|
},
|
|
@@ -411,7 +413,7 @@ class bitrue extends bitrue$1 {
|
|
|
411
413
|
async authenticate(params = {}) {
|
|
412
414
|
const listenKey = this.safeValue(this.options, 'listenKey');
|
|
413
415
|
if (listenKey === undefined) {
|
|
414
|
-
const response = await this.
|
|
416
|
+
const response = await this.openV1PrivatePostPoseidonApiV1ListenKey(params);
|
|
415
417
|
//
|
|
416
418
|
// {
|
|
417
419
|
// "msg": "succ",
|
|
@@ -436,7 +438,7 @@ class bitrue extends bitrue$1 {
|
|
|
436
438
|
'listenKey': listenKey,
|
|
437
439
|
};
|
|
438
440
|
try {
|
|
439
|
-
await this.
|
|
441
|
+
await this.openV1PrivatePutPoseidonApiV1ListenKeyListenKey(this.extend(request, params));
|
|
440
442
|
//
|
|
441
443
|
// ಠ_ಠ
|
|
442
444
|
// {
|
package/dist/cjs/src/pro/idex.js
CHANGED
|
@@ -67,6 +67,7 @@ class idex extends idex$1 {
|
|
|
67
67
|
* @method
|
|
68
68
|
* @name idex#watchTicker
|
|
69
69
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
70
|
+
* @see https://api-docs-v4.idex.io/#tickers
|
|
70
71
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
71
72
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
72
73
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -139,6 +140,7 @@ class idex extends idex$1 {
|
|
|
139
140
|
* @method
|
|
140
141
|
* @name idex#watchTrades
|
|
141
142
|
* @description get the list of most recent trades for a particular symbol
|
|
143
|
+
* @see https://api-docs-v4.idex.io/#trades
|
|
142
144
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
143
145
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
144
146
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -233,6 +235,7 @@ class idex extends idex$1 {
|
|
|
233
235
|
* @method
|
|
234
236
|
* @name idex#watchOHLCV
|
|
235
237
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
238
|
+
* @see https://api-docs-v4.idex.io/#candles
|
|
236
239
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
237
240
|
* @param {string} timeframe the length of time each candle represents
|
|
238
241
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -403,6 +406,7 @@ class idex extends idex$1 {
|
|
|
403
406
|
* @method
|
|
404
407
|
* @name idex#watchOrderBook
|
|
405
408
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
409
|
+
* @see https://api-docs-v4.idex.io/#l2-order-book
|
|
406
410
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
407
411
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
408
412
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -506,6 +510,7 @@ class idex extends idex$1 {
|
|
|
506
510
|
* @method
|
|
507
511
|
* @name idex#watchOrders
|
|
508
512
|
* @description watches information on multiple orders made by the user
|
|
513
|
+
* @see https://api-docs-v4.idex.io/#orders
|
|
509
514
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
510
515
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
511
516
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -34,15 +34,6 @@ class probit extends probit$1 {
|
|
|
34
34
|
'filter': 'order_books_l2',
|
|
35
35
|
'interval': 100, // or 500
|
|
36
36
|
},
|
|
37
|
-
'watchTrades': {
|
|
38
|
-
'filter': 'recent_trades',
|
|
39
|
-
},
|
|
40
|
-
'watchTicker': {
|
|
41
|
-
'filter': 'ticker',
|
|
42
|
-
},
|
|
43
|
-
'watchOrders': {
|
|
44
|
-
'channel': 'open_order',
|
|
45
|
-
},
|
|
46
37
|
},
|
|
47
38
|
'streaming': {},
|
|
48
39
|
});
|
|
@@ -58,13 +49,7 @@ class probit extends probit$1 {
|
|
|
58
49
|
async watchBalance(params = {}) {
|
|
59
50
|
await this.authenticate(params);
|
|
60
51
|
const messageHash = 'balance';
|
|
61
|
-
|
|
62
|
-
const subscribe = {
|
|
63
|
-
'type': 'subscribe',
|
|
64
|
-
'channel': 'balance',
|
|
65
|
-
};
|
|
66
|
-
const request = this.extend(subscribe, params);
|
|
67
|
-
return await this.watch(url, messageHash, request, messageHash);
|
|
52
|
+
return await this.subscribePrivate(messageHash, 'balance', params);
|
|
68
53
|
}
|
|
69
54
|
handleBalance(client, message) {
|
|
70
55
|
//
|
|
@@ -124,9 +109,8 @@ class probit extends probit$1 {
|
|
|
124
109
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
125
110
|
*/
|
|
126
111
|
async watchTicker(symbol, params = {}) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return await this.subscribeOrderBook(symbol, 'ticker', filter, params);
|
|
112
|
+
const channel = 'ticker';
|
|
113
|
+
return await this.subscribePublic('watchTicker', symbol, 'ticker', channel, params);
|
|
130
114
|
}
|
|
131
115
|
handleTicker(client, message) {
|
|
132
116
|
//
|
|
@@ -169,9 +153,8 @@ class probit extends probit$1 {
|
|
|
169
153
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
170
154
|
*/
|
|
171
155
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const trades = await this.subscribeOrderBook(symbol, 'trades', filter, params);
|
|
156
|
+
const channel = 'recent_trades';
|
|
157
|
+
const trades = await this.subscribePublic('watchTrades', symbol, 'trades', channel, params);
|
|
175
158
|
if (this.newUpdates) {
|
|
176
159
|
limit = trades.getLimit(symbol, limit);
|
|
177
160
|
}
|
|
@@ -202,10 +185,12 @@ class probit extends probit$1 {
|
|
|
202
185
|
const symbol = this.safeSymbol(marketId);
|
|
203
186
|
const market = this.safeMarket(marketId);
|
|
204
187
|
const trades = this.safeValue(message, 'recent_trades', []);
|
|
205
|
-
|
|
188
|
+
if (this.safeBool(message, 'reset', false)) {
|
|
189
|
+
return; // see comment in handleMessage
|
|
190
|
+
}
|
|
206
191
|
const messageHash = 'trades:' + symbol;
|
|
207
192
|
let stored = this.safeValue(this.trades, symbol);
|
|
208
|
-
if (stored === undefined
|
|
193
|
+
if (stored === undefined) {
|
|
209
194
|
const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
210
195
|
stored = new Cache.ArrayCache(limit);
|
|
211
196
|
this.trades[symbol] = stored;
|
|
@@ -232,20 +217,12 @@ class probit extends probit$1 {
|
|
|
232
217
|
async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
233
218
|
await this.loadMarkets();
|
|
234
219
|
await this.authenticate(params);
|
|
235
|
-
let messageHash = '
|
|
220
|
+
let messageHash = 'trades';
|
|
236
221
|
if (symbol !== undefined) {
|
|
237
|
-
|
|
238
|
-
symbol = market['symbol'];
|
|
222
|
+
symbol = this.safeSymbol(symbol);
|
|
239
223
|
messageHash = messageHash + ':' + symbol;
|
|
240
224
|
}
|
|
241
|
-
const
|
|
242
|
-
const channel = 'trade_history';
|
|
243
|
-
const message = {
|
|
244
|
-
'type': 'subscribe',
|
|
245
|
-
'channel': channel,
|
|
246
|
-
};
|
|
247
|
-
const request = this.extend(message, params);
|
|
248
|
-
const trades = await this.watch(url, messageHash, request, channel);
|
|
225
|
+
const trades = await this.subscribePrivate(messageHash, 'trade_history', params);
|
|
249
226
|
if (this.newUpdates) {
|
|
250
227
|
limit = trades.getLimit(symbol, limit);
|
|
251
228
|
}
|
|
@@ -276,10 +253,12 @@ class probit extends probit$1 {
|
|
|
276
253
|
if (length === 0) {
|
|
277
254
|
return;
|
|
278
255
|
}
|
|
279
|
-
|
|
280
|
-
|
|
256
|
+
if (this.safeBool(message, 'reset', false)) {
|
|
257
|
+
return; // see comment in handleMessage
|
|
258
|
+
}
|
|
259
|
+
const messageHash = 'trades';
|
|
281
260
|
let stored = this.myTrades;
|
|
282
|
-
if (
|
|
261
|
+
if (stored === undefined) {
|
|
283
262
|
const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
284
263
|
stored = new Cache.ArrayCacheBySymbolById(limit);
|
|
285
264
|
this.myTrades = stored;
|
|
@@ -288,10 +267,18 @@ class probit extends probit$1 {
|
|
|
288
267
|
const tradeSymbols = {};
|
|
289
268
|
for (let j = 0; j < trades.length; j++) {
|
|
290
269
|
const trade = trades[j];
|
|
270
|
+
// don't include 'executed' state, because it's just blanket state of the trade, emited before actual trade event
|
|
271
|
+
if (this.safeString(trade['info'], 'status') === 'executed') {
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
291
274
|
tradeSymbols[trade['symbol']] = true;
|
|
292
275
|
stored.append(trade);
|
|
293
276
|
}
|
|
294
277
|
const unique = Object.keys(tradeSymbols);
|
|
278
|
+
const uniqueLength = unique.length;
|
|
279
|
+
if (uniqueLength === 0) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
295
282
|
for (let i = 0; i < unique.length; i++) {
|
|
296
283
|
const symbol = unique[i];
|
|
297
284
|
const symbolSpecificMessageHash = messageHash + ':' + symbol;
|
|
@@ -313,21 +300,12 @@ class probit extends probit$1 {
|
|
|
313
300
|
*/
|
|
314
301
|
async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
315
302
|
await this.authenticate(params);
|
|
316
|
-
const url = this.urls['api']['ws'];
|
|
317
303
|
let messageHash = 'orders';
|
|
318
304
|
if (symbol !== undefined) {
|
|
319
|
-
|
|
320
|
-
symbol = market['symbol'];
|
|
305
|
+
symbol = this.safeSymbol(symbol);
|
|
321
306
|
messageHash = messageHash + ':' + symbol;
|
|
322
307
|
}
|
|
323
|
-
|
|
324
|
-
[channel, params] = this.handleOptionAndParams(params, 'watchOrders', 'channel', 'open_order');
|
|
325
|
-
const subscribe = {
|
|
326
|
-
'type': 'subscribe',
|
|
327
|
-
'channel': channel,
|
|
328
|
-
};
|
|
329
|
-
const request = this.extend(subscribe, params);
|
|
330
|
-
const orders = await this.watch(url, messageHash, request, channel);
|
|
308
|
+
const orders = await this.subscribePrivate(messageHash, 'open_order', params);
|
|
331
309
|
if (this.newUpdates) {
|
|
332
310
|
limit = orders.getLimit(symbol, limit);
|
|
333
311
|
}
|
|
@@ -397,41 +375,51 @@ class probit extends probit$1 {
|
|
|
397
375
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
398
376
|
*/
|
|
399
377
|
async watchOrderBook(symbol, limit = undefined, params = {}) {
|
|
400
|
-
let
|
|
401
|
-
[
|
|
402
|
-
const orderbook = await this.
|
|
378
|
+
let channel = undefined;
|
|
379
|
+
[channel, params] = this.handleOptionAndParams(params, 'watchOrderBook', 'filter', 'order_books');
|
|
380
|
+
const orderbook = await this.subscribePublic('watchOrderBook', symbol, 'orderbook', channel, params);
|
|
403
381
|
return orderbook.limit();
|
|
404
382
|
}
|
|
405
|
-
async
|
|
383
|
+
async subscribePrivate(messageHash, channel, params) {
|
|
384
|
+
const url = this.urls['api']['ws'];
|
|
385
|
+
const subscribe = {
|
|
386
|
+
'type': 'subscribe',
|
|
387
|
+
'channel': channel,
|
|
388
|
+
};
|
|
389
|
+
const request = this.extend(subscribe, params);
|
|
390
|
+
const subscribeHash = messageHash;
|
|
391
|
+
return await this.watch(url, messageHash, request, subscribeHash);
|
|
392
|
+
}
|
|
393
|
+
async subscribePublic(methodName, symbol, dataType, filter, params = {}) {
|
|
406
394
|
await this.loadMarkets();
|
|
407
395
|
const market = this.market(symbol);
|
|
408
396
|
symbol = market['symbol'];
|
|
409
397
|
const url = this.urls['api']['ws'];
|
|
410
398
|
const client = this.client(url);
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
const subscriptionHash = 'marketdata:' + symbol;
|
|
414
|
-
messageHash = messageHash + ':' + symbol;
|
|
399
|
+
const subscribeHash = 'marketdata:' + symbol;
|
|
400
|
+
const messageHash = dataType + ':' + symbol;
|
|
415
401
|
let filters = {};
|
|
416
|
-
if (
|
|
402
|
+
if (subscribeHash in client.subscriptions) {
|
|
417
403
|
// already subscribed
|
|
418
|
-
filters = client.subscriptions[
|
|
404
|
+
filters = client.subscriptions[subscribeHash];
|
|
419
405
|
if (!(filter in filters)) {
|
|
420
406
|
// resubscribe
|
|
421
|
-
delete client.subscriptions[
|
|
407
|
+
delete client.subscriptions[subscribeHash];
|
|
422
408
|
}
|
|
423
409
|
}
|
|
424
410
|
filters[filter] = true;
|
|
425
411
|
const keys = Object.keys(filters);
|
|
426
|
-
|
|
412
|
+
let interval = undefined;
|
|
413
|
+
[interval, params] = this.handleOptionAndParams(params, methodName, 'interval', 100);
|
|
414
|
+
let request = {
|
|
415
|
+
'type': 'subscribe',
|
|
427
416
|
'channel': 'marketdata',
|
|
428
|
-
'interval': interval,
|
|
429
417
|
'market_id': market['id'],
|
|
430
|
-
'type': 'subscribe',
|
|
431
418
|
'filter': keys,
|
|
419
|
+
'interval': interval,
|
|
432
420
|
};
|
|
433
|
-
|
|
434
|
-
return await this.watch(url, messageHash, request,
|
|
421
|
+
request = this.extend(request, params);
|
|
422
|
+
return await this.watch(url, messageHash, request, subscribeHash, filters);
|
|
435
423
|
}
|
|
436
424
|
handleOrderBook(client, message, orderBook) {
|
|
437
425
|
//
|
|
@@ -510,7 +498,8 @@ class probit extends probit$1 {
|
|
|
510
498
|
const result = this.safeString(message, 'result');
|
|
511
499
|
const future = client.subscriptions['authenticated'];
|
|
512
500
|
if (result === 'ok') {
|
|
513
|
-
|
|
501
|
+
const messageHash = 'authenticated';
|
|
502
|
+
client.resolve(message, messageHash);
|
|
514
503
|
}
|
|
515
504
|
else {
|
|
516
505
|
future.reject(message);
|
|
@@ -523,11 +512,13 @@ class probit extends probit$1 {
|
|
|
523
512
|
this.handleTicker(client, message);
|
|
524
513
|
}
|
|
525
514
|
const trades = this.safeValue(message, 'recent_trades', []);
|
|
526
|
-
|
|
515
|
+
const tradesLength = trades.length;
|
|
516
|
+
if (tradesLength) {
|
|
527
517
|
this.handleTrades(client, message);
|
|
528
518
|
}
|
|
529
519
|
const orderBook = this.safeValueN(message, ['order_books', 'order_books_l1', 'order_books_l2', 'order_books_l3', 'order_books_l4'], []);
|
|
530
|
-
|
|
520
|
+
const orderBookLength = orderBook.length;
|
|
521
|
+
if (orderBookLength) {
|
|
531
522
|
this.handleOrderBook(client, message, orderBook);
|
|
532
523
|
}
|
|
533
524
|
}
|
|
@@ -541,6 +532,9 @@ class probit extends probit$1 {
|
|
|
541
532
|
// }
|
|
542
533
|
// }
|
|
543
534
|
//
|
|
535
|
+
// Note about 'reset' field
|
|
536
|
+
// 'reset': true field - it happens once after initial subscription, which just returns old items by the moment of subscription (like "fetchMyTrades" does)
|
|
537
|
+
//
|
|
544
538
|
const errorCode = this.safeString(message, 'errorCode');
|
|
545
539
|
if (errorCode !== undefined) {
|
|
546
540
|
this.handleErrorMessage(client, message);
|
package/dist/cjs/src/pro/woo.js
CHANGED
|
@@ -28,14 +28,14 @@ class woo extends woo$1 {
|
|
|
28
28
|
'urls': {
|
|
29
29
|
'api': {
|
|
30
30
|
'ws': {
|
|
31
|
-
'public': 'wss://wss.
|
|
32
|
-
'private': 'wss://wss.
|
|
31
|
+
'public': 'wss://wss.woox.io/ws/stream',
|
|
32
|
+
'private': 'wss://wss.woox.io/v2/ws/private/stream',
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
35
|
'test': {
|
|
36
36
|
'ws': {
|
|
37
|
-
'public': 'wss://wss.staging.
|
|
38
|
-
'private': 'wss://wss.staging.
|
|
37
|
+
'public': 'wss://wss.staging.woox.io/ws/stream',
|
|
38
|
+
'private': 'wss://wss.staging.woox.io/v2/ws/private/stream',
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
},
|
|
@@ -86,8 +86,8 @@ class woo extends woo$1 {
|
|
|
86
86
|
/**
|
|
87
87
|
* @method
|
|
88
88
|
* @name woo#watchOrderBook
|
|
89
|
-
* @see https://docs.
|
|
90
|
-
* @see https://docs.
|
|
89
|
+
* @see https://docs.woox.io/#orderbookupdate
|
|
90
|
+
* @see https://docs.woox.io/#orderbook
|
|
91
91
|
* @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
92
92
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
93
93
|
* @param {int} [limit] the maximum amount of order book entries to return.
|
|
@@ -340,7 +340,7 @@ class woo extends woo$1 {
|
|
|
340
340
|
/**
|
|
341
341
|
* @method
|
|
342
342
|
* @name woo#watchTickers
|
|
343
|
-
* @see https://docs.
|
|
343
|
+
* @see https://docs.woox.io/#24h-tickers
|
|
344
344
|
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
345
345
|
* @param {string[]} symbols unified symbol of the market to fetch the ticker for
|
|
346
346
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -477,7 +477,7 @@ class woo extends woo$1 {
|
|
|
477
477
|
* @method
|
|
478
478
|
* @name woo#watchOHLCV
|
|
479
479
|
* @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
480
|
-
* @see https://docs.
|
|
480
|
+
* @see https://docs.woox.io/#k-line
|
|
481
481
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
482
482
|
* @param {string} timeframe the length of time each candle represents
|
|
483
483
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -553,7 +553,7 @@ class woo extends woo$1 {
|
|
|
553
553
|
* @method
|
|
554
554
|
* @name woo#watchTrades
|
|
555
555
|
* @description watches information on multiple trades made in a market
|
|
556
|
-
* @see https://docs.
|
|
556
|
+
* @see https://docs.woox.io/#trade
|
|
557
557
|
* @param {string} symbol unified market symbol of the market trades were made in
|
|
558
558
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
559
559
|
* @param {int} [limit] the maximum number of trade structures to retrieve
|
|
@@ -743,8 +743,8 @@ class woo extends woo$1 {
|
|
|
743
743
|
/**
|
|
744
744
|
* @method
|
|
745
745
|
* @name woo#watchOrders
|
|
746
|
-
* @see https://docs.
|
|
747
|
-
* @see https://docs.
|
|
746
|
+
* @see https://docs.woox.io/#executionreport
|
|
747
|
+
* @see https://docs.woox.io/#algoexecutionreportv2
|
|
748
748
|
* @description watches information on multiple orders made by the user
|
|
749
749
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
750
750
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -778,8 +778,8 @@ class woo extends woo$1 {
|
|
|
778
778
|
/**
|
|
779
779
|
* @method
|
|
780
780
|
* @name woo#watchMyTrades
|
|
781
|
-
* @see https://docs.
|
|
782
|
-
* @see https://docs.
|
|
781
|
+
* @see https://docs.woox.io/#executionreport
|
|
782
|
+
* @see https://docs.woox.io/#algoexecutionreportv2
|
|
783
783
|
* @description watches information on multiple trades made by the user
|
|
784
784
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
785
785
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -1018,7 +1018,7 @@ class woo extends woo$1 {
|
|
|
1018
1018
|
/**
|
|
1019
1019
|
* @method
|
|
1020
1020
|
* @name woo#watchPositions
|
|
1021
|
-
* @see https://docs.
|
|
1021
|
+
* @see https://docs.woox.io/#position-push
|
|
1022
1022
|
* @description watch all open positions
|
|
1023
1023
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
1024
1024
|
* @param since
|
|
@@ -1135,7 +1135,7 @@ class woo extends woo$1 {
|
|
|
1135
1135
|
}
|
|
1136
1136
|
/**
|
|
1137
1137
|
* @method
|
|
1138
|
-
* @see https://docs.
|
|
1138
|
+
* @see https://docs.woox.io/#balance
|
|
1139
1139
|
* @name woo#watchBalance
|
|
1140
1140
|
* @description watch balance and get the amount of funds available for trading or funds locked in orders
|
|
1141
1141
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
package/dist/cjs/src/vertex.js
CHANGED