ccxt 4.2.31 → 4.2.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 (302) 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 +741 -501
  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 +62 -20
  12. package/dist/cjs/src/bigone.js +21 -1
  13. package/dist/cjs/src/binance.js +59 -15
  14. package/dist/cjs/src/bingx.js +4 -3
  15. package/dist/cjs/src/bit2c.js +12 -0
  16. package/dist/cjs/src/bitfinex2.js +12 -1
  17. package/dist/cjs/src/bitget.js +3 -3
  18. package/dist/cjs/src/bitmart.js +1 -1
  19. package/dist/cjs/src/bitrue.js +3 -3
  20. package/dist/cjs/src/blockchaincom.js +1 -1
  21. package/dist/cjs/src/bybit.js +1 -1
  22. package/dist/cjs/src/coinbase.js +2 -2
  23. package/dist/cjs/src/coinex.js +1 -1
  24. package/dist/cjs/src/cryptocom.js +10 -10
  25. package/dist/cjs/src/gate.js +34 -29
  26. package/dist/cjs/src/kraken.js +39 -0
  27. package/dist/cjs/src/krakenfutures.js +25 -3
  28. package/dist/cjs/src/kucoin.js +1 -1
  29. package/dist/cjs/src/mexc.js +2 -1
  30. package/dist/cjs/src/okx.js +4 -3
  31. package/dist/cjs/src/phemex.js +8 -8
  32. package/dist/cjs/src/pro/alpaca.js +8 -4
  33. package/dist/cjs/src/pro/ascendex.js +1 -2
  34. package/dist/cjs/src/pro/binance.js +17 -13
  35. package/dist/cjs/src/pro/bingx.js +1 -1
  36. package/dist/cjs/src/pro/bitfinex.js +21 -24
  37. package/dist/cjs/src/pro/bitfinex2.js +13 -17
  38. package/dist/cjs/src/pro/bitget.js +3 -1
  39. package/dist/cjs/src/pro/bitmart.js +3 -8
  40. package/dist/cjs/src/pro/bitmex.js +4 -7
  41. package/dist/cjs/src/pro/bitopro.js +2 -5
  42. package/dist/cjs/src/pro/bitrue.js +1 -1
  43. package/dist/cjs/src/pro/bitstamp.js +2 -3
  44. package/dist/cjs/src/pro/bitvavo.js +12 -5
  45. package/dist/cjs/src/pro/blockchaincom.js +22 -23
  46. package/dist/cjs/src/pro/bybit.js +5 -5
  47. package/dist/cjs/src/pro/cex.js +7 -7
  48. package/dist/cjs/src/pro/coinbase.js +3 -2
  49. package/dist/cjs/src/pro/coinbasepro.js +1 -1
  50. package/dist/cjs/src/pro/coinex.js +15 -13
  51. package/dist/cjs/src/pro/currencycom.js +5 -7
  52. package/dist/cjs/src/pro/deribit.js +4 -4
  53. package/dist/cjs/src/pro/exmo.js +15 -13
  54. package/dist/cjs/src/pro/gate.js +1 -1
  55. package/dist/cjs/src/pro/gemini.js +4 -2
  56. package/dist/cjs/src/pro/hitbtc.js +9 -8
  57. package/dist/cjs/src/pro/hollaex.js +2 -2
  58. package/dist/cjs/src/pro/htx.js +6 -7
  59. package/dist/cjs/src/pro/huobijp.js +3 -5
  60. package/dist/cjs/src/pro/idex.js +1 -1
  61. package/dist/cjs/src/pro/independentreserve.js +14 -13
  62. package/dist/cjs/src/pro/kraken.js +10 -16
  63. package/dist/cjs/src/pro/krakenfutures.js +10 -6
  64. package/dist/cjs/src/pro/kucoin.js +10 -11
  65. package/dist/cjs/src/pro/kucoinfutures.js +12 -11
  66. package/dist/cjs/src/pro/lbank.js +10 -10
  67. package/dist/cjs/src/pro/luno.js +12 -14
  68. package/dist/cjs/src/pro/mexc.js +3 -2
  69. package/dist/cjs/src/pro/ndax.js +7 -13
  70. package/dist/cjs/src/pro/okcoin.js +7 -12
  71. package/dist/cjs/src/pro/okx.js +6 -11
  72. package/dist/cjs/src/pro/onetrading.js +16 -15
  73. package/dist/cjs/src/pro/p2b.js +5 -3
  74. package/dist/cjs/src/pro/phemex.js +16 -11
  75. package/dist/cjs/src/pro/poloniex.js +6 -4
  76. package/dist/cjs/src/pro/poloniexfutures.js +14 -9
  77. package/dist/cjs/src/pro/probit.js +15 -11
  78. package/dist/cjs/src/pro/upbit.js +8 -8
  79. package/dist/cjs/src/pro/wazirx.js +6 -3
  80. package/dist/cjs/src/pro/woo.js +8 -6
  81. package/dist/cjs/src/probit.js +3 -3
  82. package/dist/cjs/src/tokocrypto.js +2 -2
  83. package/dist/cjs/src/wavesexchange.js +2 -1
  84. package/dist/cjs/src/woo.js +1 -1
  85. package/dist/cjs/src/yobit.js +39 -0
  86. package/js/ccxt.d.ts +1 -1
  87. package/js/ccxt.js +1 -1
  88. package/js/src/ace.d.ts +1 -1
  89. package/js/src/ace.js +3 -2
  90. package/js/src/alpaca.d.ts +1 -1
  91. package/js/src/ascendex.d.ts +5 -15
  92. package/js/src/ascendex.js +1 -1
  93. package/js/src/base/Exchange.d.ts +86 -78
  94. package/js/src/base/Exchange.js +62 -20
  95. package/js/src/base/types.d.ts +90 -6
  96. package/js/src/bigone.d.ts +5 -15
  97. package/js/src/bigone.js +21 -1
  98. package/js/src/binance.d.ts +13 -23
  99. package/js/src/binance.js +59 -15
  100. package/js/src/bingx.d.ts +6 -16
  101. package/js/src/bingx.js +4 -3
  102. package/js/src/bit2c.d.ts +1 -1
  103. package/js/src/bit2c.js +12 -0
  104. package/js/src/bitbank.d.ts +2 -2
  105. package/js/src/bitbns.d.ts +1 -1
  106. package/js/src/bitfinex.d.ts +5 -5
  107. package/js/src/bitfinex2.d.ts +7 -17
  108. package/js/src/bitfinex2.js +12 -1
  109. package/js/src/bitflyer.d.ts +5 -5
  110. package/js/src/bitforex.d.ts +1 -1
  111. package/js/src/bitget.d.ts +8 -38
  112. package/js/src/bitget.js +3 -3
  113. package/js/src/bithumb.d.ts +2 -2
  114. package/js/src/bitmart.d.ts +10 -21
  115. package/js/src/bitmart.js +1 -1
  116. package/js/src/bitmex.d.ts +3 -3
  117. package/js/src/bitopro.d.ts +2 -2
  118. package/js/src/bitrue.d.ts +5 -15
  119. package/js/src/bitrue.js +3 -3
  120. package/js/src/bitso.d.ts +4 -4
  121. package/js/src/bitstamp.d.ts +2 -2
  122. package/js/src/bitteam.d.ts +1 -1
  123. package/js/src/bitvavo.d.ts +3 -3
  124. package/js/src/bl3p.d.ts +1 -1
  125. package/js/src/blockchaincom.d.ts +2 -2
  126. package/js/src/blockchaincom.js +1 -1
  127. package/js/src/btcalpha.d.ts +1 -1
  128. package/js/src/btcbox.d.ts +1 -1
  129. package/js/src/btcmarkets.d.ts +3 -3
  130. package/js/src/btcturk.d.ts +1 -1
  131. package/js/src/bybit.d.ts +8 -8
  132. package/js/src/bybit.js +1 -1
  133. package/js/src/cex.d.ts +1 -1
  134. package/js/src/coinbase.d.ts +6 -50
  135. package/js/src/coinbase.js +2 -2
  136. package/js/src/coinbasepro.d.ts +2 -2
  137. package/js/src/coincheck.d.ts +1 -1
  138. package/js/src/coinex.d.ts +8 -8
  139. package/js/src/coinex.js +1 -1
  140. package/js/src/coinlist.d.ts +4 -14
  141. package/js/src/coinmate.d.ts +2 -2
  142. package/js/src/coinmetro.d.ts +2 -2
  143. package/js/src/coinone.d.ts +1 -1
  144. package/js/src/coinsph.d.ts +2 -2
  145. package/js/src/coinspot.d.ts +1 -1
  146. package/js/src/cryptocom.d.ts +4 -4
  147. package/js/src/cryptocom.js +10 -10
  148. package/js/src/currencycom.d.ts +2 -2
  149. package/js/src/delta.d.ts +2 -2
  150. package/js/src/deribit.d.ts +4 -14
  151. package/js/src/digifinex.d.ts +10 -38
  152. package/js/src/exmo.d.ts +2 -2
  153. package/js/src/gate.d.ts +8 -18
  154. package/js/src/gate.js +34 -29
  155. package/js/src/gemini.d.ts +2 -2
  156. package/js/src/hitbtc.d.ts +6 -16
  157. package/js/src/hollaex.d.ts +2 -2
  158. package/js/src/htx.d.ts +11 -21
  159. package/js/src/huobijp.d.ts +4 -4
  160. package/js/src/idex.d.ts +3 -3
  161. package/js/src/independentreserve.d.ts +2 -2
  162. package/js/src/indodax.d.ts +2 -2
  163. package/js/src/kraken.d.ts +5 -5
  164. package/js/src/kraken.js +39 -0
  165. package/js/src/krakenfutures.d.ts +7 -7
  166. package/js/src/krakenfutures.js +25 -3
  167. package/js/src/kucoin.d.ts +8 -29
  168. package/js/src/kucoin.js +1 -1
  169. package/js/src/kucoinfutures.d.ts +4 -4
  170. package/js/src/kuna.d.ts +2 -2
  171. package/js/src/latoken.d.ts +4 -14
  172. package/js/src/lbank.d.ts +2 -5
  173. package/js/src/luno.d.ts +1 -1
  174. package/js/src/lykke.d.ts +2 -2
  175. package/js/src/mercado.d.ts +2 -2
  176. package/js/src/mexc.d.ts +6 -6
  177. package/js/src/mexc.js +2 -1
  178. package/js/src/ndax.d.ts +2 -2
  179. package/js/src/novadax.d.ts +4 -15
  180. package/js/src/oceanex.d.ts +1 -1
  181. package/js/src/okcoin.d.ts +5 -15
  182. package/js/src/okx.d.ts +8 -18
  183. package/js/src/okx.js +4 -3
  184. package/js/src/onetrading.d.ts +2 -2
  185. package/js/src/p2b.d.ts +1 -1
  186. package/js/src/paymium.d.ts +3 -13
  187. package/js/src/phemex.d.ts +5 -5
  188. package/js/src/phemex.js +8 -8
  189. package/js/src/poloniex.d.ts +4 -14
  190. package/js/src/poloniexfutures.d.ts +1 -1
  191. package/js/src/pro/alpaca.d.ts +2 -2
  192. package/js/src/pro/alpaca.js +8 -4
  193. package/js/src/pro/ascendex.d.ts +2 -2
  194. package/js/src/pro/ascendex.js +1 -2
  195. package/js/src/pro/binance.d.ts +3 -3
  196. package/js/src/pro/binance.js +17 -13
  197. package/js/src/pro/bingx.d.ts +1 -1
  198. package/js/src/pro/bingx.js +1 -1
  199. package/js/src/pro/bitfinex.d.ts +2 -2
  200. package/js/src/pro/bitfinex.js +21 -24
  201. package/js/src/pro/bitfinex2.d.ts +2 -2
  202. package/js/src/pro/bitfinex2.js +13 -17
  203. package/js/src/pro/bitget.js +3 -1
  204. package/js/src/pro/bitmart.d.ts +3 -3
  205. package/js/src/pro/bitmart.js +3 -8
  206. package/js/src/pro/bitmex.d.ts +1 -1
  207. package/js/src/pro/bitmex.js +4 -7
  208. package/js/src/pro/bitopro.d.ts +1 -1
  209. package/js/src/pro/bitopro.js +2 -5
  210. package/js/src/pro/bitrue.js +1 -1
  211. package/js/src/pro/bitstamp.d.ts +1 -1
  212. package/js/src/pro/bitstamp.js +2 -3
  213. package/js/src/pro/bitvavo.d.ts +3 -3
  214. package/js/src/pro/bitvavo.js +12 -5
  215. package/js/src/pro/blockchaincom.d.ts +8 -8
  216. package/js/src/pro/blockchaincom.js +22 -23
  217. package/js/src/pro/bybit.d.ts +2 -2
  218. package/js/src/pro/bybit.js +5 -5
  219. package/js/src/pro/cex.d.ts +1 -1
  220. package/js/src/pro/cex.js +7 -7
  221. package/js/src/pro/coinbase.d.ts +1 -1
  222. package/js/src/pro/coinbase.js +3 -2
  223. package/js/src/pro/coinbasepro.d.ts +1 -1
  224. package/js/src/pro/coinbasepro.js +1 -1
  225. package/js/src/pro/coinex.d.ts +2 -2
  226. package/js/src/pro/coinex.js +15 -13
  227. package/js/src/pro/currencycom.d.ts +1 -1
  228. package/js/src/pro/currencycom.js +5 -7
  229. package/js/src/pro/deribit.d.ts +2 -2
  230. package/js/src/pro/deribit.js +4 -4
  231. package/js/src/pro/exmo.d.ts +2 -2
  232. package/js/src/pro/exmo.js +15 -13
  233. package/js/src/pro/gate.js +1 -1
  234. package/js/src/pro/gemini.d.ts +1 -1
  235. package/js/src/pro/gemini.js +4 -2
  236. package/js/src/pro/hitbtc.d.ts +2 -2
  237. package/js/src/pro/hitbtc.js +9 -8
  238. package/js/src/pro/hollaex.d.ts +2 -2
  239. package/js/src/pro/hollaex.js +2 -2
  240. package/js/src/pro/htx.d.ts +2 -2
  241. package/js/src/pro/htx.js +6 -7
  242. package/js/src/pro/huobijp.d.ts +1 -1
  243. package/js/src/pro/huobijp.js +3 -5
  244. package/js/src/pro/idex.js +1 -1
  245. package/js/src/pro/independentreserve.d.ts +1 -1
  246. package/js/src/pro/independentreserve.js +14 -13
  247. package/js/src/pro/kraken.d.ts +2 -2
  248. package/js/src/pro/kraken.js +10 -16
  249. package/js/src/pro/krakenfutures.d.ts +1 -1
  250. package/js/src/pro/krakenfutures.js +10 -6
  251. package/js/src/pro/kucoin.d.ts +3 -3
  252. package/js/src/pro/kucoin.js +10 -11
  253. package/js/src/pro/kucoinfutures.d.ts +3 -3
  254. package/js/src/pro/kucoinfutures.js +12 -11
  255. package/js/src/pro/lbank.d.ts +1 -1
  256. package/js/src/pro/lbank.js +10 -10
  257. package/js/src/pro/luno.d.ts +2 -2
  258. package/js/src/pro/luno.js +12 -14
  259. package/js/src/pro/mexc.d.ts +2 -2
  260. package/js/src/pro/mexc.js +3 -2
  261. package/js/src/pro/ndax.d.ts +3 -3
  262. package/js/src/pro/ndax.js +7 -13
  263. package/js/src/pro/okcoin.d.ts +1 -1
  264. package/js/src/pro/okcoin.js +7 -12
  265. package/js/src/pro/okx.d.ts +1 -1
  266. package/js/src/pro/okx.js +6 -11
  267. package/js/src/pro/onetrading.d.ts +1 -1
  268. package/js/src/pro/onetrading.js +16 -15
  269. package/js/src/pro/p2b.d.ts +1 -1
  270. package/js/src/pro/p2b.js +5 -3
  271. package/js/src/pro/phemex.d.ts +3 -3
  272. package/js/src/pro/phemex.js +16 -11
  273. package/js/src/pro/poloniex.d.ts +1 -1
  274. package/js/src/pro/poloniex.js +6 -4
  275. package/js/src/pro/poloniexfutures.d.ts +4 -4
  276. package/js/src/pro/poloniexfutures.js +13 -10
  277. package/js/src/pro/probit.d.ts +1 -1
  278. package/js/src/pro/probit.js +14 -12
  279. package/js/src/pro/upbit.js +8 -8
  280. package/js/src/pro/wazirx.d.ts +1 -1
  281. package/js/src/pro/wazirx.js +6 -3
  282. package/js/src/pro/woo.d.ts +3 -3
  283. package/js/src/pro/woo.js +8 -6
  284. package/js/src/probit.d.ts +3 -3
  285. package/js/src/probit.js +3 -3
  286. package/js/src/timex.d.ts +1 -1
  287. package/js/src/tokocrypto.d.ts +3 -3
  288. package/js/src/tokocrypto.js +2 -2
  289. package/js/src/upbit.d.ts +2 -2
  290. package/js/src/wavesexchange.d.ts +3 -4
  291. package/js/src/wavesexchange.js +2 -1
  292. package/js/src/wazirx.d.ts +1 -1
  293. package/js/src/whitebit.d.ts +5 -15
  294. package/js/src/woo.d.ts +5 -15
  295. package/js/src/woo.js +1 -1
  296. package/js/src/yobit.d.ts +21 -6
  297. package/js/src/yobit.js +39 -0
  298. package/js/src/zaif.d.ts +2 -2
  299. package/js/src/zonda.d.ts +4 -14
  300. package/package.json +22 -8
  301. package/skip-tests.json +9 -1
  302. package/tests-manager.sh +1 -2
@@ -960,15 +960,15 @@ class cex extends cex$1 {
960
960
  const messageHash = 'orderbook:' + symbol;
961
961
  const timestamp = this.safeInteger2(data, 'timestamp_ms', 'timestamp');
962
962
  const incrementalId = this.safeNumber(data, 'id');
963
- const storedOrderBook = this.orderBook({});
963
+ const orderbook = this.orderBook({});
964
964
  const snapshot = this.parseOrderBook(data, symbol, timestamp, 'bids', 'asks');
965
965
  snapshot['nonce'] = incrementalId;
966
- storedOrderBook.reset(snapshot);
966
+ orderbook.reset(snapshot);
967
967
  this.options['orderbook'][symbol] = {
968
968
  'incrementalId': incrementalId,
969
969
  };
970
- this.orderbooks[symbol] = storedOrderBook;
971
- client.resolve(storedOrderBook, messageHash);
970
+ this.orderbooks[symbol] = orderbook;
971
+ client.resolve(orderbook, messageHash);
972
972
  }
973
973
  pairToSymbol(pair) {
974
974
  const parts = pair.split(':');
@@ -1434,7 +1434,8 @@ class cex extends cex$1 {
1434
1434
  handleMessage(client, message) {
1435
1435
  const ok = this.safeString(message, 'ok');
1436
1436
  if (ok === 'error') {
1437
- return this.handleErrorMessage(client, message);
1437
+ this.handleErrorMessage(client, message);
1438
+ return;
1438
1439
  }
1439
1440
  const event = this.safeString(message, 'e');
1440
1441
  const handlers = {
@@ -1462,9 +1463,8 @@ class cex extends cex$1 {
1462
1463
  };
1463
1464
  const handler = this.safeValue(handlers, event);
1464
1465
  if (handler !== undefined) {
1465
- return handler.call(this, client, message);
1466
+ handler.call(this, client, message);
1466
1467
  }
1467
- return message;
1468
1468
  }
1469
1469
  handleAuthenticationMessage(client, message) {
1470
1470
  //
@@ -461,7 +461,8 @@ class coinbase extends coinbase$1 {
461
461
  const side = this.safeString(this.options['sides'], sideId);
462
462
  const price = this.safeNumber(trade, 'price_level');
463
463
  const amount = this.safeNumber(trade, 'new_quantity');
464
- orderbook[side].store(price, amount);
464
+ const orderbookSide = orderbook[side];
465
+ orderbookSide.store(price, amount);
465
466
  }
466
467
  }
467
468
  handleOrderBook(client, message) {
@@ -554,7 +555,7 @@ class coinbase extends coinbase$1 {
554
555
  throw new errors.ExchangeError(errorMessage);
555
556
  }
556
557
  const method = this.safeValue(methods, channel);
557
- return method.call(this, client, message);
558
+ method.call(this, client, message);
558
559
  }
559
560
  }
560
561
 
@@ -960,7 +960,7 @@ class coinbasepro extends coinbasepro$1 {
960
960
  }
961
961
  }
962
962
  else {
963
- return method.call(this, client, message);
963
+ method.call(this, client, message);
964
964
  }
965
965
  }
966
966
  }
@@ -653,29 +653,29 @@ class coinex extends coinex$1 {
653
653
  //
654
654
  const params = this.safeValue(message, 'params', []);
655
655
  const fullOrderBook = this.safeValue(params, 0);
656
- let orderBook = this.safeValue(params, 1);
656
+ let orderbook = this.safeValue(params, 1);
657
657
  const marketId = this.safeString(params, 2);
658
658
  const defaultType = this.safeString(this.options, 'defaultType');
659
659
  const market = this.safeMarket(marketId, undefined, undefined, defaultType);
660
660
  const symbol = market['symbol'];
661
661
  const name = 'orderbook';
662
662
  const messageHash = name + ':' + symbol;
663
- const timestamp = this.safeInteger(orderBook, 'time');
663
+ const timestamp = this.safeInteger(orderbook, 'time');
664
664
  const currentOrderBook = this.safeValue(this.orderbooks, symbol);
665
665
  if (fullOrderBook) {
666
- const snapshot = this.parseOrderBook(orderBook, symbol, timestamp);
666
+ const snapshot = this.parseOrderBook(orderbook, symbol, timestamp);
667
667
  if (currentOrderBook === undefined) {
668
- orderBook = this.orderBook(snapshot);
669
- this.orderbooks[symbol] = orderBook;
668
+ orderbook = this.orderBook(snapshot);
669
+ this.orderbooks[symbol] = orderbook;
670
670
  }
671
671
  else {
672
- orderBook = this.orderbooks[symbol];
673
- orderBook.reset(snapshot);
672
+ orderbook = this.orderbooks[symbol];
673
+ orderbook.reset(snapshot);
674
674
  }
675
675
  }
676
676
  else {
677
- const asks = this.safeValue(orderBook, 'asks', []);
678
- const bids = this.safeValue(orderBook, 'bids', []);
677
+ const asks = this.safeValue(orderbook, 'asks', []);
678
+ const bids = this.safeValue(orderbook, 'bids', []);
679
679
  this.handleDeltas(currentOrderBook['asks'], asks);
680
680
  this.handleDeltas(currentOrderBook['bids'], bids);
681
681
  currentOrderBook['nonce'] = timestamp;
@@ -996,9 +996,10 @@ class coinex extends coinex$1 {
996
996
  };
997
997
  const handler = this.safeValue(handlers, method);
998
998
  if (handler !== undefined) {
999
- return handler.call(this, client, message);
999
+ handler.call(this, client, message);
1000
+ return;
1000
1001
  }
1001
- return this.handleSubscriptionStatus(client, message);
1002
+ this.handleSubscriptionStatus(client, message);
1002
1003
  }
1003
1004
  handleAuthenticationMessage(client, message) {
1004
1005
  //
@@ -1022,7 +1023,8 @@ class coinex extends coinex$1 {
1022
1023
  if (subscription !== undefined) {
1023
1024
  const futureIndex = this.safeString(subscription, 'future');
1024
1025
  if (futureIndex === 'ohlcv') {
1025
- return this.handleOHLCV(client, message);
1026
+ this.handleOHLCV(client, message);
1027
+ return;
1026
1028
  }
1027
1029
  const future = this.safeValue(client.futures, futureIndex);
1028
1030
  if (future !== undefined) {
@@ -1031,7 +1033,7 @@ class coinex extends coinex$1 {
1031
1033
  delete client.subscriptions[id];
1032
1034
  }
1033
1035
  }
1034
- authenticate(params = {}) {
1036
+ async authenticate(params = {}) {
1035
1037
  let type = undefined;
1036
1038
  [type, params] = this.handleMarketTypeAndParams('authenticate', undefined, params);
1037
1039
  const url = this.urls['api']['ws'][type];
@@ -532,10 +532,11 @@ class currencycom extends currencycom$1 {
532
532
  };
533
533
  const method = this.safeValue(methods, subscriptionDestination);
534
534
  if (method === undefined) {
535
- return message;
535
+ return;
536
536
  }
537
537
  else {
538
- return method.call(this, client, message, subscription);
538
+ method.call(this, client, message, subscription);
539
+ return;
539
540
  }
540
541
  }
541
542
  }
@@ -550,11 +551,8 @@ class currencycom extends currencycom$1 {
550
551
  'ping': this.handlePong,
551
552
  };
552
553
  const method = this.safeValue(methods, destination);
553
- if (method === undefined) {
554
- return message;
555
- }
556
- else {
557
- return method.call(this, client, message);
554
+ if (method !== undefined) {
555
+ method.call(this, client, message);
558
556
  }
559
557
  }
560
558
  }
@@ -757,16 +757,16 @@ class deribit extends deribit$1 {
757
757
  };
758
758
  const handler = this.safeValue(handlers, channelId);
759
759
  if (handler !== undefined) {
760
- return handler.call(this, client, message);
760
+ handler.call(this, client, message);
761
+ return;
761
762
  }
762
763
  throw new errors.NotSupported(this.id + ' no handler found for this message ' + this.json(message));
763
764
  }
764
765
  const result = this.safeValue(message, 'result', {});
765
766
  const accessToken = this.safeString(result, 'access_token');
766
767
  if (accessToken !== undefined) {
767
- return this.handleAuthenticationMessage(client, message);
768
+ this.handleAuthenticationMessage(client, message);
768
769
  }
769
- return message;
770
770
  }
771
771
  handleAuthenticationMessage(client, message) {
772
772
  //
@@ -790,7 +790,7 @@ class deribit extends deribit$1 {
790
790
  client.resolve(message, messageHash);
791
791
  return message;
792
792
  }
793
- authenticate(params = {}) {
793
+ async authenticate(params = {}) {
794
794
  const url = this.urls['api']['ws'];
795
795
  const client = this.client(url);
796
796
  const time = this.milliseconds();
@@ -512,25 +512,25 @@ class exmo extends exmo$1 {
512
512
  const orderBook = this.safeValue(message, 'data', {});
513
513
  const messageHash = 'orderbook:' + symbol;
514
514
  const timestamp = this.safeInteger(message, 'ts');
515
- let storedOrderBook = this.safeValue(this.orderbooks, symbol);
516
- if (storedOrderBook === undefined) {
517
- storedOrderBook = this.orderBook({});
518
- this.orderbooks[symbol] = storedOrderBook;
515
+ let orderbook = this.safeValue(this.orderbooks, symbol);
516
+ if (orderbook === undefined) {
517
+ orderbook = this.orderBook({});
518
+ this.orderbooks[symbol] = orderbook;
519
519
  }
520
520
  const event = this.safeString(message, 'event');
521
521
  if (event === 'snapshot') {
522
522
  const snapshot = this.parseOrderBook(orderBook, symbol, timestamp, 'bid', 'ask');
523
- storedOrderBook.reset(snapshot);
523
+ orderbook.reset(snapshot);
524
524
  }
525
525
  else {
526
526
  const asks = this.safeValue(orderBook, 'ask', []);
527
527
  const bids = this.safeValue(orderBook, 'bid', []);
528
- this.handleDeltas(storedOrderBook['asks'], asks);
529
- this.handleDeltas(storedOrderBook['bids'], bids);
530
- storedOrderBook['timestamp'] = timestamp;
531
- storedOrderBook['datetime'] = this.iso8601(timestamp);
528
+ this.handleDeltas(orderbook['asks'], asks);
529
+ this.handleDeltas(orderbook['bids'], bids);
530
+ orderbook['timestamp'] = timestamp;
531
+ orderbook['datetime'] = this.iso8601(timestamp);
532
532
  }
533
- client.resolve(storedOrderBook, messageHash);
533
+ client.resolve(orderbook, messageHash);
534
534
  }
535
535
  handleDelta(bookside, delta) {
536
536
  const bidAsk = this.parseBidAsk(delta, 0, 1);
@@ -565,7 +565,8 @@ class exmo extends exmo$1 {
565
565
  };
566
566
  const eventHandler = this.safeValue(events, event);
567
567
  if (eventHandler !== undefined) {
568
- return eventHandler.call(this, client, message);
568
+ eventHandler.call(this, client, message);
569
+ return;
569
570
  }
570
571
  if ((event === 'update') || (event === 'snapshot')) {
571
572
  const topic = this.safeString(message, 'topic');
@@ -587,7 +588,8 @@ class exmo extends exmo$1 {
587
588
  };
588
589
  const handler = this.safeValue(handlers, channel);
589
590
  if (handler !== undefined) {
590
- return handler.call(this, client, message);
591
+ handler.call(this, client, message);
592
+ return;
591
593
  }
592
594
  }
593
595
  }
@@ -628,7 +630,7 @@ class exmo extends exmo$1 {
628
630
  const messageHash = 'authenticated';
629
631
  client.resolve(message, messageHash);
630
632
  }
631
- authenticate(params = {}) {
633
+ async authenticate(params = {}) {
632
634
  const messageHash = 'authenticated';
633
635
  const [type, query] = this.handleMarketTypeAndParams('authenticate', undefined, params);
634
636
  const url = this.urls['api']['ws'][type];
@@ -207,7 +207,7 @@ class gate extends gate$1 {
207
207
  // max limit is 100
208
208
  const subscription = client.subscriptions[messageHash];
209
209
  const limit = this.safeInteger(subscription, 'limit');
210
- this.spawn(this.loadOrderBook, client, messageHash, symbol, limit);
210
+ this.spawn(this.loadOrderBook, client, messageHash, symbol, limit, {}); // needed for c#, number of args needs to match
211
211
  }
212
212
  storedOrderBook.cache.push(delta);
213
213
  return;
@@ -588,7 +588,8 @@ class gemini extends gemini$1 {
588
588
  //
589
589
  const isArray = Array.isArray(message);
590
590
  if (isArray) {
591
- return this.handleOrder(client, message);
591
+ this.handleOrder(client, message);
592
+ return;
592
593
  }
593
594
  const reason = this.safeString(message, 'reason');
594
595
  if (reason === 'error') {
@@ -602,7 +603,8 @@ class gemini extends gemini$1 {
602
603
  };
603
604
  const type = this.safeString(message, 'type', '');
604
605
  if (type.indexOf('candles') >= 0) {
605
- return this.handleOHLCV(client, message);
606
+ this.handleOHLCV(client, message);
607
+ return;
606
608
  }
607
609
  const method = this.safeValue(methods, type);
608
610
  if (method !== undefined) {
@@ -115,7 +115,7 @@ class hitbtc extends hitbtc$1 {
115
115
  }
116
116
  return future;
117
117
  }
118
- async subscribePublic(name, symbols = undefined, params = {}) {
118
+ async subscribePublic(name, messageHashPrefix, symbols = undefined, params = {}) {
119
119
  /**
120
120
  * @ignore
121
121
  * @method
@@ -125,7 +125,7 @@ class hitbtc extends hitbtc$1 {
125
125
  */
126
126
  await this.loadMarkets();
127
127
  const url = this.urls['api']['ws']['public'];
128
- let messageHash = name;
128
+ let messageHash = messageHashPrefix;
129
129
  if (symbols !== undefined) {
130
130
  messageHash = messageHash + '::' + symbols.join(',');
131
131
  }
@@ -220,7 +220,7 @@ class hitbtc extends hitbtc$1 {
220
220
  'symbols': [market['id']],
221
221
  },
222
222
  };
223
- const orderbook = await this.subscribePublic(name, [symbol], this.deepExtend(request, params));
223
+ const orderbook = await this.subscribePublic(name, name, [symbol], this.deepExtend(request, params));
224
224
  return orderbook.limit();
225
225
  }
226
226
  handleOrderBook(client, message) {
@@ -313,7 +313,7 @@ class hitbtc extends hitbtc$1 {
313
313
  'symbols': [market['id']],
314
314
  },
315
315
  };
316
- const result = await this.subscribePublic(name, [symbol], this.deepExtend(request, params));
316
+ const result = await this.subscribePublic(name, 'ticker', [symbol], this.deepExtend(request, params));
317
317
  return this.safeValue(result, symbol);
318
318
  }
319
319
  async watchTickers(symbols = undefined, params = {}) {
@@ -349,7 +349,7 @@ class hitbtc extends hitbtc$1 {
349
349
  'symbols': marketIds,
350
350
  },
351
351
  };
352
- const tickers = await this.subscribePublic(name, symbols, this.deepExtend(request, params));
352
+ const tickers = await this.subscribePublic(name, 'tickers', symbols, this.deepExtend(request, params));
353
353
  if (this.newUpdates) {
354
354
  return tickers;
355
355
  }
@@ -408,7 +408,7 @@ class hitbtc extends hitbtc$1 {
408
408
  const messageHash = channel + '::' + symbol;
409
409
  client.resolve(newTickers, messageHash);
410
410
  }
411
- const messageHashes = this.findMessageHashes(client, channel + '::');
411
+ const messageHashes = this.findMessageHashes(client, 'tickers::');
412
412
  for (let i = 0; i < messageHashes.length; i++) {
413
413
  const messageHash = messageHashes[i];
414
414
  const parts = messageHash.split('::');
@@ -501,7 +501,8 @@ class hitbtc extends hitbtc$1 {
501
501
  if (limit !== undefined) {
502
502
  request['limit'] = limit;
503
503
  }
504
- const trades = await this.subscribePublic('trades', [symbol], this.deepExtend(request, params));
504
+ const name = 'trades';
505
+ const trades = await this.subscribePublic(name, name, [symbol], this.deepExtend(request, params));
505
506
  if (this.newUpdates) {
506
507
  limit = trades.getLimit(symbol, limit);
507
508
  }
@@ -630,7 +631,7 @@ class hitbtc extends hitbtc$1 {
630
631
  if (limit !== undefined) {
631
632
  request['params']['limit'] = limit;
632
633
  }
633
- const ohlcv = await this.subscribePublic(name, [symbol], this.deepExtend(request, params));
634
+ const ohlcv = await this.subscribePublic(name, name, [symbol], this.deepExtend(request, params));
634
635
  if (this.newUpdates) {
635
636
  limit = ohlcv.getLimit(symbol, limit);
636
637
  }
@@ -218,7 +218,7 @@ class hollaex extends hollaex$1 {
218
218
  // when the user does not have any trades yet
219
219
  const dataLength = rawTrades.length;
220
220
  if (dataLength === 0) {
221
- return 0;
221
+ return;
222
222
  }
223
223
  if (this.myTrades === undefined) {
224
224
  const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
@@ -332,7 +332,7 @@ class hollaex extends hollaex$1 {
332
332
  // usually the first message is an empty array
333
333
  const dataLength = data.length;
334
334
  if (dataLength === 0) {
335
- return 0;
335
+ return;
336
336
  }
337
337
  if (this.orders === undefined) {
338
338
  const limit = this.safeInteger(this.options, 'ordersLimit', 1000);
@@ -469,6 +469,7 @@ class htx extends htx$1 {
469
469
  delete client.subscriptions[messageHash];
470
470
  client.reject(e, messageHash);
471
471
  }
472
+ return undefined;
472
473
  }
473
474
  handleDelta(bookside, delta) {
474
475
  const price = this.safeFloat(delta, 0);
@@ -1689,14 +1690,14 @@ class htx extends htx$1 {
1689
1690
  if (subscription !== undefined) {
1690
1691
  const method = this.safeValue(subscription, 'method');
1691
1692
  if (method !== undefined) {
1692
- return method.call(this, client, message, subscription);
1693
+ method.call(this, client, message, subscription);
1694
+ return;
1693
1695
  }
1694
1696
  // clean up
1695
1697
  if (id in client.subscriptions) {
1696
1698
  delete client.subscriptions[id];
1697
1699
  }
1698
1700
  }
1699
- return message;
1700
1701
  }
1701
1702
  handleSystemStatus(client, message) {
1702
1703
  //
@@ -1805,11 +1806,9 @@ class htx extends htx$1 {
1805
1806
  'kline': this.handleOHLCV,
1806
1807
  };
1807
1808
  const method = this.safeValue(methods, methodName);
1808
- if (method === undefined) {
1809
- return message;
1810
- }
1811
- else {
1812
- return method.call(this, client, message);
1809
+ if (method !== undefined) {
1810
+ method.call(this, client, message);
1811
+ return;
1813
1812
  }
1814
1813
  }
1815
1814
  // private spot subjects
@@ -361,6 +361,7 @@ class huobijp extends huobijp$1 {
361
361
  delete client.subscriptions[messageHash];
362
362
  client.reject(e, messageHash);
363
363
  }
364
+ return undefined;
364
365
  }
365
366
  handleDelta(bookside, delta) {
366
367
  const price = this.safeFloat(delta, 0);
@@ -526,11 +527,8 @@ class huobijp extends huobijp$1 {
526
527
  // ...
527
528
  };
528
529
  const method = this.safeValue(methods, methodName);
529
- if (method === undefined) {
530
- return message;
531
- }
532
- else {
533
- return method.call(this, client, message);
530
+ if (method !== undefined) {
531
+ method.call(this, client, message);
534
532
  }
535
533
  }
536
534
  }
@@ -324,7 +324,7 @@ class idex extends idex$1 {
324
324
  const symbol = this.safeSymbol(marketId);
325
325
  if (!(symbol in this.orderbooks)) {
326
326
  const orderbook = this.countedOrderBook({});
327
- orderbook.cache = [];
327
+ // orderbook.cache = []; // cache is never used?
328
328
  this.orderbooks[symbol] = orderbook;
329
329
  }
330
330
  this.spawn(this.fetchOrderBookSnapshot, client, symbol);
@@ -178,28 +178,28 @@ class independentreserve extends independentreserve$1 {
178
178
  const subscription = this.safeValue(client.subscriptions, messageHash, {});
179
179
  const receivedSnapshot = this.safeBool(subscription, 'receivedSnapshot', false);
180
180
  const timestamp = this.safeInteger(message, 'Time');
181
- let storedOrderBook = this.safeValue(this.orderbooks, symbol);
182
- if (storedOrderBook === undefined) {
183
- storedOrderBook = this.orderBook({});
184
- this.orderbooks[symbol] = storedOrderBook;
181
+ let orderbook = this.safeValue(this.orderbooks, symbol);
182
+ if (orderbook === undefined) {
183
+ orderbook = this.orderBook({});
184
+ this.orderbooks[symbol] = orderbook;
185
185
  }
186
186
  if (event === 'OrderBookSnapshot') {
187
187
  const snapshot = this.parseOrderBook(orderBook, symbol, timestamp, 'Bids', 'Offers', 'Price', 'Volume');
188
- storedOrderBook.reset(snapshot);
188
+ orderbook.reset(snapshot);
189
189
  subscription['receivedSnapshot'] = true;
190
190
  }
191
191
  else {
192
192
  const asks = this.safeValue(orderBook, 'Offers', []);
193
193
  const bids = this.safeValue(orderBook, 'Bids', []);
194
- this.handleDeltas(storedOrderBook['asks'], asks);
195
- this.handleDeltas(storedOrderBook['bids'], bids);
196
- storedOrderBook['timestamp'] = timestamp;
197
- storedOrderBook['datetime'] = this.iso8601(timestamp);
194
+ this.handleDeltas(orderbook['asks'], asks);
195
+ this.handleDeltas(orderbook['bids'], bids);
196
+ orderbook['timestamp'] = timestamp;
197
+ orderbook['datetime'] = this.iso8601(timestamp);
198
198
  }
199
199
  const checksum = this.safeValue(this.options, 'checksum', true);
200
200
  if (checksum && receivedSnapshot) {
201
- const storedAsks = storedOrderBook['asks'];
202
- const storedBids = storedOrderBook['bids'];
201
+ const storedAsks = orderbook['asks'];
202
+ const storedBids = orderbook['bids'];
203
203
  const asksLength = storedAsks.length;
204
204
  const bidsLength = storedBids.length;
205
205
  let payload = '';
@@ -221,7 +221,7 @@ class independentreserve extends independentreserve$1 {
221
221
  }
222
222
  }
223
223
  if (receivedSnapshot) {
224
- client.resolve(storedOrderBook, messageHash);
224
+ client.resolve(orderbook, messageHash);
225
225
  }
226
226
  }
227
227
  valueToChecksum(value) {
@@ -271,7 +271,8 @@ class independentreserve extends independentreserve$1 {
271
271
  };
272
272
  const handler = this.safeValue(handlers, event);
273
273
  if (handler !== undefined) {
274
- return handler.call(this, client, message);
274
+ handler.call(this, client, message);
275
+ return;
275
276
  }
276
277
  throw new errors.NotSupported(this.id + ' received an unsupported message: ' + this.json(message));
277
278
  }
@@ -656,7 +656,7 @@ class kraken extends kraken$1 {
656
656
  const side = sides[key];
657
657
  const bookside = orderbook[side];
658
658
  const deltas = this.safeValue(message[1], key, []);
659
- timestamp = this.handleDeltas(bookside, deltas, timestamp);
659
+ timestamp = this.customHandleDeltas(bookside, deltas, timestamp);
660
660
  }
661
661
  orderbook['symbol'] = symbol;
662
662
  orderbook['timestamp'] = timestamp;
@@ -688,11 +688,11 @@ class kraken extends kraken$1 {
688
688
  const storedBids = orderbook['bids'];
689
689
  let example = undefined;
690
690
  if (a !== undefined) {
691
- timestamp = this.handleDeltas(storedAsks, a, timestamp);
691
+ timestamp = this.customHandleDeltas(storedAsks, a, timestamp);
692
692
  example = this.safeValue(a, 0);
693
693
  }
694
694
  if (b !== undefined) {
695
- timestamp = this.handleDeltas(storedBids, b, timestamp);
695
+ timestamp = this.customHandleDeltas(storedBids, b, timestamp);
696
696
  example = this.safeValue(b, 0);
697
697
  }
698
698
  // don't remove this line or I will poop on your face
@@ -747,7 +747,7 @@ class kraken extends kraken$1 {
747
747
  return joined;
748
748
  }
749
749
  }
750
- handleDeltas(bookside, deltas, timestamp = undefined) {
750
+ customHandleDeltas(bookside, deltas, timestamp = undefined) {
751
751
  for (let j = 0; j < deltas.length; j++) {
752
752
  const delta = deltas[j];
753
753
  const price = this.parseNumber(delta[0]);
@@ -1292,7 +1292,7 @@ class kraken extends kraken$1 {
1292
1292
  // "subscription": { name: "ticker" }
1293
1293
  // }
1294
1294
  //
1295
- const errorMessage = this.safeValue(message, 'errorMessage');
1295
+ const errorMessage = this.safeString(message, 'errorMessage');
1296
1296
  if (errorMessage !== undefined) {
1297
1297
  const requestId = this.safeValue(message, 'reqid');
1298
1298
  if (requestId !== undefined) {
@@ -1300,7 +1300,7 @@ class kraken extends kraken$1 {
1300
1300
  const broadKey = this.findBroadlyMatchedKey(broad, errorMessage);
1301
1301
  let exception = undefined;
1302
1302
  if (broadKey === undefined) {
1303
- exception = new errors.ExchangeError(errorMessage);
1303
+ exception = new errors.ExchangeError(errorMessage); // c# requirement to convert the errorMessage to string
1304
1304
  }
1305
1305
  else {
1306
1306
  exception = new broad[broadKey](errorMessage);
@@ -1330,11 +1330,8 @@ class kraken extends kraken$1 {
1330
1330
  'ownTrades': this.handleMyTrades,
1331
1331
  };
1332
1332
  const method = this.safeValue2(methods, name, channelName);
1333
- if (method === undefined) {
1334
- return message;
1335
- }
1336
- else {
1337
- return method.call(this, client, message, subscription);
1333
+ if (method !== undefined) {
1334
+ method.call(this, client, message, subscription);
1338
1335
  }
1339
1336
  }
1340
1337
  else {
@@ -1350,11 +1347,8 @@ class kraken extends kraken$1 {
1350
1347
  'cancelAllStatus': this.handleCancelAllOrders,
1351
1348
  };
1352
1349
  const method = this.safeValue(methods, event);
1353
- if (method === undefined) {
1354
- return message;
1355
- }
1356
- else {
1357
- return method.call(this, client, message);
1350
+ if (method !== undefined) {
1351
+ method.call(this, client, message);
1358
1352
  }
1359
1353
  }
1360
1354
  }
@@ -1064,13 +1064,15 @@ class krakenfutures extends krakenfutures$1 {
1064
1064
  const bid = bids[i];
1065
1065
  const price = this.safeNumber(bid, 'price');
1066
1066
  const qty = this.safeNumber(bid, 'qty');
1067
- orderbook['bids'].store(price, qty);
1067
+ const bidsSide = orderbook['bids'];
1068
+ bidsSide.store(price, qty);
1068
1069
  }
1069
1070
  for (let i = 0; i < asks.length; i++) {
1070
1071
  const ask = asks[i];
1071
1072
  const price = this.safeNumber(ask, 'price');
1072
1073
  const qty = this.safeNumber(ask, 'qty');
1073
- orderbook['asks'].store(price, qty);
1074
+ const asksSide = orderbook['asks'];
1075
+ asksSide.store(price, qty);
1074
1076
  }
1075
1077
  orderbook['timestamp'] = timestamp;
1076
1078
  orderbook['datetime'] = this.iso8601(timestamp);
@@ -1099,10 +1101,12 @@ class krakenfutures extends krakenfutures$1 {
1099
1101
  const qty = this.safeNumber(message, 'qty');
1100
1102
  const timestamp = this.safeInteger(message, 'timestamp');
1101
1103
  if (side === 'sell') {
1102
- orderbook['asks'].store(price, qty);
1104
+ const asks = orderbook['asks'];
1105
+ asks.store(price, qty);
1103
1106
  }
1104
1107
  else {
1105
- orderbook['bids'].store(price, qty);
1108
+ const bids = orderbook['bids'];
1109
+ bids.store(price, qty);
1106
1110
  }
1107
1111
  orderbook['timestamp'] = timestamp;
1108
1112
  orderbook['datetime'] = this.iso8601(timestamp);
@@ -1438,7 +1442,7 @@ class krakenfutures extends krakenfutures$1 {
1438
1442
  this.handleAuthenticate(client, message);
1439
1443
  }
1440
1444
  else if (event === 'alert') {
1441
- return this.handleErrorMessage(client, message);
1445
+ this.handleErrorMessage(client, message);
1442
1446
  }
1443
1447
  else if (event === 'pong') {
1444
1448
  client.lastPong = this.milliseconds();
@@ -1465,7 +1469,7 @@ class krakenfutures extends krakenfutures$1 {
1465
1469
  };
1466
1470
  const method = this.safeValue(methods, feed);
1467
1471
  if (method !== undefined) {
1468
- return method.call(this, client, message);
1472
+ method.call(this, client, message);
1469
1473
  }
1470
1474
  }
1471
1475
  }