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.
Files changed (122) hide show
  1. package/README.md +8 -7
  2. package/dist/ccxt.browser.min.js +6 -6
  3. package/dist/cjs/ccxt.js +4 -1
  4. package/dist/cjs/src/abstract/ellipx.js +9 -0
  5. package/dist/cjs/src/alpaca.js +2 -0
  6. package/dist/cjs/src/base/Exchange.js +32 -6
  7. package/dist/cjs/src/binance.js +19 -14
  8. package/dist/cjs/src/bingx.js +495 -153
  9. package/dist/cjs/src/bitbank.js +5 -0
  10. package/dist/cjs/src/bitbns.js +2 -0
  11. package/dist/cjs/src/bitfinex2.js +2 -1
  12. package/dist/cjs/src/bitget.js +177 -44
  13. package/dist/cjs/src/bitmex.js +3 -1
  14. package/dist/cjs/src/bitopro.js +3 -0
  15. package/dist/cjs/src/bitrue.js +3 -2
  16. package/dist/cjs/src/btcmarkets.js +5 -3
  17. package/dist/cjs/src/btcturk.js +19 -19
  18. package/dist/cjs/src/bybit.js +14 -11
  19. package/dist/cjs/src/cex.js +13 -4
  20. package/dist/cjs/src/coinbase.js +3 -2
  21. package/dist/cjs/src/coinex.js +1 -0
  22. package/dist/cjs/src/coinone.js +7 -7
  23. package/dist/cjs/src/coinsph.js +7 -7
  24. package/dist/cjs/src/coinspot.js +39 -39
  25. package/dist/cjs/src/cryptocom.js +36 -34
  26. package/dist/cjs/src/ellipx.js +1871 -0
  27. package/dist/cjs/src/gate.js +145 -41
  28. package/dist/cjs/src/hyperliquid.js +75 -11
  29. package/dist/cjs/src/idex.js +3 -3
  30. package/dist/cjs/src/kraken.js +71 -54
  31. package/dist/cjs/src/krakenfutures.js +3 -1
  32. package/dist/cjs/src/kucoin.js +1 -1
  33. package/dist/cjs/src/okcoin.js +2 -0
  34. package/dist/cjs/src/okx.js +16 -11
  35. package/dist/cjs/src/onetrading.js +34 -396
  36. package/dist/cjs/src/paradex.js +2 -0
  37. package/dist/cjs/src/phemex.js +23 -0
  38. package/dist/cjs/src/poloniex.js +3 -1
  39. package/dist/cjs/src/poloniexfutures.js +3 -1
  40. package/dist/cjs/src/pro/bitrue.js +13 -11
  41. package/dist/cjs/src/pro/idex.js +5 -0
  42. package/dist/cjs/src/pro/probit.js +62 -68
  43. package/dist/cjs/src/pro/woo.js +15 -15
  44. package/dist/cjs/src/vertex.js +2 -0
  45. package/dist/cjs/src/woo.js +69 -69
  46. package/dist/cjs/src/xt.js +5 -5
  47. package/examples/js/cli.js +1 -1
  48. package/js/ccxt.d.ts +5 -2
  49. package/js/ccxt.js +4 -2
  50. package/js/src/abstract/bingx.d.ts +17 -0
  51. package/js/src/abstract/bitbank.d.ts +5 -0
  52. package/js/src/abstract/bitfinex2.d.ts +1 -0
  53. package/js/src/abstract/bitpanda.d.ts +0 -12
  54. package/js/src/abstract/bitrue.d.ts +3 -3
  55. package/js/src/abstract/ellipx.d.ts +28 -0
  56. package/js/src/abstract/ellipx.js +11 -0
  57. package/js/src/abstract/okx.d.ts +1 -0
  58. package/js/src/abstract/onetrading.d.ts +0 -12
  59. package/js/src/alpaca.js +2 -0
  60. package/js/src/base/Exchange.d.ts +8 -0
  61. package/js/src/base/Exchange.js +32 -6
  62. package/js/src/binance.js +19 -14
  63. package/js/src/bingx.d.ts +11 -1
  64. package/js/src/bingx.js +495 -153
  65. package/js/src/bitbank.js +5 -0
  66. package/js/src/bitbns.js +2 -0
  67. package/js/src/bitfinex2.js +2 -1
  68. package/js/src/bitget.d.ts +4 -4
  69. package/js/src/bitget.js +177 -44
  70. package/js/src/bitmex.js +3 -1
  71. package/js/src/bitopro.d.ts +1 -0
  72. package/js/src/bitopro.js +3 -0
  73. package/js/src/bitrue.js +3 -2
  74. package/js/src/btcmarkets.d.ts +1 -0
  75. package/js/src/btcmarkets.js +5 -3
  76. package/js/src/btcturk.js +19 -19
  77. package/js/src/bybit.d.ts +3 -2
  78. package/js/src/bybit.js +14 -11
  79. package/js/src/cex.d.ts +1 -0
  80. package/js/src/cex.js +13 -4
  81. package/js/src/coinbase.d.ts +2 -1
  82. package/js/src/coinbase.js +3 -2
  83. package/js/src/coinex.js +1 -0
  84. package/js/src/coinone.js +7 -7
  85. package/js/src/coinsph.js +7 -7
  86. package/js/src/coinspot.js +39 -39
  87. package/js/src/cryptocom.d.ts +1 -1
  88. package/js/src/cryptocom.js +36 -34
  89. package/js/src/ellipx.d.ts +236 -0
  90. package/js/src/ellipx.js +1874 -0
  91. package/js/src/gate.d.ts +7 -7
  92. package/js/src/gate.js +145 -41
  93. package/js/src/hyperliquid.d.ts +10 -0
  94. package/js/src/hyperliquid.js +77 -13
  95. package/js/src/idex.js +4 -4
  96. package/js/src/kraken.d.ts +11 -8
  97. package/js/src/kraken.js +71 -54
  98. package/js/src/krakenfutures.js +3 -1
  99. package/js/src/kucoin.js +1 -1
  100. package/js/src/okcoin.js +2 -0
  101. package/js/src/okx.d.ts +1 -1
  102. package/js/src/okx.js +16 -11
  103. package/js/src/onetrading.d.ts +20 -67
  104. package/js/src/onetrading.js +35 -397
  105. package/js/src/paradex.js +2 -0
  106. package/js/src/phemex.js +23 -0
  107. package/js/src/poloniex.d.ts +1 -1
  108. package/js/src/poloniex.js +3 -1
  109. package/js/src/poloniexfutures.d.ts +1 -1
  110. package/js/src/poloniexfutures.js +3 -1
  111. package/js/src/pro/bitrue.js +13 -11
  112. package/js/src/pro/idex.d.ts +5 -0
  113. package/js/src/pro/idex.js +5 -0
  114. package/js/src/pro/probit.d.ts +2 -1
  115. package/js/src/pro/probit.js +62 -68
  116. package/js/src/pro/woo.d.ts +11 -11
  117. package/js/src/pro/woo.js +15 -15
  118. package/js/src/vertex.js +2 -0
  119. package/js/src/woo.d.ts +60 -60
  120. package/js/src/woo.js +69 -69
  121. package/js/src/xt.js +5 -5
  122. package/package.json +4 -3
@@ -129,7 +129,7 @@ export default class poloniex extends Exchange {
129
129
  * @param {float} amount how much of currency you want to trade in units of base currency
130
130
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
131
131
  * @param {object} [params] extra parameters specific to the exchange API endpoint
132
- * @param {float} [params.triggerPrice] *spot only* The price at which a trigger order is triggered at
132
+ * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
133
133
  * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
134
134
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
135
135
  */
@@ -39,6 +39,8 @@ export default class poloniex extends Exchange {
39
39
  'createMarketOrderWithCost': false,
40
40
  'createMarketSellOrderWithCost': false,
41
41
  'createOrder': true,
42
+ 'createStopOrder': true,
43
+ 'createTriggerOrder': true,
42
44
  'editOrder': true,
43
45
  'fetchBalance': true,
44
46
  'fetchClosedOrder': false,
@@ -1269,7 +1271,7 @@ export default class poloniex extends Exchange {
1269
1271
  * @param {float} amount how much of currency you want to trade in units of base currency
1270
1272
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1271
1273
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1272
- * @param {float} [params.triggerPrice] *spot only* The price at which a trigger order is triggered at
1274
+ * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
1273
1275
  * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
1274
1276
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1275
1277
  */
@@ -117,7 +117,7 @@ export default class poloniexfutures extends Exchange {
117
117
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
118
118
  * @param {object} [params] extra parameters specific to the exchange API endpoint
119
119
  * @param {float} [params.leverage] Leverage size of the order
120
- * @param {float} [params.stopPrice] The price at which a trigger order is triggered at
120
+ * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
121
121
  * @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.
122
122
  * @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only
123
123
  * @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
@@ -34,6 +34,8 @@ export default class poloniexfutures extends Exchange {
34
34
  'future': false,
35
35
  'option': undefined,
36
36
  'createOrder': true,
37
+ 'createStopOrder': true,
38
+ 'createTriggerOrder': true,
37
39
  'fetchBalance': true,
38
40
  'fetchClosedOrders': true,
39
41
  'fetchCurrencies': false,
@@ -838,7 +840,7 @@ export default class poloniexfutures extends Exchange {
838
840
  * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
839
841
  * @param {object} [params] extra parameters specific to the exchange API endpoint
840
842
  * @param {float} [params.leverage] Leverage size of the order
841
- * @param {float} [params.stopPrice] The price at which a trigger order is triggered at
843
+ * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
842
844
  * @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.
843
845
  * @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only
844
846
  * @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
@@ -33,15 +33,17 @@ export default class bitrue extends bitrueRest {
33
33
  },
34
34
  'api': {
35
35
  'open': {
36
- 'private': {
37
- 'post': {
38
- 'poseidon/api/v1/listenKey': 1,
39
- },
40
- 'put': {
41
- 'poseidon/api/v1/listenKey/{listenKey}': 1,
42
- },
43
- 'delete': {
44
- 'poseidon/api/v1/listenKey/{listenKey}': 1,
36
+ 'v1': {
37
+ 'private': {
38
+ 'post': {
39
+ 'poseidon/api/v1/listenKey': 1,
40
+ },
41
+ 'put': {
42
+ 'poseidon/api/v1/listenKey/{listenKey}': 1,
43
+ },
44
+ 'delete': {
45
+ 'poseidon/api/v1/listenKey/{listenKey}': 1,
46
+ },
45
47
  },
46
48
  },
47
49
  },
@@ -414,7 +416,7 @@ export default class bitrue extends bitrueRest {
414
416
  async authenticate(params = {}) {
415
417
  const listenKey = this.safeValue(this.options, 'listenKey');
416
418
  if (listenKey === undefined) {
417
- const response = await this.openPrivatePostPoseidonApiV1ListenKey(params);
419
+ const response = await this.openV1PrivatePostPoseidonApiV1ListenKey(params);
418
420
  //
419
421
  // {
420
422
  // "msg": "succ",
@@ -439,7 +441,7 @@ export default class bitrue extends bitrueRest {
439
441
  'listenKey': listenKey,
440
442
  };
441
443
  try {
442
- await this.openPrivatePutPoseidonApiV1ListenKeyListenKey(this.extend(request, params));
444
+ await this.openV1PrivatePutPoseidonApiV1ListenKeyListenKey(this.extend(request, params));
443
445
  //
444
446
  // ಠ_ಠ
445
447
  // {
@@ -9,6 +9,7 @@ export default class idex extends idexRest {
9
9
  * @method
10
10
  * @name idex#watchTicker
11
11
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
12
+ * @see https://api-docs-v4.idex.io/#tickers
12
13
  * @param {string} symbol unified symbol of the market to fetch the ticker for
13
14
  * @param {object} [params] extra parameters specific to the exchange API endpoint
14
15
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -19,6 +20,7 @@ export default class idex extends idexRest {
19
20
  * @method
20
21
  * @name idex#watchTrades
21
22
  * @description get the list of most recent trades for a particular symbol
23
+ * @see https://api-docs-v4.idex.io/#trades
22
24
  * @param {string} symbol unified symbol of the market to fetch trades for
23
25
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
24
26
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -32,6 +34,7 @@ export default class idex extends idexRest {
32
34
  * @method
33
35
  * @name idex#watchOHLCV
34
36
  * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
37
+ * @see https://api-docs-v4.idex.io/#candles
35
38
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
36
39
  * @param {string} timeframe the length of time each candle represents
37
40
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -47,6 +50,7 @@ export default class idex extends idexRest {
47
50
  * @method
48
51
  * @name idex#watchOrderBook
49
52
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
53
+ * @see https://api-docs-v4.idex.io/#l2-order-book
50
54
  * @param {string} symbol unified symbol of the market to fetch the order book for
51
55
  * @param {int} [limit] the maximum amount of order book entries to return
52
56
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -62,6 +66,7 @@ export default class idex extends idexRest {
62
66
  * @method
63
67
  * @name idex#watchOrders
64
68
  * @description watches information on multiple orders made by the user
69
+ * @see https://api-docs-v4.idex.io/#orders
65
70
  * @param {string} symbol unified market symbol of the market orders were made in
66
71
  * @param {int} [since] the earliest time in ms to fetch orders for
67
72
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -70,6 +70,7 @@ export default class idex extends idexRest {
70
70
  * @method
71
71
  * @name idex#watchTicker
72
72
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
73
+ * @see https://api-docs-v4.idex.io/#tickers
73
74
  * @param {string} symbol unified symbol of the market to fetch the ticker for
74
75
  * @param {object} [params] extra parameters specific to the exchange API endpoint
75
76
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -142,6 +143,7 @@ export default class idex extends idexRest {
142
143
  * @method
143
144
  * @name idex#watchTrades
144
145
  * @description get the list of most recent trades for a particular symbol
146
+ * @see https://api-docs-v4.idex.io/#trades
145
147
  * @param {string} symbol unified symbol of the market to fetch trades for
146
148
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
147
149
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -236,6 +238,7 @@ export default class idex extends idexRest {
236
238
  * @method
237
239
  * @name idex#watchOHLCV
238
240
  * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
241
+ * @see https://api-docs-v4.idex.io/#candles
239
242
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
240
243
  * @param {string} timeframe the length of time each candle represents
241
244
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -406,6 +409,7 @@ export default class idex extends idexRest {
406
409
  * @method
407
410
  * @name idex#watchOrderBook
408
411
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
412
+ * @see https://api-docs-v4.idex.io/#l2-order-book
409
413
  * @param {string} symbol unified symbol of the market to fetch the order book for
410
414
  * @param {int} [limit] the maximum amount of order book entries to return
411
415
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -509,6 +513,7 @@ export default class idex extends idexRest {
509
513
  * @method
510
514
  * @name idex#watchOrders
511
515
  * @description watches information on multiple orders made by the user
516
+ * @see https://api-docs-v4.idex.io/#orders
512
517
  * @param {string} symbol unified market symbol of the market orders were made in
513
518
  * @param {int} [since] the earliest time in ms to fetch orders for
514
519
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -78,7 +78,8 @@ export default class probit extends probitRest {
78
78
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
79
79
  */
80
80
  watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
81
- subscribeOrderBook(symbol: string, messageHash: any, filter: any, params?: {}): Promise<any>;
81
+ subscribePrivate(messageHash: any, channel: any, params: any): Promise<any>;
82
+ subscribePublic(methodName: string, symbol: string, dataType: any, filter: any, params?: {}): Promise<any>;
82
83
  handleOrderBook(client: Client, message: any, orderBook: any): void;
83
84
  handleBidAsks(bookSide: any, bidAsks: any): void;
84
85
  handleDelta(orderbook: any, delta: any): void;
@@ -37,15 +37,6 @@ export default class probit extends probitRest {
37
37
  'filter': 'order_books_l2',
38
38
  'interval': 100, // or 500
39
39
  },
40
- 'watchTrades': {
41
- 'filter': 'recent_trades',
42
- },
43
- 'watchTicker': {
44
- 'filter': 'ticker',
45
- },
46
- 'watchOrders': {
47
- 'channel': 'open_order',
48
- },
49
40
  },
50
41
  'streaming': {},
51
42
  });
@@ -61,13 +52,7 @@ export default class probit extends probitRest {
61
52
  async watchBalance(params = {}) {
62
53
  await this.authenticate(params);
63
54
  const messageHash = 'balance';
64
- const url = this.urls['api']['ws'];
65
- const subscribe = {
66
- 'type': 'subscribe',
67
- 'channel': 'balance',
68
- };
69
- const request = this.extend(subscribe, params);
70
- return await this.watch(url, messageHash, request, messageHash);
55
+ return await this.subscribePrivate(messageHash, 'balance', params);
71
56
  }
72
57
  handleBalance(client, message) {
73
58
  //
@@ -127,9 +112,8 @@ export default class probit extends probitRest {
127
112
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
128
113
  */
129
114
  async watchTicker(symbol, params = {}) {
130
- let filter = undefined;
131
- [filter, params] = this.handleOptionAndParams(params, 'watchTicker', 'filter', 'ticker');
132
- return await this.subscribeOrderBook(symbol, 'ticker', filter, params);
115
+ const channel = 'ticker';
116
+ return await this.subscribePublic('watchTicker', symbol, 'ticker', channel, params);
133
117
  }
134
118
  handleTicker(client, message) {
135
119
  //
@@ -172,9 +156,8 @@ export default class probit extends probitRest {
172
156
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
173
157
  */
174
158
  async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
175
- let filter = undefined;
176
- [filter, params] = this.handleOptionAndParams(params, 'watchTrades', 'filter', 'recent_trades');
177
- const trades = await this.subscribeOrderBook(symbol, 'trades', filter, params);
159
+ const channel = 'recent_trades';
160
+ const trades = await this.subscribePublic('watchTrades', symbol, 'trades', channel, params);
178
161
  if (this.newUpdates) {
179
162
  limit = trades.getLimit(symbol, limit);
180
163
  }
@@ -205,10 +188,12 @@ export default class probit extends probitRest {
205
188
  const symbol = this.safeSymbol(marketId);
206
189
  const market = this.safeMarket(marketId);
207
190
  const trades = this.safeValue(message, 'recent_trades', []);
208
- const reset = this.safeBool(message, 'reset', false);
191
+ if (this.safeBool(message, 'reset', false)) {
192
+ return; // see comment in handleMessage
193
+ }
209
194
  const messageHash = 'trades:' + symbol;
210
195
  let stored = this.safeValue(this.trades, symbol);
211
- if (stored === undefined || reset) {
196
+ if (stored === undefined) {
212
197
  const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
213
198
  stored = new ArrayCache(limit);
214
199
  this.trades[symbol] = stored;
@@ -235,20 +220,12 @@ export default class probit extends probitRest {
235
220
  async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
236
221
  await this.loadMarkets();
237
222
  await this.authenticate(params);
238
- let messageHash = 'myTrades';
223
+ let messageHash = 'trades';
239
224
  if (symbol !== undefined) {
240
- const market = this.market(symbol);
241
- symbol = market['symbol'];
225
+ symbol = this.safeSymbol(symbol);
242
226
  messageHash = messageHash + ':' + symbol;
243
227
  }
244
- const url = this.urls['api']['ws'];
245
- const channel = 'trade_history';
246
- const message = {
247
- 'type': 'subscribe',
248
- 'channel': channel,
249
- };
250
- const request = this.extend(message, params);
251
- const trades = await this.watch(url, messageHash, request, channel);
228
+ const trades = await this.subscribePrivate(messageHash, 'trade_history', params);
252
229
  if (this.newUpdates) {
253
230
  limit = trades.getLimit(symbol, limit);
254
231
  }
@@ -279,10 +256,12 @@ export default class probit extends probitRest {
279
256
  if (length === 0) {
280
257
  return;
281
258
  }
282
- const reset = this.safeBool(message, 'reset', false);
283
- const messageHash = 'myTrades';
259
+ if (this.safeBool(message, 'reset', false)) {
260
+ return; // see comment in handleMessage
261
+ }
262
+ const messageHash = 'trades';
284
263
  let stored = this.myTrades;
285
- if ((stored === undefined) || reset) {
264
+ if (stored === undefined) {
286
265
  const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
287
266
  stored = new ArrayCacheBySymbolById(limit);
288
267
  this.myTrades = stored;
@@ -291,10 +270,18 @@ export default class probit extends probitRest {
291
270
  const tradeSymbols = {};
292
271
  for (let j = 0; j < trades.length; j++) {
293
272
  const trade = trades[j];
273
+ // don't include 'executed' state, because it's just blanket state of the trade, emited before actual trade event
274
+ if (this.safeString(trade['info'], 'status') === 'executed') {
275
+ continue;
276
+ }
294
277
  tradeSymbols[trade['symbol']] = true;
295
278
  stored.append(trade);
296
279
  }
297
280
  const unique = Object.keys(tradeSymbols);
281
+ const uniqueLength = unique.length;
282
+ if (uniqueLength === 0) {
283
+ return;
284
+ }
298
285
  for (let i = 0; i < unique.length; i++) {
299
286
  const symbol = unique[i];
300
287
  const symbolSpecificMessageHash = messageHash + ':' + symbol;
@@ -316,21 +303,12 @@ export default class probit extends probitRest {
316
303
  */
317
304
  async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
318
305
  await this.authenticate(params);
319
- const url = this.urls['api']['ws'];
320
306
  let messageHash = 'orders';
321
307
  if (symbol !== undefined) {
322
- const market = this.market(symbol);
323
- symbol = market['symbol'];
308
+ symbol = this.safeSymbol(symbol);
324
309
  messageHash = messageHash + ':' + symbol;
325
310
  }
326
- let channel = undefined;
327
- [channel, params] = this.handleOptionAndParams(params, 'watchOrders', 'channel', 'open_order');
328
- const subscribe = {
329
- 'type': 'subscribe',
330
- 'channel': channel,
331
- };
332
- const request = this.extend(subscribe, params);
333
- const orders = await this.watch(url, messageHash, request, channel);
311
+ const orders = await this.subscribePrivate(messageHash, 'open_order', params);
334
312
  if (this.newUpdates) {
335
313
  limit = orders.getLimit(symbol, limit);
336
314
  }
@@ -400,41 +378,51 @@ export default class probit extends probitRest {
400
378
  * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
401
379
  */
402
380
  async watchOrderBook(symbol, limit = undefined, params = {}) {
403
- let filter = undefined;
404
- [filter, params] = this.handleOptionAndParams(params, 'watchOrderBook', 'filter', 'order_books');
405
- const orderbook = await this.subscribeOrderBook(symbol, 'orderbook', filter, params);
381
+ let channel = undefined;
382
+ [channel, params] = this.handleOptionAndParams(params, 'watchOrderBook', 'filter', 'order_books');
383
+ const orderbook = await this.subscribePublic('watchOrderBook', symbol, 'orderbook', channel, params);
406
384
  return orderbook.limit();
407
385
  }
408
- async subscribeOrderBook(symbol, messageHash, filter, params = {}) {
386
+ async subscribePrivate(messageHash, channel, params) {
387
+ const url = this.urls['api']['ws'];
388
+ const subscribe = {
389
+ 'type': 'subscribe',
390
+ 'channel': channel,
391
+ };
392
+ const request = this.extend(subscribe, params);
393
+ const subscribeHash = messageHash;
394
+ return await this.watch(url, messageHash, request, subscribeHash);
395
+ }
396
+ async subscribePublic(methodName, symbol, dataType, filter, params = {}) {
409
397
  await this.loadMarkets();
410
398
  const market = this.market(symbol);
411
399
  symbol = market['symbol'];
412
400
  const url = this.urls['api']['ws'];
413
401
  const client = this.client(url);
414
- let interval = undefined;
415
- [interval, params] = this.handleOptionAndParams(params, 'watchOrderBook', 'interval', 100);
416
- const subscriptionHash = 'marketdata:' + symbol;
417
- messageHash = messageHash + ':' + symbol;
402
+ const subscribeHash = 'marketdata:' + symbol;
403
+ const messageHash = dataType + ':' + symbol;
418
404
  let filters = {};
419
- if (subscriptionHash in client.subscriptions) {
405
+ if (subscribeHash in client.subscriptions) {
420
406
  // already subscribed
421
- filters = client.subscriptions[subscriptionHash];
407
+ filters = client.subscriptions[subscribeHash];
422
408
  if (!(filter in filters)) {
423
409
  // resubscribe
424
- delete client.subscriptions[subscriptionHash];
410
+ delete client.subscriptions[subscribeHash];
425
411
  }
426
412
  }
427
413
  filters[filter] = true;
428
414
  const keys = Object.keys(filters);
429
- const message = {
415
+ let interval = undefined;
416
+ [interval, params] = this.handleOptionAndParams(params, methodName, 'interval', 100);
417
+ let request = {
418
+ 'type': 'subscribe',
430
419
  'channel': 'marketdata',
431
- 'interval': interval,
432
420
  'market_id': market['id'],
433
- 'type': 'subscribe',
434
421
  'filter': keys,
422
+ 'interval': interval,
435
423
  };
436
- const request = this.extend(message, params);
437
- return await this.watch(url, messageHash, request, messageHash, filters);
424
+ request = this.extend(request, params);
425
+ return await this.watch(url, messageHash, request, subscribeHash, filters);
438
426
  }
439
427
  handleOrderBook(client, message, orderBook) {
440
428
  //
@@ -513,7 +501,8 @@ export default class probit extends probitRest {
513
501
  const result = this.safeString(message, 'result');
514
502
  const future = client.subscriptions['authenticated'];
515
503
  if (result === 'ok') {
516
- future.resolve(true);
504
+ const messageHash = 'authenticated';
505
+ client.resolve(message, messageHash);
517
506
  }
518
507
  else {
519
508
  future.reject(message);
@@ -526,11 +515,13 @@ export default class probit extends probitRest {
526
515
  this.handleTicker(client, message);
527
516
  }
528
517
  const trades = this.safeValue(message, 'recent_trades', []);
529
- if (trades.length) {
518
+ const tradesLength = trades.length;
519
+ if (tradesLength) {
530
520
  this.handleTrades(client, message);
531
521
  }
532
522
  const orderBook = this.safeValueN(message, ['order_books', 'order_books_l1', 'order_books_l2', 'order_books_l3', 'order_books_l4'], []);
533
- if (orderBook.length) {
523
+ const orderBookLength = orderBook.length;
524
+ if (orderBookLength) {
534
525
  this.handleOrderBook(client, message, orderBook);
535
526
  }
536
527
  }
@@ -544,6 +535,9 @@ export default class probit extends probitRest {
544
535
  // }
545
536
  // }
546
537
  //
538
+ // Note about 'reset' field
539
+ // 'reset': true field - it happens once after initial subscription, which just returns old items by the moment of subscription (like "fetchMyTrades" does)
540
+ //
547
541
  const errorCode = this.safeString(message, 'errorCode');
548
542
  if (errorCode !== undefined) {
549
543
  this.handleErrorMessage(client, message);
@@ -8,8 +8,8 @@ export default class woo extends wooRest {
8
8
  /**
9
9
  * @method
10
10
  * @name woo#watchOrderBook
11
- * @see https://docs.woo.org/#orderbookupdate
12
- * @see https://docs.woo.org/#orderbook
11
+ * @see https://docs.woox.io/#orderbookupdate
12
+ * @see https://docs.woox.io/#orderbook
13
13
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
14
14
  * @param {string} symbol unified symbol of the market to fetch the order book for
15
15
  * @param {int} [limit] the maximum amount of order book entries to return.
@@ -38,7 +38,7 @@ export default class woo extends wooRest {
38
38
  /**
39
39
  * @method
40
40
  * @name woo#watchTickers
41
- * @see https://docs.woo.org/#24h-tickers
41
+ * @see https://docs.woox.io/#24h-tickers
42
42
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
43
43
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
44
44
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -62,7 +62,7 @@ export default class woo extends wooRest {
62
62
  * @method
63
63
  * @name woo#watchOHLCV
64
64
  * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
65
- * @see https://docs.woo.org/#k-line
65
+ * @see https://docs.woox.io/#k-line
66
66
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
67
67
  * @param {string} timeframe the length of time each candle represents
68
68
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -76,7 +76,7 @@ export default class woo extends wooRest {
76
76
  * @method
77
77
  * @name woo#watchTrades
78
78
  * @description watches information on multiple trades made in a market
79
- * @see https://docs.woo.org/#trade
79
+ * @see https://docs.woox.io/#trade
80
80
  * @param {string} symbol unified market symbol of the market trades were made in
81
81
  * @param {int} [since] the earliest time in ms to fetch trades for
82
82
  * @param {int} [limit] the maximum number of trade structures to retrieve
@@ -93,8 +93,8 @@ export default class woo extends wooRest {
93
93
  /**
94
94
  * @method
95
95
  * @name woo#watchOrders
96
- * @see https://docs.woo.org/#executionreport
97
- * @see https://docs.woo.org/#algoexecutionreportv2
96
+ * @see https://docs.woox.io/#executionreport
97
+ * @see https://docs.woox.io/#algoexecutionreportv2
98
98
  * @description watches information on multiple orders made by the user
99
99
  * @param {string} symbol unified market symbol of the market orders were made in
100
100
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -107,8 +107,8 @@ export default class woo extends wooRest {
107
107
  /**
108
108
  * @method
109
109
  * @name woo#watchMyTrades
110
- * @see https://docs.woo.org/#executionreport
111
- * @see https://docs.woo.org/#algoexecutionreportv2
110
+ * @see https://docs.woox.io/#executionreport
111
+ * @see https://docs.woox.io/#algoexecutionreportv2
112
112
  * @description watches information on multiple trades made by the user
113
113
  * @param {string} symbol unified market symbol of the market orders were made in
114
114
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -125,7 +125,7 @@ export default class woo extends wooRest {
125
125
  /**
126
126
  * @method
127
127
  * @name woo#watchPositions
128
- * @see https://docs.woo.org/#position-push
128
+ * @see https://docs.woox.io/#position-push
129
129
  * @description watch all open positions
130
130
  * @param {string[]|undefined} symbols list of unified market symbols
131
131
  * @param since
@@ -139,7 +139,7 @@ export default class woo extends wooRest {
139
139
  handlePositions(client: any, message: any): void;
140
140
  /**
141
141
  * @method
142
- * @see https://docs.woo.org/#balance
142
+ * @see https://docs.woox.io/#balance
143
143
  * @name woo#watchBalance
144
144
  * @description watch balance and get the amount of funds available for trading or funds locked in orders
145
145
  * @param {object} [params] extra parameters specific to the exchange API endpoint
package/js/src/pro/woo.js CHANGED
@@ -31,14 +31,14 @@ export default class woo extends wooRest {
31
31
  'urls': {
32
32
  'api': {
33
33
  'ws': {
34
- 'public': 'wss://wss.woo.org/ws/stream',
35
- 'private': 'wss://wss.woo.org/v2/ws/private/stream',
34
+ 'public': 'wss://wss.woox.io/ws/stream',
35
+ 'private': 'wss://wss.woox.io/v2/ws/private/stream',
36
36
  },
37
37
  },
38
38
  'test': {
39
39
  'ws': {
40
- 'public': 'wss://wss.staging.woo.org/ws/stream',
41
- 'private': 'wss://wss.staging.woo.org/v2/ws/private/stream',
40
+ 'public': 'wss://wss.staging.woox.io/ws/stream',
41
+ 'private': 'wss://wss.staging.woox.io/v2/ws/private/stream',
42
42
  },
43
43
  },
44
44
  },
@@ -89,8 +89,8 @@ export default class woo extends wooRest {
89
89
  /**
90
90
  * @method
91
91
  * @name woo#watchOrderBook
92
- * @see https://docs.woo.org/#orderbookupdate
93
- * @see https://docs.woo.org/#orderbook
92
+ * @see https://docs.woox.io/#orderbookupdate
93
+ * @see https://docs.woox.io/#orderbook
94
94
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
95
95
  * @param {string} symbol unified symbol of the market to fetch the order book for
96
96
  * @param {int} [limit] the maximum amount of order book entries to return.
@@ -343,7 +343,7 @@ export default class woo extends wooRest {
343
343
  /**
344
344
  * @method
345
345
  * @name woo#watchTickers
346
- * @see https://docs.woo.org/#24h-tickers
346
+ * @see https://docs.woox.io/#24h-tickers
347
347
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
348
348
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
349
349
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -480,7 +480,7 @@ export default class woo extends wooRest {
480
480
  * @method
481
481
  * @name woo#watchOHLCV
482
482
  * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
483
- * @see https://docs.woo.org/#k-line
483
+ * @see https://docs.woox.io/#k-line
484
484
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
485
485
  * @param {string} timeframe the length of time each candle represents
486
486
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -556,7 +556,7 @@ export default class woo extends wooRest {
556
556
  * @method
557
557
  * @name woo#watchTrades
558
558
  * @description watches information on multiple trades made in a market
559
- * @see https://docs.woo.org/#trade
559
+ * @see https://docs.woox.io/#trade
560
560
  * @param {string} symbol unified market symbol of the market trades were made in
561
561
  * @param {int} [since] the earliest time in ms to fetch trades for
562
562
  * @param {int} [limit] the maximum number of trade structures to retrieve
@@ -746,8 +746,8 @@ export default class woo extends wooRest {
746
746
  /**
747
747
  * @method
748
748
  * @name woo#watchOrders
749
- * @see https://docs.woo.org/#executionreport
750
- * @see https://docs.woo.org/#algoexecutionreportv2
749
+ * @see https://docs.woox.io/#executionreport
750
+ * @see https://docs.woox.io/#algoexecutionreportv2
751
751
  * @description watches information on multiple orders made by the user
752
752
  * @param {string} symbol unified market symbol of the market orders were made in
753
753
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -781,8 +781,8 @@ export default class woo extends wooRest {
781
781
  /**
782
782
  * @method
783
783
  * @name woo#watchMyTrades
784
- * @see https://docs.woo.org/#executionreport
785
- * @see https://docs.woo.org/#algoexecutionreportv2
784
+ * @see https://docs.woox.io/#executionreport
785
+ * @see https://docs.woox.io/#algoexecutionreportv2
786
786
  * @description watches information on multiple trades made by the user
787
787
  * @param {string} symbol unified market symbol of the market orders were made in
788
788
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -1021,7 +1021,7 @@ export default class woo extends wooRest {
1021
1021
  /**
1022
1022
  * @method
1023
1023
  * @name woo#watchPositions
1024
- * @see https://docs.woo.org/#position-push
1024
+ * @see https://docs.woox.io/#position-push
1025
1025
  * @description watch all open positions
1026
1026
  * @param {string[]|undefined} symbols list of unified market symbols
1027
1027
  * @param since
@@ -1138,7 +1138,7 @@ export default class woo extends wooRest {
1138
1138
  }
1139
1139
  /**
1140
1140
  * @method
1141
- * @see https://docs.woo.org/#balance
1141
+ * @see https://docs.woox.io/#balance
1142
1142
  * @name woo#watchBalance
1143
1143
  * @description watch balance and get the amount of funds available for trading or funds locked in orders
1144
1144
  * @param {object} [params] extra parameters specific to the exchange API endpoint
package/js/src/vertex.js CHANGED
@@ -51,6 +51,8 @@ export default class vertex extends Exchange {
51
51
  'createOrder': true,
52
52
  'createOrders': true,
53
53
  'createReduceOnlyOrder': true,
54
+ 'createStopOrder': true,
55
+ 'createTriggerOrder': true,
54
56
  'editOrder': false,
55
57
  'fetchAccounts': false,
56
58
  'fetchBalance': true,