ccxt 4.2.30 → 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 (318) hide show
  1. package/.gitattributes +1 -0
  2. package/CONTRIBUTING.md +20 -1
  3. package/README.md +9 -9
  4. package/build.sh +9 -2
  5. package/cleanup.sh +3 -0
  6. package/dist/ccxt.browser.js +1136 -561
  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 +66 -24
  12. package/dist/cjs/src/bigone.js +21 -1
  13. package/dist/cjs/src/binance.js +6 -5
  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 +415 -41
  17. package/dist/cjs/src/bitforex.js +3 -0
  18. package/dist/cjs/src/bitget.js +3 -3
  19. package/dist/cjs/src/bitmart.js +1 -1
  20. package/dist/cjs/src/bitrue.js +3 -3
  21. package/dist/cjs/src/blockchaincom.js +1 -1
  22. package/dist/cjs/src/bybit.js +1 -1
  23. package/dist/cjs/src/coinbase.js +12 -2
  24. package/dist/cjs/src/coinex.js +1 -1
  25. package/dist/cjs/src/cryptocom.js +10 -10
  26. package/dist/cjs/src/deribit.js +1 -0
  27. package/dist/cjs/src/gate.js +34 -29
  28. package/dist/cjs/src/htx.js +1 -1
  29. package/dist/cjs/src/kraken.js +42 -1
  30. package/dist/cjs/src/krakenfutures.js +3 -0
  31. package/dist/cjs/src/kucoin.js +1 -1
  32. package/dist/cjs/src/lbank.js +27 -26
  33. package/dist/cjs/src/mexc.js +2 -1
  34. package/dist/cjs/src/okx.js +20 -5
  35. package/dist/cjs/src/phemex.js +8 -8
  36. package/dist/cjs/src/poloniexfutures.js +3 -0
  37. package/dist/cjs/src/pro/alpaca.js +8 -4
  38. package/dist/cjs/src/pro/ascendex.js +1 -2
  39. package/dist/cjs/src/pro/binance.js +14 -10
  40. package/dist/cjs/src/pro/bingx.js +1 -1
  41. package/dist/cjs/src/pro/bitfinex.js +21 -24
  42. package/dist/cjs/src/pro/bitfinex2.js +13 -17
  43. package/dist/cjs/src/pro/bitget.js +3 -1
  44. package/dist/cjs/src/pro/bitmart.js +3 -8
  45. package/dist/cjs/src/pro/bitmex.js +4 -7
  46. package/dist/cjs/src/pro/bitopro.js +2 -5
  47. package/dist/cjs/src/pro/bitrue.js +1 -1
  48. package/dist/cjs/src/pro/bitstamp.js +2 -3
  49. package/dist/cjs/src/pro/bitvavo.js +12 -5
  50. package/dist/cjs/src/pro/blockchaincom.js +22 -23
  51. package/dist/cjs/src/pro/bybit.js +5 -5
  52. package/dist/cjs/src/pro/cex.js +7 -7
  53. package/dist/cjs/src/pro/coinbase.js +3 -2
  54. package/dist/cjs/src/pro/coinbasepro.js +1 -1
  55. package/dist/cjs/src/pro/coinex.js +15 -13
  56. package/dist/cjs/src/pro/currencycom.js +5 -7
  57. package/dist/cjs/src/pro/deribit.js +4 -4
  58. package/dist/cjs/src/pro/exmo.js +15 -13
  59. package/dist/cjs/src/pro/gate.js +1 -1
  60. package/dist/cjs/src/pro/gemini.js +4 -2
  61. package/dist/cjs/src/pro/hitbtc.js +9 -8
  62. package/dist/cjs/src/pro/hollaex.js +2 -2
  63. package/dist/cjs/src/pro/htx.js +6 -7
  64. package/dist/cjs/src/pro/huobijp.js +3 -5
  65. package/dist/cjs/src/pro/idex.js +1 -1
  66. package/dist/cjs/src/pro/independentreserve.js +14 -13
  67. package/dist/cjs/src/pro/kraken.js +10 -16
  68. package/dist/cjs/src/pro/krakenfutures.js +10 -6
  69. package/dist/cjs/src/pro/kucoin.js +10 -11
  70. package/dist/cjs/src/pro/kucoinfutures.js +12 -11
  71. package/dist/cjs/src/pro/lbank.js +10 -10
  72. package/dist/cjs/src/pro/luno.js +12 -14
  73. package/dist/cjs/src/pro/mexc.js +3 -2
  74. package/dist/cjs/src/pro/ndax.js +7 -13
  75. package/dist/cjs/src/pro/okcoin.js +7 -12
  76. package/dist/cjs/src/pro/okx.js +6 -11
  77. package/dist/cjs/src/pro/onetrading.js +16 -15
  78. package/dist/cjs/src/pro/p2b.js +5 -3
  79. package/dist/cjs/src/pro/phemex.js +16 -11
  80. package/dist/cjs/src/pro/poloniex.js +6 -4
  81. package/dist/cjs/src/pro/poloniexfutures.js +14 -9
  82. package/dist/cjs/src/pro/probit.js +15 -11
  83. package/dist/cjs/src/pro/upbit.js +8 -8
  84. package/dist/cjs/src/pro/wazirx.js +6 -3
  85. package/dist/cjs/src/pro/woo.js +8 -6
  86. package/dist/cjs/src/probit.js +3 -3
  87. package/dist/cjs/src/timex.js +1 -1
  88. package/dist/cjs/src/tokocrypto.js +2 -2
  89. package/dist/cjs/src/wavesexchange.js +2 -1
  90. package/dist/cjs/src/whitebit.js +1 -1
  91. package/dist/cjs/src/woo.js +1 -1
  92. package/dist/cjs/src/yobit.js +39 -0
  93. package/js/ccxt.d.ts +1 -1
  94. package/js/ccxt.js +1 -1
  95. package/js/src/abstract/coinbase.d.ts +10 -0
  96. package/js/src/abstract/okx.d.ts +12 -1
  97. package/js/src/ace.d.ts +1 -1
  98. package/js/src/ace.js +3 -2
  99. package/js/src/alpaca.d.ts +1 -1
  100. package/js/src/ascendex.d.ts +5 -15
  101. package/js/src/ascendex.js +1 -1
  102. package/js/src/base/Exchange.d.ts +88 -79
  103. package/js/src/base/Exchange.js +66 -24
  104. package/js/src/base/types.d.ts +90 -6
  105. package/js/src/bigone.d.ts +5 -15
  106. package/js/src/bigone.js +21 -1
  107. package/js/src/binance.d.ts +13 -23
  108. package/js/src/binance.js +6 -5
  109. package/js/src/bingx.d.ts +6 -16
  110. package/js/src/bingx.js +4 -3
  111. package/js/src/bit2c.d.ts +1 -1
  112. package/js/src/bit2c.js +12 -0
  113. package/js/src/bitbank.d.ts +2 -2
  114. package/js/src/bitbns.d.ts +1 -1
  115. package/js/src/bitfinex.d.ts +5 -5
  116. package/js/src/bitfinex2.d.ts +11 -16
  117. package/js/src/bitfinex2.js +415 -41
  118. package/js/src/bitflyer.d.ts +5 -5
  119. package/js/src/bitforex.d.ts +1 -1
  120. package/js/src/bitforex.js +3 -0
  121. package/js/src/bitget.d.ts +8 -38
  122. package/js/src/bitget.js +3 -3
  123. package/js/src/bithumb.d.ts +2 -2
  124. package/js/src/bitmart.d.ts +10 -21
  125. package/js/src/bitmart.js +1 -1
  126. package/js/src/bitmex.d.ts +3 -3
  127. package/js/src/bitopro.d.ts +2 -2
  128. package/js/src/bitrue.d.ts +5 -15
  129. package/js/src/bitrue.js +3 -3
  130. package/js/src/bitso.d.ts +4 -4
  131. package/js/src/bitstamp.d.ts +2 -2
  132. package/js/src/bitteam.d.ts +1 -1
  133. package/js/src/bitvavo.d.ts +3 -3
  134. package/js/src/bl3p.d.ts +1 -1
  135. package/js/src/blockchaincom.d.ts +2 -2
  136. package/js/src/blockchaincom.js +1 -1
  137. package/js/src/btcalpha.d.ts +1 -1
  138. package/js/src/btcbox.d.ts +1 -1
  139. package/js/src/btcmarkets.d.ts +3 -3
  140. package/js/src/btcturk.d.ts +1 -1
  141. package/js/src/bybit.d.ts +8 -8
  142. package/js/src/bybit.js +1 -1
  143. package/js/src/cex.d.ts +1 -1
  144. package/js/src/coinbase.d.ts +6 -50
  145. package/js/src/coinbase.js +12 -2
  146. package/js/src/coinbasepro.d.ts +2 -2
  147. package/js/src/coincheck.d.ts +1 -1
  148. package/js/src/coinex.d.ts +8 -8
  149. package/js/src/coinex.js +1 -1
  150. package/js/src/coinlist.d.ts +4 -14
  151. package/js/src/coinmate.d.ts +2 -2
  152. package/js/src/coinmetro.d.ts +2 -2
  153. package/js/src/coinone.d.ts +1 -1
  154. package/js/src/coinsph.d.ts +2 -2
  155. package/js/src/coinspot.d.ts +1 -1
  156. package/js/src/cryptocom.d.ts +4 -4
  157. package/js/src/cryptocom.js +10 -10
  158. package/js/src/currencycom.d.ts +2 -2
  159. package/js/src/delta.d.ts +2 -2
  160. package/js/src/deribit.d.ts +4 -14
  161. package/js/src/deribit.js +1 -0
  162. package/js/src/digifinex.d.ts +10 -38
  163. package/js/src/exmo.d.ts +2 -2
  164. package/js/src/gate.d.ts +8 -18
  165. package/js/src/gate.js +34 -29
  166. package/js/src/gemini.d.ts +2 -2
  167. package/js/src/hitbtc.d.ts +6 -16
  168. package/js/src/hollaex.d.ts +2 -2
  169. package/js/src/htx.d.ts +11 -21
  170. package/js/src/htx.js +1 -1
  171. package/js/src/huobijp.d.ts +4 -4
  172. package/js/src/idex.d.ts +3 -3
  173. package/js/src/independentreserve.d.ts +2 -2
  174. package/js/src/indodax.d.ts +2 -2
  175. package/js/src/kraken.d.ts +5 -5
  176. package/js/src/kraken.js +42 -1
  177. package/js/src/krakenfutures.d.ts +7 -7
  178. package/js/src/krakenfutures.js +3 -0
  179. package/js/src/kucoin.d.ts +8 -29
  180. package/js/src/kucoin.js +1 -1
  181. package/js/src/kucoinfutures.d.ts +4 -4
  182. package/js/src/kuna.d.ts +2 -2
  183. package/js/src/latoken.d.ts +4 -14
  184. package/js/src/lbank.d.ts +3 -6
  185. package/js/src/lbank.js +27 -26
  186. package/js/src/luno.d.ts +1 -1
  187. package/js/src/lykke.d.ts +2 -2
  188. package/js/src/mercado.d.ts +2 -2
  189. package/js/src/mexc.d.ts +6 -6
  190. package/js/src/mexc.js +2 -1
  191. package/js/src/ndax.d.ts +2 -2
  192. package/js/src/novadax.d.ts +4 -15
  193. package/js/src/oceanex.d.ts +1 -1
  194. package/js/src/okcoin.d.ts +5 -15
  195. package/js/src/okx.d.ts +8 -18
  196. package/js/src/okx.js +20 -5
  197. package/js/src/onetrading.d.ts +2 -2
  198. package/js/src/p2b.d.ts +1 -1
  199. package/js/src/paymium.d.ts +3 -13
  200. package/js/src/phemex.d.ts +5 -5
  201. package/js/src/phemex.js +8 -8
  202. package/js/src/poloniex.d.ts +4 -14
  203. package/js/src/poloniexfutures.d.ts +1 -1
  204. package/js/src/poloniexfutures.js +3 -0
  205. package/js/src/pro/alpaca.d.ts +2 -2
  206. package/js/src/pro/alpaca.js +8 -4
  207. package/js/src/pro/ascendex.d.ts +2 -2
  208. package/js/src/pro/ascendex.js +1 -2
  209. package/js/src/pro/binance.d.ts +3 -3
  210. package/js/src/pro/binance.js +14 -10
  211. package/js/src/pro/bingx.d.ts +1 -1
  212. package/js/src/pro/bingx.js +1 -1
  213. package/js/src/pro/bitfinex.d.ts +2 -2
  214. package/js/src/pro/bitfinex.js +21 -24
  215. package/js/src/pro/bitfinex2.d.ts +2 -2
  216. package/js/src/pro/bitfinex2.js +13 -17
  217. package/js/src/pro/bitget.js +3 -1
  218. package/js/src/pro/bitmart.d.ts +3 -3
  219. package/js/src/pro/bitmart.js +3 -8
  220. package/js/src/pro/bitmex.d.ts +1 -1
  221. package/js/src/pro/bitmex.js +4 -7
  222. package/js/src/pro/bitopro.d.ts +1 -1
  223. package/js/src/pro/bitopro.js +2 -5
  224. package/js/src/pro/bitrue.js +1 -1
  225. package/js/src/pro/bitstamp.d.ts +1 -1
  226. package/js/src/pro/bitstamp.js +2 -3
  227. package/js/src/pro/bitvavo.d.ts +3 -3
  228. package/js/src/pro/bitvavo.js +12 -5
  229. package/js/src/pro/blockchaincom.d.ts +8 -8
  230. package/js/src/pro/blockchaincom.js +22 -23
  231. package/js/src/pro/bybit.d.ts +2 -2
  232. package/js/src/pro/bybit.js +5 -5
  233. package/js/src/pro/cex.d.ts +1 -1
  234. package/js/src/pro/cex.js +7 -7
  235. package/js/src/pro/coinbase.d.ts +1 -1
  236. package/js/src/pro/coinbase.js +3 -2
  237. package/js/src/pro/coinbasepro.d.ts +1 -1
  238. package/js/src/pro/coinbasepro.js +1 -1
  239. package/js/src/pro/coinex.d.ts +2 -2
  240. package/js/src/pro/coinex.js +15 -13
  241. package/js/src/pro/currencycom.d.ts +1 -1
  242. package/js/src/pro/currencycom.js +5 -7
  243. package/js/src/pro/deribit.d.ts +2 -2
  244. package/js/src/pro/deribit.js +4 -4
  245. package/js/src/pro/exmo.d.ts +2 -2
  246. package/js/src/pro/exmo.js +15 -13
  247. package/js/src/pro/gate.js +1 -1
  248. package/js/src/pro/gemini.d.ts +1 -1
  249. package/js/src/pro/gemini.js +4 -2
  250. package/js/src/pro/hitbtc.d.ts +2 -2
  251. package/js/src/pro/hitbtc.js +9 -8
  252. package/js/src/pro/hollaex.d.ts +2 -2
  253. package/js/src/pro/hollaex.js +2 -2
  254. package/js/src/pro/htx.d.ts +2 -2
  255. package/js/src/pro/htx.js +6 -7
  256. package/js/src/pro/huobijp.d.ts +1 -1
  257. package/js/src/pro/huobijp.js +3 -5
  258. package/js/src/pro/idex.js +1 -1
  259. package/js/src/pro/independentreserve.d.ts +1 -1
  260. package/js/src/pro/independentreserve.js +14 -13
  261. package/js/src/pro/kraken.d.ts +2 -2
  262. package/js/src/pro/kraken.js +10 -16
  263. package/js/src/pro/krakenfutures.d.ts +1 -1
  264. package/js/src/pro/krakenfutures.js +10 -6
  265. package/js/src/pro/kucoin.d.ts +3 -3
  266. package/js/src/pro/kucoin.js +10 -11
  267. package/js/src/pro/kucoinfutures.d.ts +3 -3
  268. package/js/src/pro/kucoinfutures.js +12 -11
  269. package/js/src/pro/lbank.d.ts +1 -1
  270. package/js/src/pro/lbank.js +10 -10
  271. package/js/src/pro/luno.d.ts +2 -2
  272. package/js/src/pro/luno.js +12 -14
  273. package/js/src/pro/mexc.d.ts +2 -2
  274. package/js/src/pro/mexc.js +3 -2
  275. package/js/src/pro/ndax.d.ts +3 -3
  276. package/js/src/pro/ndax.js +7 -13
  277. package/js/src/pro/okcoin.d.ts +1 -1
  278. package/js/src/pro/okcoin.js +7 -12
  279. package/js/src/pro/okx.d.ts +1 -1
  280. package/js/src/pro/okx.js +6 -11
  281. package/js/src/pro/onetrading.d.ts +1 -1
  282. package/js/src/pro/onetrading.js +16 -15
  283. package/js/src/pro/p2b.d.ts +1 -1
  284. package/js/src/pro/p2b.js +5 -3
  285. package/js/src/pro/phemex.d.ts +3 -3
  286. package/js/src/pro/phemex.js +16 -11
  287. package/js/src/pro/poloniex.d.ts +1 -1
  288. package/js/src/pro/poloniex.js +6 -4
  289. package/js/src/pro/poloniexfutures.d.ts +4 -4
  290. package/js/src/pro/poloniexfutures.js +13 -10
  291. package/js/src/pro/probit.d.ts +1 -1
  292. package/js/src/pro/probit.js +14 -12
  293. package/js/src/pro/upbit.js +8 -8
  294. package/js/src/pro/wazirx.d.ts +1 -1
  295. package/js/src/pro/wazirx.js +6 -3
  296. package/js/src/pro/woo.d.ts +3 -3
  297. package/js/src/pro/woo.js +8 -6
  298. package/js/src/probit.d.ts +3 -3
  299. package/js/src/probit.js +3 -3
  300. package/js/src/timex.d.ts +1 -1
  301. package/js/src/timex.js +1 -1
  302. package/js/src/tokocrypto.d.ts +3 -3
  303. package/js/src/tokocrypto.js +2 -2
  304. package/js/src/upbit.d.ts +2 -2
  305. package/js/src/wavesexchange.d.ts +3 -4
  306. package/js/src/wavesexchange.js +2 -1
  307. package/js/src/wazirx.d.ts +1 -1
  308. package/js/src/whitebit.d.ts +5 -15
  309. package/js/src/whitebit.js +1 -1
  310. package/js/src/woo.d.ts +5 -15
  311. package/js/src/woo.js +1 -1
  312. package/js/src/yobit.d.ts +21 -6
  313. package/js/src/yobit.js +39 -0
  314. package/js/src/zaif.d.ts +2 -2
  315. package/js/src/zonda.d.ts +4 -14
  316. package/package.json +22 -8
  317. package/skip-tests.json +9 -1
  318. package/tests-manager.sh +1 -2
@@ -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
  }
@@ -47,19 +47,20 @@ class kucoin extends kucoin$1 {
47
47
  },
48
48
  });
49
49
  }
50
- negotiate(privateChannel, params = {}) {
50
+ async negotiate(privateChannel, params = {}) {
51
51
  const connectId = privateChannel ? 'private' : 'public';
52
52
  const urls = this.safeValue(this.options, 'urls', {});
53
53
  const spawaned = this.safeValue(urls, connectId);
54
54
  if (spawaned !== undefined) {
55
- return spawaned;
55
+ return await spawaned;
56
56
  }
57
57
  // we store an awaitable to the url
58
58
  // so that multiple calls don't asynchronously
59
59
  // fetch different urls and overwrite each other
60
60
  urls[connectId] = this.spawn(this.negotiateHelper, privateChannel, params);
61
61
  this.options['urls'] = urls;
62
- return urls[connectId];
62
+ const future = urls[connectId];
63
+ return await future;
63
64
  }
64
65
  async negotiateHelper(privateChannel, params = {}) {
65
66
  let response = undefined;
@@ -545,7 +546,7 @@ class kucoin extends kucoin$1 {
545
546
  const limit = this.safeInteger(subscription, 'limit');
546
547
  const snapshotDelay = this.handleOption('watchOrderBook', 'snapshotDelay', 5);
547
548
  if (cacheLength === snapshotDelay) {
548
- this.spawn(this.loadOrderBook, client, messageHash, symbol, limit);
549
+ this.spawn(this.loadOrderBook, client, messageHash, symbol, limit, {});
549
550
  }
550
551
  storedOrderBook.cache.push(data);
551
552
  return;
@@ -987,7 +988,8 @@ class kucoin extends kucoin$1 {
987
988
  //
988
989
  const topic = this.safeString(message, 'topic');
989
990
  if (topic === '/market/ticker:all') {
990
- return this.handleTicker(client, message);
991
+ this.handleTicker(client, message);
992
+ return;
991
993
  }
992
994
  const subject = this.safeString(message, 'subject');
993
995
  const methods = {
@@ -1002,11 +1004,8 @@ class kucoin extends kucoin$1 {
1002
1004
  'stopOrder': this.handleOrder,
1003
1005
  };
1004
1006
  const method = this.safeValue(methods, subject);
1005
- if (method === undefined) {
1006
- return message;
1007
- }
1008
- else {
1009
- return method.call(this, client, message);
1007
+ if (method !== undefined) {
1008
+ method.call(this, client, message);
1010
1009
  }
1011
1010
  }
1012
1011
  ping(client) {
@@ -1054,7 +1053,7 @@ class kucoin extends kucoin$1 {
1054
1053
  };
1055
1054
  const method = this.safeValue(methods, type);
1056
1055
  if (method !== undefined) {
1057
- return method.call(this, client, message);
1056
+ method.call(this, client, message);
1058
1057
  }
1059
1058
  }
1060
1059
  }
@@ -57,19 +57,20 @@ class kucoinfutures extends kucoinfutures$1 {
57
57
  },
58
58
  });
59
59
  }
60
- negotiate(privateChannel, params = {}) {
60
+ async negotiate(privateChannel, params = {}) {
61
61
  const connectId = privateChannel ? 'private' : 'public';
62
62
  const urls = this.safeValue(this.options, 'urls', {});
63
63
  const spawaned = this.safeValue(urls, connectId);
64
64
  if (spawaned !== undefined) {
65
- return spawaned;
65
+ return await spawaned;
66
66
  }
67
67
  // we store an awaitable to the url
68
68
  // so that multiple calls don't asynchronously
69
69
  // fetch different urls and overwrite each other
70
- urls[connectId] = this.spawn(this.negotiateHelper, privateChannel, params);
70
+ urls[connectId] = this.spawn(this.negotiateHelper, privateChannel, params); // we have to wait here otherwsie in c# will not work
71
71
  this.options['urls'] = urls;
72
- return urls[connectId];
72
+ const future = urls[connectId];
73
+ return await future;
73
74
  }
74
75
  async negotiateHelper(privateChannel, params = {}) {
75
76
  let response = undefined;
@@ -582,6 +583,9 @@ class kucoinfutures extends kucoinfutures$1 {
582
583
  const messageHash = 'orderbook:' + symbol;
583
584
  const storedOrderBook = this.safeValue(this.orderbooks, symbol);
584
585
  const nonce = this.safeInteger(storedOrderBook, 'nonce');
586
+ if (storedOrderBook === undefined) {
587
+ return; // this shouldn't be needed, but for some reason sometimes this runs before handleOrderBookSubscription in c#
588
+ }
585
589
  const deltaEnd = this.safeInteger(data, 'sequence');
586
590
  if (nonce === undefined) {
587
591
  const cacheLength = storedOrderBook.cache.length;
@@ -600,7 +604,7 @@ class kucoinfutures extends kucoinfutures$1 {
600
604
  const limit = this.safeInteger(subscription, 'limit');
601
605
  const snapshotDelay = this.handleOption('watchOrderBook', 'snapshotDelay', 5);
602
606
  if (cacheLength === snapshotDelay) {
603
- this.spawn(this.loadOrderBook, client, messageHash, symbol, limit);
607
+ this.spawn(this.loadOrderBook, client, messageHash, symbol, limit, {});
604
608
  }
605
609
  storedOrderBook.cache.push(data);
606
610
  return;
@@ -928,11 +932,8 @@ class kucoinfutures extends kucoinfutures$1 {
928
932
  'position.adjustRiskLimit': this.handlePosition,
929
933
  };
930
934
  const method = this.safeValue(methods, subject);
931
- if (method === undefined) {
932
- return message;
933
- }
934
- else {
935
- return method.call(this, client, message);
935
+ if (method !== undefined) {
936
+ method.call(this, client, message);
936
937
  }
937
938
  }
938
939
  ping(client) {
@@ -981,7 +982,7 @@ class kucoinfutures extends kucoinfutures$1 {
981
982
  };
982
983
  const method = this.safeValue(methods, type);
983
984
  if (method !== undefined) {
984
- return method.call(this, client, message);
985
+ method.call(this, client, message);
985
986
  }
986
987
  }
987
988
  }
@@ -776,17 +776,17 @@ class lbank extends lbank$1 {
776
776
  const orderBook = this.safeValue(message, 'depth', message);
777
777
  const datetime = this.safeString(message, 'TS');
778
778
  const timestamp = this.parse8601(datetime);
779
- let storedOrderBook = this.safeValue(this.orderbooks, symbol);
780
- if (storedOrderBook === undefined) {
781
- storedOrderBook = this.orderBook({});
782
- this.orderbooks[symbol] = storedOrderBook;
779
+ let orderbook = this.safeValue(this.orderbooks, symbol);
780
+ if (orderbook === undefined) {
781
+ orderbook = this.orderBook({});
782
+ this.orderbooks[symbol] = orderbook;
783
783
  }
784
784
  const snapshot = this.parseOrderBook(orderBook, symbol, timestamp, 'bids', 'asks');
785
- storedOrderBook.reset(snapshot);
785
+ orderbook.reset(snapshot);
786
786
  let messageHash = 'orderbook:' + symbol;
787
- client.resolve(storedOrderBook, messageHash);
787
+ client.resolve(orderbook, messageHash);
788
788
  messageHash = 'fetchOrderbook:' + symbol;
789
- client.resolve(storedOrderBook, messageHash);
789
+ client.resolve(orderbook, messageHash);
790
790
  }
791
791
  handleErrorMessage(client, message) {
792
792
  //
@@ -814,7 +814,8 @@ class lbank extends lbank$1 {
814
814
  handleMessage(client, message) {
815
815
  const status = this.safeString(message, 'status');
816
816
  if (status === 'error') {
817
- return this.handleErrorMessage(client, message);
817
+ this.handleErrorMessage(client, message);
818
+ return;
818
819
  }
819
820
  const type = this.safeString2(message, 'type', 'action');
820
821
  if (type === 'ping') {
@@ -830,9 +831,8 @@ class lbank extends lbank$1 {
830
831
  };
831
832
  const handler = this.safeValue(handlers, type);
832
833
  if (handler !== undefined) {
833
- return handler.call(this, client, message);
834
+ handler.call(this, client, message);
834
835
  }
835
- return message;
836
836
  }
837
837
  async authenticate(params = {}) {
838
838
  // when we implement more private streams, we need to refactor the authentication