ccxt 4.2.31 → 4.2.34

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 (298) hide show
  1. package/.gitattributes +1 -0
  2. package/CONTRIBUTING.md +20 -1
  3. package/README.md +8 -7
  4. package/build.sh +9 -2
  5. package/cleanup.sh +3 -0
  6. package/dist/ccxt.browser.js +639 -483
  7. package/dist/ccxt.browser.min.js +3 -3
  8. package/dist/cjs/ccxt.js +1 -1
  9. package/dist/cjs/src/ace.js +3 -2
  10. package/dist/cjs/src/ascendex.js +1 -1
  11. package/dist/cjs/src/base/Exchange.js +54 -20
  12. package/dist/cjs/src/bigone.js +21 -1
  13. package/dist/cjs/src/binance.js +5 -4
  14. package/dist/cjs/src/bingx.js +4 -3
  15. package/dist/cjs/src/bit2c.js +12 -0
  16. package/dist/cjs/src/bitget.js +3 -3
  17. package/dist/cjs/src/bitmart.js +1 -1
  18. package/dist/cjs/src/bitrue.js +3 -3
  19. package/dist/cjs/src/blockchaincom.js +1 -1
  20. package/dist/cjs/src/bybit.js +1 -1
  21. package/dist/cjs/src/coinbase.js +2 -2
  22. package/dist/cjs/src/coinex.js +1 -1
  23. package/dist/cjs/src/cryptocom.js +10 -10
  24. package/dist/cjs/src/gate.js +34 -29
  25. package/dist/cjs/src/kraken.js +39 -0
  26. package/dist/cjs/src/kucoin.js +1 -1
  27. package/dist/cjs/src/mexc.js +2 -1
  28. package/dist/cjs/src/okx.js +4 -3
  29. package/dist/cjs/src/phemex.js +8 -8
  30. package/dist/cjs/src/pro/alpaca.js +8 -4
  31. package/dist/cjs/src/pro/ascendex.js +1 -2
  32. package/dist/cjs/src/pro/binance.js +14 -10
  33. package/dist/cjs/src/pro/bingx.js +1 -1
  34. package/dist/cjs/src/pro/bitfinex.js +21 -24
  35. package/dist/cjs/src/pro/bitfinex2.js +13 -17
  36. package/dist/cjs/src/pro/bitget.js +3 -1
  37. package/dist/cjs/src/pro/bitmart.js +3 -8
  38. package/dist/cjs/src/pro/bitmex.js +4 -7
  39. package/dist/cjs/src/pro/bitopro.js +2 -5
  40. package/dist/cjs/src/pro/bitrue.js +1 -1
  41. package/dist/cjs/src/pro/bitstamp.js +2 -3
  42. package/dist/cjs/src/pro/bitvavo.js +12 -5
  43. package/dist/cjs/src/pro/blockchaincom.js +22 -23
  44. package/dist/cjs/src/pro/bybit.js +5 -5
  45. package/dist/cjs/src/pro/cex.js +7 -7
  46. package/dist/cjs/src/pro/coinbase.js +3 -2
  47. package/dist/cjs/src/pro/coinbasepro.js +1 -1
  48. package/dist/cjs/src/pro/coinex.js +15 -13
  49. package/dist/cjs/src/pro/currencycom.js +5 -7
  50. package/dist/cjs/src/pro/deribit.js +4 -4
  51. package/dist/cjs/src/pro/exmo.js +15 -13
  52. package/dist/cjs/src/pro/gate.js +1 -1
  53. package/dist/cjs/src/pro/gemini.js +4 -2
  54. package/dist/cjs/src/pro/hitbtc.js +9 -8
  55. package/dist/cjs/src/pro/hollaex.js +2 -2
  56. package/dist/cjs/src/pro/htx.js +6 -7
  57. package/dist/cjs/src/pro/huobijp.js +3 -5
  58. package/dist/cjs/src/pro/idex.js +1 -1
  59. package/dist/cjs/src/pro/independentreserve.js +14 -13
  60. package/dist/cjs/src/pro/kraken.js +10 -16
  61. package/dist/cjs/src/pro/krakenfutures.js +10 -6
  62. package/dist/cjs/src/pro/kucoin.js +10 -11
  63. package/dist/cjs/src/pro/kucoinfutures.js +12 -11
  64. package/dist/cjs/src/pro/lbank.js +10 -10
  65. package/dist/cjs/src/pro/luno.js +12 -14
  66. package/dist/cjs/src/pro/mexc.js +3 -2
  67. package/dist/cjs/src/pro/ndax.js +7 -13
  68. package/dist/cjs/src/pro/okcoin.js +7 -12
  69. package/dist/cjs/src/pro/okx.js +6 -11
  70. package/dist/cjs/src/pro/onetrading.js +16 -15
  71. package/dist/cjs/src/pro/p2b.js +5 -3
  72. package/dist/cjs/src/pro/phemex.js +16 -11
  73. package/dist/cjs/src/pro/poloniex.js +6 -4
  74. package/dist/cjs/src/pro/poloniexfutures.js +14 -9
  75. package/dist/cjs/src/pro/probit.js +15 -11
  76. package/dist/cjs/src/pro/upbit.js +8 -8
  77. package/dist/cjs/src/pro/wazirx.js +6 -3
  78. package/dist/cjs/src/pro/woo.js +8 -6
  79. package/dist/cjs/src/probit.js +3 -3
  80. package/dist/cjs/src/tokocrypto.js +2 -2
  81. package/dist/cjs/src/wavesexchange.js +2 -1
  82. package/dist/cjs/src/woo.js +1 -1
  83. package/dist/cjs/src/yobit.js +39 -0
  84. package/js/ccxt.d.ts +1 -1
  85. package/js/ccxt.js +1 -1
  86. package/js/src/ace.d.ts +1 -1
  87. package/js/src/ace.js +3 -2
  88. package/js/src/alpaca.d.ts +1 -1
  89. package/js/src/ascendex.d.ts +5 -15
  90. package/js/src/ascendex.js +1 -1
  91. package/js/src/base/Exchange.d.ts +87 -78
  92. package/js/src/base/Exchange.js +54 -20
  93. package/js/src/base/types.d.ts +90 -6
  94. package/js/src/bigone.d.ts +5 -15
  95. package/js/src/bigone.js +21 -1
  96. package/js/src/binance.d.ts +13 -23
  97. package/js/src/binance.js +5 -4
  98. package/js/src/bingx.d.ts +6 -16
  99. package/js/src/bingx.js +4 -3
  100. package/js/src/bit2c.d.ts +1 -1
  101. package/js/src/bit2c.js +12 -0
  102. package/js/src/bitbank.d.ts +2 -2
  103. package/js/src/bitbns.d.ts +1 -1
  104. package/js/src/bitfinex.d.ts +5 -5
  105. package/js/src/bitfinex2.d.ts +7 -17
  106. package/js/src/bitflyer.d.ts +5 -5
  107. package/js/src/bitforex.d.ts +1 -1
  108. package/js/src/bitget.d.ts +8 -38
  109. package/js/src/bitget.js +3 -3
  110. package/js/src/bithumb.d.ts +2 -2
  111. package/js/src/bitmart.d.ts +10 -21
  112. package/js/src/bitmart.js +1 -1
  113. package/js/src/bitmex.d.ts +3 -3
  114. package/js/src/bitopro.d.ts +2 -2
  115. package/js/src/bitrue.d.ts +5 -15
  116. package/js/src/bitrue.js +3 -3
  117. package/js/src/bitso.d.ts +4 -4
  118. package/js/src/bitstamp.d.ts +2 -2
  119. package/js/src/bitteam.d.ts +1 -1
  120. package/js/src/bitvavo.d.ts +3 -3
  121. package/js/src/bl3p.d.ts +1 -1
  122. package/js/src/blockchaincom.d.ts +2 -2
  123. package/js/src/blockchaincom.js +1 -1
  124. package/js/src/btcalpha.d.ts +1 -1
  125. package/js/src/btcbox.d.ts +1 -1
  126. package/js/src/btcmarkets.d.ts +3 -3
  127. package/js/src/btcturk.d.ts +1 -1
  128. package/js/src/bybit.d.ts +8 -8
  129. package/js/src/bybit.js +1 -1
  130. package/js/src/cex.d.ts +1 -1
  131. package/js/src/coinbase.d.ts +6 -50
  132. package/js/src/coinbase.js +2 -2
  133. package/js/src/coinbasepro.d.ts +2 -2
  134. package/js/src/coincheck.d.ts +1 -1
  135. package/js/src/coinex.d.ts +8 -8
  136. package/js/src/coinex.js +1 -1
  137. package/js/src/coinlist.d.ts +4 -14
  138. package/js/src/coinmate.d.ts +2 -2
  139. package/js/src/coinmetro.d.ts +2 -2
  140. package/js/src/coinone.d.ts +1 -1
  141. package/js/src/coinsph.d.ts +2 -2
  142. package/js/src/coinspot.d.ts +1 -1
  143. package/js/src/cryptocom.d.ts +4 -4
  144. package/js/src/cryptocom.js +10 -10
  145. package/js/src/currencycom.d.ts +2 -2
  146. package/js/src/delta.d.ts +2 -2
  147. package/js/src/deribit.d.ts +4 -14
  148. package/js/src/digifinex.d.ts +10 -38
  149. package/js/src/exmo.d.ts +2 -2
  150. package/js/src/gate.d.ts +8 -18
  151. package/js/src/gate.js +34 -29
  152. package/js/src/gemini.d.ts +2 -2
  153. package/js/src/hitbtc.d.ts +6 -16
  154. package/js/src/hollaex.d.ts +2 -2
  155. package/js/src/htx.d.ts +11 -21
  156. package/js/src/huobijp.d.ts +4 -4
  157. package/js/src/idex.d.ts +3 -3
  158. package/js/src/independentreserve.d.ts +2 -2
  159. package/js/src/indodax.d.ts +2 -2
  160. package/js/src/kraken.d.ts +5 -5
  161. package/js/src/kraken.js +39 -0
  162. package/js/src/krakenfutures.d.ts +7 -7
  163. package/js/src/kucoin.d.ts +8 -29
  164. package/js/src/kucoin.js +1 -1
  165. package/js/src/kucoinfutures.d.ts +4 -4
  166. package/js/src/kuna.d.ts +2 -2
  167. package/js/src/latoken.d.ts +4 -14
  168. package/js/src/lbank.d.ts +2 -5
  169. package/js/src/luno.d.ts +1 -1
  170. package/js/src/lykke.d.ts +2 -2
  171. package/js/src/mercado.d.ts +2 -2
  172. package/js/src/mexc.d.ts +6 -6
  173. package/js/src/mexc.js +2 -1
  174. package/js/src/ndax.d.ts +2 -2
  175. package/js/src/novadax.d.ts +4 -15
  176. package/js/src/oceanex.d.ts +1 -1
  177. package/js/src/okcoin.d.ts +5 -15
  178. package/js/src/okx.d.ts +8 -18
  179. package/js/src/okx.js +4 -3
  180. package/js/src/onetrading.d.ts +2 -2
  181. package/js/src/p2b.d.ts +1 -1
  182. package/js/src/paymium.d.ts +3 -13
  183. package/js/src/phemex.d.ts +5 -5
  184. package/js/src/phemex.js +8 -8
  185. package/js/src/poloniex.d.ts +4 -14
  186. package/js/src/poloniexfutures.d.ts +1 -1
  187. package/js/src/pro/alpaca.d.ts +2 -2
  188. package/js/src/pro/alpaca.js +8 -4
  189. package/js/src/pro/ascendex.d.ts +2 -2
  190. package/js/src/pro/ascendex.js +1 -2
  191. package/js/src/pro/binance.d.ts +3 -3
  192. package/js/src/pro/binance.js +14 -10
  193. package/js/src/pro/bingx.d.ts +1 -1
  194. package/js/src/pro/bingx.js +1 -1
  195. package/js/src/pro/bitfinex.d.ts +2 -2
  196. package/js/src/pro/bitfinex.js +21 -24
  197. package/js/src/pro/bitfinex2.d.ts +2 -2
  198. package/js/src/pro/bitfinex2.js +13 -17
  199. package/js/src/pro/bitget.js +3 -1
  200. package/js/src/pro/bitmart.d.ts +3 -3
  201. package/js/src/pro/bitmart.js +3 -8
  202. package/js/src/pro/bitmex.d.ts +1 -1
  203. package/js/src/pro/bitmex.js +4 -7
  204. package/js/src/pro/bitopro.d.ts +1 -1
  205. package/js/src/pro/bitopro.js +2 -5
  206. package/js/src/pro/bitrue.js +1 -1
  207. package/js/src/pro/bitstamp.d.ts +1 -1
  208. package/js/src/pro/bitstamp.js +2 -3
  209. package/js/src/pro/bitvavo.d.ts +3 -3
  210. package/js/src/pro/bitvavo.js +12 -5
  211. package/js/src/pro/blockchaincom.d.ts +8 -8
  212. package/js/src/pro/blockchaincom.js +22 -23
  213. package/js/src/pro/bybit.d.ts +2 -2
  214. package/js/src/pro/bybit.js +5 -5
  215. package/js/src/pro/cex.d.ts +1 -1
  216. package/js/src/pro/cex.js +7 -7
  217. package/js/src/pro/coinbase.d.ts +1 -1
  218. package/js/src/pro/coinbase.js +3 -2
  219. package/js/src/pro/coinbasepro.d.ts +1 -1
  220. package/js/src/pro/coinbasepro.js +1 -1
  221. package/js/src/pro/coinex.d.ts +2 -2
  222. package/js/src/pro/coinex.js +15 -13
  223. package/js/src/pro/currencycom.d.ts +1 -1
  224. package/js/src/pro/currencycom.js +5 -7
  225. package/js/src/pro/deribit.d.ts +2 -2
  226. package/js/src/pro/deribit.js +4 -4
  227. package/js/src/pro/exmo.d.ts +2 -2
  228. package/js/src/pro/exmo.js +15 -13
  229. package/js/src/pro/gate.js +1 -1
  230. package/js/src/pro/gemini.d.ts +1 -1
  231. package/js/src/pro/gemini.js +4 -2
  232. package/js/src/pro/hitbtc.d.ts +2 -2
  233. package/js/src/pro/hitbtc.js +9 -8
  234. package/js/src/pro/hollaex.d.ts +2 -2
  235. package/js/src/pro/hollaex.js +2 -2
  236. package/js/src/pro/htx.d.ts +2 -2
  237. package/js/src/pro/htx.js +6 -7
  238. package/js/src/pro/huobijp.d.ts +1 -1
  239. package/js/src/pro/huobijp.js +3 -5
  240. package/js/src/pro/idex.js +1 -1
  241. package/js/src/pro/independentreserve.d.ts +1 -1
  242. package/js/src/pro/independentreserve.js +14 -13
  243. package/js/src/pro/kraken.d.ts +2 -2
  244. package/js/src/pro/kraken.js +10 -16
  245. package/js/src/pro/krakenfutures.d.ts +1 -1
  246. package/js/src/pro/krakenfutures.js +10 -6
  247. package/js/src/pro/kucoin.d.ts +3 -3
  248. package/js/src/pro/kucoin.js +10 -11
  249. package/js/src/pro/kucoinfutures.d.ts +3 -3
  250. package/js/src/pro/kucoinfutures.js +12 -11
  251. package/js/src/pro/lbank.d.ts +1 -1
  252. package/js/src/pro/lbank.js +10 -10
  253. package/js/src/pro/luno.d.ts +2 -2
  254. package/js/src/pro/luno.js +12 -14
  255. package/js/src/pro/mexc.d.ts +2 -2
  256. package/js/src/pro/mexc.js +3 -2
  257. package/js/src/pro/ndax.d.ts +3 -3
  258. package/js/src/pro/ndax.js +7 -13
  259. package/js/src/pro/okcoin.d.ts +1 -1
  260. package/js/src/pro/okcoin.js +7 -12
  261. package/js/src/pro/okx.d.ts +1 -1
  262. package/js/src/pro/okx.js +6 -11
  263. package/js/src/pro/onetrading.d.ts +1 -1
  264. package/js/src/pro/onetrading.js +16 -15
  265. package/js/src/pro/p2b.d.ts +1 -1
  266. package/js/src/pro/p2b.js +5 -3
  267. package/js/src/pro/phemex.d.ts +3 -3
  268. package/js/src/pro/phemex.js +16 -11
  269. package/js/src/pro/poloniex.d.ts +1 -1
  270. package/js/src/pro/poloniex.js +6 -4
  271. package/js/src/pro/poloniexfutures.d.ts +4 -4
  272. package/js/src/pro/poloniexfutures.js +13 -10
  273. package/js/src/pro/probit.d.ts +1 -1
  274. package/js/src/pro/probit.js +14 -12
  275. package/js/src/pro/upbit.js +8 -8
  276. package/js/src/pro/wazirx.d.ts +1 -1
  277. package/js/src/pro/wazirx.js +6 -3
  278. package/js/src/pro/woo.d.ts +3 -3
  279. package/js/src/pro/woo.js +8 -6
  280. package/js/src/probit.d.ts +3 -3
  281. package/js/src/probit.js +3 -3
  282. package/js/src/timex.d.ts +1 -1
  283. package/js/src/tokocrypto.d.ts +3 -3
  284. package/js/src/tokocrypto.js +2 -2
  285. package/js/src/upbit.d.ts +2 -2
  286. package/js/src/wavesexchange.d.ts +3 -4
  287. package/js/src/wavesexchange.js +2 -1
  288. package/js/src/wazirx.d.ts +1 -1
  289. package/js/src/whitebit.d.ts +5 -15
  290. package/js/src/woo.d.ts +5 -15
  291. package/js/src/woo.js +1 -1
  292. package/js/src/yobit.d.ts +21 -6
  293. package/js/src/yobit.js +39 -0
  294. package/js/src/zaif.d.ts +2 -2
  295. package/js/src/zonda.d.ts +4 -14
  296. package/package.json +22 -8
  297. package/skip-tests.json +9 -1
  298. package/tests-manager.sh +1 -2
@@ -191,24 +191,24 @@ class luno extends luno$1 {
191
191
  const symbol = subscription['symbol'];
192
192
  const messageHash = 'orderbook:' + symbol;
193
193
  const timestamp = this.safeString(message, 'timestamp');
194
- let storedOrderBook = this.safeValue(this.orderbooks, symbol);
195
- if (storedOrderBook === undefined) {
196
- storedOrderBook = this.indexedOrderBook({});
197
- this.orderbooks[symbol] = storedOrderBook;
194
+ let orderbook = this.safeValue(this.orderbooks, symbol);
195
+ if (orderbook === undefined) {
196
+ orderbook = this.indexedOrderBook({});
197
+ this.orderbooks[symbol] = orderbook;
198
198
  }
199
199
  const asks = this.safeValue(message, 'asks');
200
200
  if (asks !== undefined) {
201
201
  const snapshot = this.customParseOrderBook(message, symbol, timestamp, 'bids', 'asks', 'price', 'volume', 'id');
202
- storedOrderBook.reset(snapshot);
202
+ orderbook.reset(snapshot);
203
203
  }
204
204
  else {
205
- this.handleDelta(storedOrderBook, message);
206
- storedOrderBook['timestamp'] = timestamp;
207
- storedOrderBook['datetime'] = this.iso8601(timestamp);
205
+ this.handleDelta(orderbook, message);
206
+ orderbook['timestamp'] = timestamp;
207
+ orderbook['datetime'] = this.iso8601(timestamp);
208
208
  }
209
209
  const nonce = this.safeInteger(message, 'sequence');
210
- storedOrderBook['nonce'] = nonce;
211
- client.resolve(storedOrderBook, messageHash);
210
+ orderbook['nonce'] = nonce;
211
+ client.resolve(orderbook, messageHash);
212
212
  }
213
213
  customParseOrderBook(orderbook, symbol, timestamp = undefined, bidsKey = 'bids', asksKey = 'asks', priceKey = 'price', amountKey = 'volume', countOrIdKey = 2) {
214
214
  const bids = this.parseBidsAsks(this.safeValue(orderbook, bidsKey, []), priceKey, amountKey, countOrIdKey);
@@ -300,10 +300,9 @@ class luno extends luno$1 {
300
300
  const deleteUpdate = this.safeValue(message, 'delete_update');
301
301
  if (deleteUpdate !== undefined) {
302
302
  const orderId = this.safeString(deleteUpdate, 'order_id');
303
- asksOrderSide.storeArray(0, 0, orderId);
304
- bidsOrderSide.storeArray(0, 0, orderId);
303
+ asksOrderSide.storeArray([0, 0, orderId]);
304
+ bidsOrderSide.storeArray([0, 0, orderId]);
305
305
  }
306
- return message;
307
306
  }
308
307
  handleMessage(client, message) {
309
308
  if (message === '') {
@@ -315,7 +314,6 @@ class luno extends luno$1 {
315
314
  const handler = handlers[j];
316
315
  handler.call(this, client, message, subscriptions[0]);
317
316
  }
318
- return message;
319
317
  }
320
318
  }
321
319
 
@@ -1106,7 +1106,7 @@ class mexc extends mexc$1 {
1106
1106
  //
1107
1107
  const msg = this.safeString(message, 'msg');
1108
1108
  if (msg === 'PONG') {
1109
- return this.handlePong(client, message);
1109
+ this.handlePong(client, message);
1110
1110
  }
1111
1111
  else if (msg.indexOf('@') > -1) {
1112
1112
  const parts = msg.split('@');
@@ -1129,7 +1129,8 @@ class mexc extends mexc$1 {
1129
1129
  return;
1130
1130
  }
1131
1131
  if ('msg' in message) {
1132
- return this.handleSubscriptionStatus(client, message);
1132
+ this.handleSubscriptionStatus(client, message);
1133
+ return;
1133
1134
  }
1134
1135
  const c = this.safeString(message, 'c');
1135
1136
  let channel = undefined;
@@ -385,13 +385,13 @@ class ndax extends ndax$1 {
385
385
  const firstBidAsk = this.safeValue(payload, 0, []);
386
386
  const marketId = this.safeString(firstBidAsk, 7);
387
387
  if (marketId === undefined) {
388
- return message;
388
+ return;
389
389
  }
390
390
  const market = this.safeMarket(marketId);
391
391
  const symbol = market['symbol'];
392
392
  const orderbook = this.safeValue(this.orderbooks, symbol);
393
393
  if (orderbook === undefined) {
394
- return message;
394
+ return;
395
395
  }
396
396
  let timestamp = undefined;
397
397
  let nonce = undefined;
@@ -485,11 +485,8 @@ class ndax extends ndax$1 {
485
485
  const subscription = this.safeValue(subscriptionsById, id);
486
486
  if (subscription !== undefined) {
487
487
  const method = this.safeValue(subscription, 'method');
488
- if (method === undefined) {
489
- return message;
490
- }
491
- else {
492
- return method.call(this, client, message, subscription);
488
+ if (method !== undefined) {
489
+ method.call(this, client, message, subscription);
493
490
  }
494
491
  }
495
492
  }
@@ -518,7 +515,7 @@ class ndax extends ndax$1 {
518
515
  //
519
516
  const payload = this.safeString(message, 'o');
520
517
  if (payload === undefined) {
521
- return message;
518
+ return;
522
519
  }
523
520
  message['o'] = JSON.parse(payload);
524
521
  const methods = {
@@ -533,11 +530,8 @@ class ndax extends ndax$1 {
533
530
  };
534
531
  const event = this.safeString(message, 'n');
535
532
  const method = this.safeValue(methods, event);
536
- if (method === undefined) {
537
- return message;
538
- }
539
- else {
540
- return method.call(this, client, message);
533
+ if (method !== undefined) {
534
+ method.call(this, client, message);
541
535
  }
542
536
  }
543
537
  }
@@ -475,7 +475,7 @@ class okcoin extends okcoin$1 {
475
475
  };
476
476
  this.spawn(this.watch, url, messageHash, request, messageHash, future);
477
477
  }
478
- return await future;
478
+ return future;
479
479
  }
480
480
  async watchBalance(params = {}) {
481
481
  /**
@@ -708,7 +708,8 @@ class okcoin extends okcoin$1 {
708
708
  // }
709
709
  //
710
710
  if (message === 'pong') {
711
- return this.handlePong(client, message);
711
+ this.handlePong(client, message);
712
+ return;
712
713
  }
713
714
  const table = this.safeString(message, 'table');
714
715
  if (table === undefined) {
@@ -721,11 +722,8 @@ class okcoin extends okcoin$1 {
721
722
  'subscribe': this.handleSubscriptionStatus,
722
723
  };
723
724
  const method = this.safeValue(methods, event);
724
- if (method === undefined) {
725
- return message;
726
- }
727
- else {
728
- return method.call(this, client, message);
725
+ if (method !== undefined) {
726
+ method.call(this, client, message);
729
727
  }
730
728
  }
731
729
  }
@@ -747,11 +745,8 @@ class okcoin extends okcoin$1 {
747
745
  if (name.indexOf('candle') >= 0) {
748
746
  method = this.handleOHLCV;
749
747
  }
750
- if (method === undefined) {
751
- return message;
752
- }
753
- else {
754
- return method.call(this, client, message);
748
+ if (method !== undefined) {
749
+ method.call(this, client, message);
755
750
  }
756
751
  }
757
752
  }
@@ -755,7 +755,7 @@ class okx extends okx$1 {
755
755
  const message = this.extend(request, params);
756
756
  this.watch(url, messageHash, message, messageHash);
757
757
  }
758
- return future;
758
+ return await future;
759
759
  }
760
760
  async watchBalance(params = {}) {
761
761
  /**
@@ -1561,7 +1561,8 @@ class okx extends okx$1 {
1561
1561
  //
1562
1562
  //
1563
1563
  if (message === 'pong') {
1564
- return this.handlePong(client, message);
1564
+ this.handlePong(client, message);
1565
+ return;
1565
1566
  }
1566
1567
  // const table = this.safeString (message, 'table');
1567
1568
  // if (table === undefined) {
@@ -1580,11 +1581,8 @@ class okx extends okx$1 {
1580
1581
  'mass-cancel': this.handleCancelAllOrders,
1581
1582
  };
1582
1583
  const method = this.safeValue(methods, event);
1583
- if (method === undefined) {
1584
- return message;
1585
- }
1586
- else {
1587
- return method.call(this, client, message);
1584
+ if (method !== undefined) {
1585
+ method.call(this, client, message);
1588
1586
  }
1589
1587
  }
1590
1588
  else {
@@ -1612,12 +1610,9 @@ class okx extends okx$1 {
1612
1610
  if (channel.indexOf('candle') === 0) {
1613
1611
  this.handleOHLCV(client, message);
1614
1612
  }
1615
- else {
1616
- return message;
1617
- }
1618
1613
  }
1619
1614
  else {
1620
- return method.call(this, client, message);
1615
+ method.call(this, client, message);
1621
1616
  }
1622
1617
  }
1623
1618
  }
@@ -362,26 +362,26 @@ class onetrading extends onetrading$1 {
362
362
  const dateTime = this.safeString(message, 'time');
363
363
  const timestamp = this.parse8601(dateTime);
364
364
  const channel = 'book:' + symbol;
365
- let storedOrderBook = this.safeValue(this.orderbooks, symbol);
366
- if (storedOrderBook === undefined) {
367
- storedOrderBook = this.orderBook({});
365
+ let orderbook = this.safeValue(this.orderbooks, symbol);
366
+ if (orderbook === undefined) {
367
+ orderbook = this.orderBook({});
368
368
  }
369
369
  if (type === 'ORDER_BOOK_SNAPSHOT') {
370
370
  const snapshot = this.parseOrderBook(message, symbol, timestamp, 'bids', 'asks');
371
- storedOrderBook.reset(snapshot);
371
+ orderbook.reset(snapshot);
372
372
  }
373
373
  else if (type === 'ORDER_BOOK_UPDATE') {
374
374
  const changes = this.safeValue(message, 'changes', []);
375
- this.handleDeltas(storedOrderBook, changes);
375
+ this.handleDeltas(orderbook, changes);
376
376
  }
377
377
  else {
378
378
  throw new errors.NotSupported(this.id + ' watchOrderBook() did not recognize message type ' + type);
379
379
  }
380
- storedOrderBook['nonce'] = timestamp;
381
- storedOrderBook['timestamp'] = timestamp;
382
- storedOrderBook['datetime'] = this.iso8601(timestamp);
383
- this.orderbooks[symbol] = storedOrderBook;
384
- client.resolve(storedOrderBook, channel);
380
+ orderbook['nonce'] = timestamp;
381
+ orderbook['timestamp'] = timestamp;
382
+ orderbook['datetime'] = this.iso8601(timestamp);
383
+ this.orderbooks[symbol] = orderbook;
384
+ client.resolve(orderbook, channel);
385
385
  }
386
386
  handleDelta(orderbook, delta) {
387
387
  //
@@ -967,13 +967,14 @@ class onetrading extends onetrading$1 {
967
967
  if (updateType === 'ORDER_CLOSED' && filled === 0) {
968
968
  status = 'canceled';
969
969
  }
970
- orders.append({
970
+ const orderObject = {
971
971
  'id': orderId,
972
972
  'symbol': symbol,
973
973
  'status': status,
974
974
  'timestamp': this.parse8601(datetime),
975
975
  'datetime': datetime,
976
- });
976
+ };
977
+ orders.append(orderObject);
977
978
  }
978
979
  else {
979
980
  const parsed = this.parseOrder(update);
@@ -1210,7 +1211,8 @@ class onetrading extends onetrading$1 {
1210
1211
  handleMessage(client, message) {
1211
1212
  const error = this.safeValue(message, 'error');
1212
1213
  if (error !== undefined) {
1213
- return this.handleErrorMessage(client, message);
1214
+ this.handleErrorMessage(client, message);
1215
+ return;
1214
1216
  }
1215
1217
  const type = this.safeValue(message, 'type');
1216
1218
  const handlers = {
@@ -1241,9 +1243,8 @@ class onetrading extends onetrading$1 {
1241
1243
  };
1242
1244
  const handler = this.safeValue(handlers, type);
1243
1245
  if (handler !== undefined) {
1244
- return handler.call(this, client, message);
1246
+ handler.call(this, client, message);
1245
1247
  }
1246
- throw new errors.NotSupported(this.id + ' no handler found for this message ' + this.json(message));
1247
1248
  }
1248
1249
  handlePricePointUpdates(client, message) {
1249
1250
  //
@@ -362,7 +362,8 @@ class p2b extends p2b$1 {
362
362
  const bid = this.safeValue(bids, i);
363
363
  const price = this.safeNumber(bid, 0);
364
364
  const amount = this.safeNumber(bid, 1);
365
- orderbook['bids'].store(price, amount);
365
+ const bookSide = orderbook['bids'];
366
+ bookSide.store(price, amount);
366
367
  }
367
368
  }
368
369
  if (asks !== undefined) {
@@ -370,7 +371,8 @@ class p2b extends p2b$1 {
370
371
  const ask = this.safeValue(asks, i);
371
372
  const price = this.safeNumber(ask, 0);
372
373
  const amount = this.safeNumber(ask, 1);
373
- orderbook['asks'].store(price, amount);
374
+ const bookside = orderbook['asks'];
375
+ bookside.store(price, amount);
374
376
  }
375
377
  }
376
378
  orderbook['symbol'] = symbol;
@@ -395,7 +397,7 @@ class p2b extends p2b$1 {
395
397
  };
396
398
  const endpoint = this.safeValue(methods, method);
397
399
  if (endpoint !== undefined) {
398
- return endpoint.call(this, client, message);
400
+ endpoint.call(this, client, message);
399
401
  }
400
402
  }
401
403
  handleErrorMessage(client, message) {
@@ -630,13 +630,13 @@ class phemex extends phemex$1 {
630
630
  }
631
631
  return this.filterBySinceLimit(ohlcv, since, limit, 0, true);
632
632
  }
633
- handleDelta(bookside, delta, market = undefined) {
633
+ customHandleDelta(bookside, delta, market = undefined) {
634
634
  const bidAsk = this.customParseBidAsk(delta, 0, 1, market);
635
635
  bookside.storeArray(bidAsk);
636
636
  }
637
- handleDeltas(bookside, deltas, market = undefined) {
637
+ customHandleDeltas(bookside, deltas, market = undefined) {
638
638
  for (let i = 0; i < deltas.length; i++) {
639
- this.handleDelta(bookside, deltas[i], market);
639
+ this.customHandleDelta(bookside, deltas[i], market);
640
640
  }
641
641
  }
642
642
  handleOrderBook(client, message) {
@@ -706,8 +706,8 @@ class phemex extends phemex$1 {
706
706
  const changes = this.safeValue2(message, 'book', 'orderbook_p', {});
707
707
  const asks = this.safeValue(changes, 'asks', []);
708
708
  const bids = this.safeValue(changes, 'bids', []);
709
- this.handleDeltas(orderbook['asks'], asks, market);
710
- this.handleDeltas(orderbook['bids'], bids, market);
709
+ this.customHandleDeltas(orderbook['asks'], asks, market);
710
+ this.customHandleDeltas(orderbook['bids'], bids, market);
711
711
  orderbook['nonce'] = nonce;
712
712
  orderbook['timestamp'] = timestamp;
713
713
  orderbook['datetime'] = this.iso8601(timestamp);
@@ -1403,21 +1403,26 @@ class phemex extends phemex$1 {
1403
1403
  const method = client.subscriptions[id];
1404
1404
  delete client.subscriptions[id];
1405
1405
  if (method !== true) {
1406
- return method.call(this, client, message);
1406
+ method.call(this, client, message);
1407
+ return;
1407
1408
  }
1408
1409
  }
1409
1410
  const methodName = this.safeString(message, 'method', '');
1410
1411
  if (('market24h' in message) || ('spot_market24h' in message) || (methodName.indexOf('perp_market24h_pack_p') >= 0)) {
1411
- return this.handleTicker(client, message);
1412
+ this.handleTicker(client, message);
1413
+ return;
1412
1414
  }
1413
1415
  else if (('trades' in message) || ('trades_p' in message)) {
1414
- return this.handleTrades(client, message);
1416
+ this.handleTrades(client, message);
1417
+ return;
1415
1418
  }
1416
1419
  else if (('kline' in message) || ('kline_p' in message)) {
1417
- return this.handleOHLCV(client, message);
1420
+ this.handleOHLCV(client, message);
1421
+ return;
1418
1422
  }
1419
1423
  else if (('book' in message) || ('orderbook_p' in message)) {
1420
- return this.handleOrderBook(client, message);
1424
+ this.handleOrderBook(client, message);
1425
+ return;
1421
1426
  }
1422
1427
  if (('orders' in message) || ('orders_p' in message)) {
1423
1428
  const orders = this.safeValue2(message, 'orders', 'orders_p', {});
@@ -1504,7 +1509,7 @@ class phemex extends phemex$1 {
1504
1509
  future = this.watch(url, messageHash, message);
1505
1510
  client.subscriptions[messageHash] = future;
1506
1511
  }
1507
- return await future;
1512
+ return future;
1508
1513
  }
1509
1514
  }
1510
1515
 
@@ -1039,7 +1039,8 @@ class poloniex extends poloniex$1 {
1039
1039
  const bid = this.safeValue(bids, j);
1040
1040
  const price = this.safeNumber(bid, 0);
1041
1041
  const amount = this.safeNumber(bid, 1);
1042
- orderbook['bids'].store(price, amount);
1042
+ const bidsSide = orderbook['bids'];
1043
+ bidsSide.store(price, amount);
1043
1044
  }
1044
1045
  }
1045
1046
  if (asks !== undefined) {
@@ -1047,7 +1048,8 @@ class poloniex extends poloniex$1 {
1047
1048
  const ask = this.safeValue(asks, j);
1048
1049
  const price = this.safeNumber(ask, 0);
1049
1050
  const amount = this.safeNumber(ask, 1);
1050
- orderbook['asks'].store(price, amount);
1051
+ const asksSide = orderbook['asks'];
1052
+ asksSide.store(price, amount);
1051
1053
  }
1052
1054
  }
1053
1055
  orderbook['symbol'] = symbol;
@@ -1181,14 +1183,14 @@ class poloniex extends poloniex$1 {
1181
1183
  this.handleErrorMessage(client, item);
1182
1184
  }
1183
1185
  else {
1184
- return this.handleOrderRequest(client, message);
1186
+ this.handleOrderRequest(client, message);
1185
1187
  }
1186
1188
  }
1187
1189
  else {
1188
1190
  const data = this.safeValue(message, 'data', []);
1189
1191
  const dataLength = data.length;
1190
1192
  if (dataLength > 0) {
1191
- return method.call(this, client, message);
1193
+ method.call(this, client, message);
1192
1194
  }
1193
1195
  }
1194
1196
  }
@@ -4,6 +4,7 @@ var poloniexfutures$1 = require('../poloniexfutures.js');
4
4
  var errors = require('../base/errors.js');
5
5
  var Cache = require('../base/ws/Cache.js');
6
6
 
7
+ // ---------------------------------------------------------------------------
7
8
  // ---------------------------------------------------------------------------
8
9
  class poloniexfutures extends poloniexfutures$1 {
9
10
  describe() {
@@ -59,18 +60,21 @@ class poloniexfutures extends poloniexfutures$1 {
59
60
  },
60
61
  });
61
62
  }
62
- negotiate(privateChannel, params = {}) {
63
+ async negotiate(privateChannel, params = {}) {
63
64
  const connectId = privateChannel ? 'private' : 'public';
64
65
  const urls = this.safeValue(this.options, 'urls', {});
65
66
  if (connectId in urls) {
66
- return urls[connectId];
67
+ // return urls[connectId];
68
+ const storedFuture = urls[connectId];
69
+ return await storedFuture;
67
70
  }
68
71
  // we store an awaitable to the url
69
72
  // so that multiple calls don't asynchronously
70
73
  // fetch different urls and overwrite each other
71
74
  urls[connectId] = this.spawn(this.negotiateHelper, privateChannel, params);
72
75
  this.options['urls'] = urls;
73
- return urls[connectId];
76
+ const future = urls[connectId];
77
+ return await future;
74
78
  }
75
79
  async negotiateHelper(privateChannel, params = {}) {
76
80
  let response = undefined;
@@ -708,7 +712,7 @@ class poloniexfutures extends poloniexfutures$1 {
708
712
  const messageHash = this.safeString(message, 'topic');
709
713
  const subject = this.safeString(message, 'subject');
710
714
  if (subject === 'received') {
711
- return message;
715
+ return;
712
716
  }
713
717
  // At the time of writting this, there is no implementation to easily convert each order into the orderbook so raw messages are returned
714
718
  client.resolve(message, messageHash);
@@ -727,9 +731,10 @@ class poloniexfutures extends poloniexfutures$1 {
727
731
  const topic = this.safeString(message, 'topic');
728
732
  const isSnapshot = topic.indexOf('Depth') >= 0;
729
733
  if (isSnapshot) {
730
- return this.handeL2Snapshot(client, message);
734
+ this.handeL2Snapshot(client, message);
735
+ return;
731
736
  }
732
- return this.handleL2OrderBook(client, message);
737
+ this.handleL2OrderBook(client, message);
733
738
  }
734
739
  handleL2OrderBook(client, message) {
735
740
  //
@@ -766,7 +771,7 @@ class poloniexfutures extends poloniexfutures$1 {
766
771
  const snapshotDelay = this.handleOption('watchOrderBook', 'snapshotDelay', 5);
767
772
  if (cacheLength === snapshotDelay) {
768
773
  const limit = 0;
769
- this.spawn(this.loadOrderBook, client, messageHash, symbol, limit);
774
+ this.spawn(this.loadOrderBook, client, messageHash, symbol, limit, {});
770
775
  }
771
776
  orderBook.cache.push(data);
772
777
  return;
@@ -954,7 +959,7 @@ class poloniexfutures extends poloniexfutures$1 {
954
959
  };
955
960
  const method = this.safeValue(methods, subject);
956
961
  if (method !== undefined) {
957
- return method.call(this, client, message);
962
+ method.call(this, client, message);
958
963
  }
959
964
  }
960
965
  ping(client) {
@@ -990,7 +995,7 @@ class poloniexfutures extends poloniexfutures$1 {
990
995
  };
991
996
  const method = this.safeValue(methods, type);
992
997
  if (method !== undefined) {
993
- return method.call(this, client, message);
998
+ method.call(this, client, message);
994
999
  }
995
1000
  }
996
1001
  handleAuthenticate(client, message) {
@@ -4,6 +4,7 @@ var probit$1 = require('../probit.js');
4
4
  var errors = require('../base/errors.js');
5
5
  var Cache = require('../base/ws/Cache.js');
6
6
 
7
+ // ---------------------------------------------------------------------------
7
8
  // ---------------------------------------------------------------------------
8
9
  class probit extends probit$1 {
9
10
  describe() {
@@ -449,20 +450,20 @@ class probit extends probit$1 {
449
450
  const symbol = this.safeSymbol(marketId);
450
451
  const dataBySide = this.groupBy(orderBook, 'side');
451
452
  const messageHash = 'orderbook:' + symbol;
452
- let storedOrderBook = this.safeValue(this.orderbooks, symbol);
453
- if (storedOrderBook === undefined) {
454
- storedOrderBook = this.orderBook({});
455
- this.orderbooks[symbol] = storedOrderBook;
453
+ let orderbook = this.safeValue(this.orderbooks, symbol);
454
+ if (orderbook === undefined) {
455
+ orderbook = this.orderBook({});
456
+ this.orderbooks[symbol] = orderbook;
456
457
  }
457
458
  const reset = this.safeBool(message, 'reset', false);
458
459
  if (reset) {
459
460
  const snapshot = this.parseOrderBook(dataBySide, symbol, undefined, 'buy', 'sell', 'price', 'quantity');
460
- storedOrderBook.reset(snapshot);
461
+ orderbook.reset(snapshot);
461
462
  }
462
463
  else {
463
- this.handleDelta(storedOrderBook, dataBySide);
464
+ this.handleDelta(orderbook, dataBySide);
464
465
  }
465
- client.resolve(storedOrderBook, messageHash);
466
+ client.resolve(orderbook, messageHash);
466
467
  }
467
468
  handleBidAsks(bookSide, bidAsks) {
468
469
  for (let i = 0; i < bidAsks.length; i++) {
@@ -535,11 +536,13 @@ class probit extends probit$1 {
535
536
  //
536
537
  const errorCode = this.safeString(message, 'errorCode');
537
538
  if (errorCode !== undefined) {
538
- return this.handleErrorMessage(client, message);
539
+ this.handleErrorMessage(client, message);
540
+ return;
539
541
  }
540
542
  const type = this.safeString(message, 'type');
541
543
  if (type === 'authorization') {
542
- return this.handleAuthenticate(client, message);
544
+ this.handleAuthenticate(client, message);
545
+ return;
543
546
  }
544
547
  const handlers = {
545
548
  'marketdata': this.handleMarketData,
@@ -551,7 +554,8 @@ class probit extends probit$1 {
551
554
  const channel = this.safeString(message, 'channel');
552
555
  const handler = this.safeValue(handlers, channel);
553
556
  if (handler !== undefined) {
554
- return handler.call(this, client, message);
557
+ handler.call(this, client, message);
558
+ return;
555
559
  }
556
560
  const error = new errors.NotSupported(this.id + ' handleMessage: unknown message: ' + this.json(message));
557
561
  client.reject(error);
@@ -579,7 +583,7 @@ class probit extends probit$1 {
579
583
  future = this.watch(url, messageHash, this.extend(request, params));
580
584
  client.subscriptions[messageHash] = future;
581
585
  }
582
- return await future;
586
+ return future;
583
587
  }
584
588
  }
585
589
 
@@ -163,15 +163,15 @@ class upbit extends upbit$1 {
163
163
  if (type === 'SNAPSHOT') {
164
164
  this.orderbooks[symbol] = this.orderBook({}, limit);
165
165
  }
166
- const orderBook = this.orderbooks[symbol];
166
+ const orderbook = this.orderbooks[symbol];
167
167
  // upbit always returns a snapshot of 15 topmost entries
168
168
  // the "REALTIME" deltas are not incremental
169
169
  // therefore we reset the orderbook on each update
170
170
  // and reinitialize it again with new bidasks
171
- orderBook.reset({});
172
- orderBook['symbol'] = symbol;
173
- const bids = orderBook['bids'];
174
- const asks = orderBook['asks'];
171
+ orderbook.reset({});
172
+ orderbook['symbol'] = symbol;
173
+ const bids = orderbook['bids'];
174
+ const asks = orderbook['asks'];
175
175
  const data = this.safeValue(message, 'orderbook_units', []);
176
176
  for (let i = 0; i < data.length; i++) {
177
177
  const entry = data[i];
@@ -184,10 +184,10 @@ class upbit extends upbit$1 {
184
184
  }
185
185
  const timestamp = this.safeInteger(message, 'timestamp');
186
186
  const datetime = this.iso8601(timestamp);
187
- orderBook['timestamp'] = timestamp;
188
- orderBook['datetime'] = datetime;
187
+ orderbook['timestamp'] = timestamp;
188
+ orderbook['datetime'] = datetime;
189
189
  const messageHash = 'orderbook:' + marketId;
190
- client.resolve(orderBook, messageHash);
190
+ client.resolve(orderbook, messageHash);
191
191
  }
192
192
  handleTrades(client, message) {
193
193
  // { type: "trade",
@@ -720,7 +720,8 @@ class wazirx extends wazirx$1 {
720
720
  handleMessage(client, message) {
721
721
  const status = this.safeString(message, 'status');
722
722
  if (status === 'error') {
723
- return this.handleError(client, message);
723
+ this.handleError(client, message);
724
+ return;
724
725
  }
725
726
  const event = this.safeString(message, 'event');
726
727
  const eventHandlers = {
@@ -730,7 +731,8 @@ class wazirx extends wazirx$1 {
730
731
  };
731
732
  const eventHandler = this.safeValue(eventHandlers, event);
732
733
  if (eventHandler !== undefined) {
733
- return eventHandler.call(this, client, message);
734
+ eventHandler.call(this, client, message);
735
+ return;
734
736
  }
735
737
  const stream = this.safeString(message, 'stream', '');
736
738
  const streamHandlers = {
@@ -746,7 +748,8 @@ class wazirx extends wazirx$1 {
746
748
  for (let i = 0; i < streams.length; i++) {
747
749
  if (this.inArray(streams[i], stream)) {
748
750
  const handler = streamHandlers[streams[i]];
749
- return handler.call(this, client, message);
751
+ handler.call(this, client, message);
752
+ return;
750
753
  }
751
754
  }
752
755
  throw new errors.NotSupported(this.id + ' this message type is not supported yet. Message: ' + this.json(message));