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
@@ -339,7 +339,6 @@ class bitfinex2 extends bitfinex2$1 {
339
339
  stored.append(parsed);
340
340
  }
341
341
  client.resolve(stored, messageHash);
342
- return message;
343
342
  }
344
343
  parseWsTrade(trade, market = undefined) {
345
344
  //
@@ -591,8 +590,9 @@ class bitfinex2 extends bitfinex2$1 {
591
590
  const deltas = message[1];
592
591
  for (let i = 0; i < deltas.length; i++) {
593
592
  const delta = deltas[i];
594
- const size = (delta[2] < 0) ? -delta[2] : delta[2];
595
- const side = (delta[2] < 0) ? 'asks' : 'bids';
593
+ const delta2 = delta[2];
594
+ const size = (delta2 < 0) ? -delta2 : delta2;
595
+ const side = (delta2 < 0) ? 'asks' : 'bids';
596
596
  const bookside = orderbook[side];
597
597
  const idString = this.safeString(delta, 0);
598
598
  const price = this.safeFloat(delta, 1);
@@ -620,8 +620,9 @@ class bitfinex2 extends bitfinex2$1 {
620
620
  const orderbookItem = this.orderbooks[symbol];
621
621
  if (isRaw) {
622
622
  const price = this.safeString(deltas, 1);
623
- const size = (deltas[2] < 0) ? -deltas[2] : deltas[2];
624
- const side = (deltas[2] < 0) ? 'asks' : 'bids';
623
+ const deltas2 = deltas[2];
624
+ const size = (deltas2 < 0) ? -deltas2 : deltas2;
625
+ const side = (deltas2 < 0) ? 'asks' : 'bids';
625
626
  const bookside = orderbookItem[side];
626
627
  // price = 0 means that you have to remove the order from your book
627
628
  const amount = Precise["default"].stringGt(price, '0') ? size : '0';
@@ -669,7 +670,8 @@ class bitfinex2 extends bitfinex2$1 {
669
670
  }
670
671
  if (ask !== undefined) {
671
672
  stringArray.push(this.numberToString(asks[i][idToCheck]));
672
- stringArray.push(this.numberToString(-asks[i][1]));
673
+ const aski1 = asks[i][1];
674
+ stringArray.push(this.numberToString(-aski1));
673
675
  }
674
676
  }
675
677
  const payload = stringArray.join(':');
@@ -1101,7 +1103,7 @@ class bitfinex2 extends bitfinex2$1 {
1101
1103
  //
1102
1104
  if (Array.isArray(message)) {
1103
1105
  if (message[1] === 'hb') {
1104
- return message; // skip heartbeats within subscription channels for now
1106
+ return; // skip heartbeats within subscription channels for now
1105
1107
  }
1106
1108
  const subscription = this.safeValue(client.subscriptions, channelId, {});
1107
1109
  const channel = this.safeString(subscription, 'channel');
@@ -1129,11 +1131,8 @@ class bitfinex2 extends bitfinex2$1 {
1129
1131
  else {
1130
1132
  method = this.safeValue2(publicMethods, name, channel);
1131
1133
  }
1132
- if (method === undefined) {
1133
- return message;
1134
- }
1135
- else {
1136
- return method.call(this, client, message, subscription);
1134
+ if (method !== undefined) {
1135
+ method.call(this, client, message, subscription);
1137
1136
  }
1138
1137
  }
1139
1138
  else {
@@ -1145,11 +1144,8 @@ class bitfinex2 extends bitfinex2$1 {
1145
1144
  'auth': this.handleAuthenticationMessage,
1146
1145
  };
1147
1146
  const method = this.safeValue(methods, event);
1148
- if (method === undefined) {
1149
- return message;
1150
- }
1151
- else {
1152
- return method.call(this, client, message);
1147
+ if (method !== undefined) {
1148
+ method.call(this, client, message);
1153
1149
  }
1154
1150
  }
1155
1151
  }
@@ -95,7 +95,9 @@ class bitget extends bitget$1 {
95
95
  else {
96
96
  instType = 'SPOT';
97
97
  }
98
- [instType, params] = this.handleOptionAndParams(params, 'getInstType', 'instType', instType);
98
+ let instypeAux = undefined;
99
+ [instypeAux, params] = this.handleOptionAndParams(params, 'getInstType', 'instType', instType);
100
+ instType = instypeAux;
99
101
  return [instType, params];
100
102
  }
101
103
  async watchTicker(symbol, params = {}) {
@@ -816,7 +816,6 @@ class bitmart extends bitmart$1 {
816
816
  messageHash += ':' + this.safeString(data[0], 'symbol');
817
817
  }
818
818
  client.resolve(stored, messageHash);
819
- return message;
820
819
  }
821
820
  parseWsTrade(trade, market = undefined) {
822
821
  // spot
@@ -918,7 +917,6 @@ class bitmart extends bitmart$1 {
918
917
  client.resolve(ticker, 'tickers::swap');
919
918
  this.resolveMessageHashesForSymbol(client, symbol, ticker, 'tickers::');
920
919
  }
921
- return message;
922
920
  }
923
921
  resolveMessageHashesForSymbol(client, symbol, result, prexif) {
924
922
  const prefixSeparator = '::';
@@ -1452,11 +1450,8 @@ class bitmart extends bitmart$1 {
1452
1450
  'subscribe': this.handleSubscriptionStatus,
1453
1451
  };
1454
1452
  const method = this.safeValue(methods, event);
1455
- if (method === undefined) {
1456
- return message;
1457
- }
1458
- else {
1459
- return method.call(this, client, message);
1453
+ if (method !== undefined) {
1454
+ method.call(this, client, message);
1460
1455
  }
1461
1456
  }
1462
1457
  }
@@ -1476,7 +1471,7 @@ class bitmart extends bitmart$1 {
1476
1471
  const key = keys[i];
1477
1472
  if (channel.indexOf(key) >= 0) {
1478
1473
  const method = this.safeValue(methods, key);
1479
- return method.call(this, client, message);
1474
+ method.call(this, client, message);
1480
1475
  }
1481
1476
  }
1482
1477
  }
@@ -1524,7 +1524,7 @@ class bitmex extends bitmex$1 {
1524
1524
  //
1525
1525
  // { "error": "Rate limit exceeded, retry in 29 seconds." }
1526
1526
  //
1527
- const error = this.safeValue(message, 'error');
1527
+ const error = this.safeString(message, 'error');
1528
1528
  if (error !== undefined) {
1529
1529
  const request = this.safeValue(message, 'request', {});
1530
1530
  const args = this.safeValue(request, 'args', []);
@@ -1535,7 +1535,7 @@ class bitmex extends bitmex$1 {
1535
1535
  const broadKey = this.findBroadlyMatchedKey(broad, error);
1536
1536
  let exception = undefined;
1537
1537
  if (broadKey === undefined) {
1538
- exception = new errors.ExchangeError(error);
1538
+ exception = new errors.ExchangeError(error); // c# requirement for now
1539
1539
  }
1540
1540
  else {
1541
1541
  exception = new broad[broadKey](error);
@@ -1603,14 +1603,11 @@ class bitmex extends bitmex$1 {
1603
1603
  const request = this.safeValue(message, 'request', {});
1604
1604
  const op = this.safeValue(request, 'op');
1605
1605
  if (op === 'authKeyExpires') {
1606
- return this.handleAuthenticationMessage.call(this, client, message);
1607
- }
1608
- else {
1609
- return message;
1606
+ this.handleAuthenticationMessage(client, message);
1610
1607
  }
1611
1608
  }
1612
1609
  else {
1613
- return method.call(this, client, message);
1610
+ method.call(this, client, message);
1614
1611
  }
1615
1612
  }
1616
1613
  }
@@ -464,11 +464,8 @@ class bitopro extends bitopro$1 {
464
464
  };
465
465
  const event = this.safeString(message, 'event');
466
466
  const method = this.safeValue(methods, event);
467
- if (method === undefined) {
468
- return message;
469
- }
470
- else {
471
- return method.call(this, client, message);
467
+ if (method !== undefined) {
468
+ method.call(this, client, message);
472
469
  }
473
470
  }
474
471
  }
@@ -419,7 +419,7 @@ class bitrue extends bitrue$1 {
419
419
  catch (error) {
420
420
  this.options['listenKey'] = undefined;
421
421
  this.options['listenKeyUrl'] = undefined;
422
- return;
422
+ return undefined;
423
423
  }
424
424
  //
425
425
  // {
@@ -498,10 +498,10 @@ class bitstamp extends bitstamp$1 {
498
498
  //
499
499
  const event = this.safeString(message, 'event');
500
500
  if (event === 'bts:subscription_succeeded') {
501
- return this.handleSubscriptionStatus(client, message);
501
+ this.handleSubscriptionStatus(client, message);
502
502
  }
503
503
  else {
504
- return this.handleSubject(client, message);
504
+ this.handleSubject(client, message);
505
505
  }
506
506
  }
507
507
  async authenticate(params = {}) {
@@ -524,7 +524,6 @@ class bitstamp extends bitstamp$1 {
524
524
  this.options['expiresIn'] = this.sum(time, validity);
525
525
  this.options['userId'] = userId;
526
526
  this.options['wsSessionToken'] = sessionToken;
527
- return response;
528
527
  }
529
528
  }
530
529
  }
@@ -412,7 +412,7 @@ class bitvavo extends bitvavo$1 {
412
412
  //
413
413
  const response = this.safeValue(message, 'response');
414
414
  if (response === undefined) {
415
- return message;
415
+ return;
416
416
  }
417
417
  const marketId = this.safeString(response, 'market');
418
418
  const symbol = this.safeSymbol(marketId, undefined, '-');
@@ -1194,7 +1194,7 @@ class bitvavo extends bitvavo$1 {
1194
1194
  }
1195
1195
  return message;
1196
1196
  }
1197
- authenticate(params = {}) {
1197
+ async authenticate(params = {}) {
1198
1198
  const url = this.urls['api']['ws'];
1199
1199
  const client = this.client(url);
1200
1200
  const messageHash = 'authenticated';
@@ -1339,9 +1339,16 @@ class bitvavo extends bitvavo$1 {
1339
1339
  'getCandles': this.handleFetchOHLCV,
1340
1340
  'getMarkets': this.handleMarkets,
1341
1341
  };
1342
- const event = this.safeString2(message, 'event', 'action');
1343
- const method = this.safeValue(methods, event);
1344
- if (method !== undefined) {
1342
+ const event = this.safeString(message, 'event');
1343
+ let method = this.safeValue(methods, event);
1344
+ if (method === undefined) {
1345
+ const action = this.safeString(message, 'action');
1346
+ method = this.safeValue(methods, action);
1347
+ if (method !== undefined) {
1348
+ method.call(this, client, message);
1349
+ }
1350
+ }
1351
+ else {
1345
1352
  method.call(this, client, message);
1346
1353
  }
1347
1354
  }
@@ -99,7 +99,7 @@ class blockchaincom extends blockchaincom$1 {
99
99
  //
100
100
  const event = this.safeString(message, 'event');
101
101
  if (event === 'subscribed') {
102
- return message;
102
+ return;
103
103
  }
104
104
  const result = { 'info': message };
105
105
  const balances = this.safeValue(message, 'balances', []);
@@ -169,11 +169,9 @@ class blockchaincom extends blockchaincom$1 {
169
169
  // }
170
170
  //
171
171
  const event = this.safeString(message, 'event');
172
- if (event === 'subscribed') {
173
- return message;
174
- }
175
- else if (event === 'rejected') {
176
- throw new errors.ExchangeError(this.id + ' ' + this.json(message));
172
+ if (event === 'rejected') {
173
+ const jsonMessage = this.json(message);
174
+ throw new errors.ExchangeError(this.id + ' ' + jsonMessage);
177
175
  }
178
176
  else if (event === 'updated') {
179
177
  const marketId = this.safeString(message, 'symbol');
@@ -193,7 +191,7 @@ class blockchaincom extends blockchaincom$1 {
193
191
  stored.append(ohlcv);
194
192
  client.resolve(stored, messageHash);
195
193
  }
196
- else {
194
+ else if (event !== 'subscribed') {
197
195
  throw new errors.NotSupported(this.id + ' ' + this.json(message));
198
196
  }
199
197
  }
@@ -255,7 +253,7 @@ class blockchaincom extends blockchaincom$1 {
255
253
  const symbol = market['symbol'];
256
254
  let ticker = undefined;
257
255
  if (event === 'subscribed') {
258
- return message;
256
+ return;
259
257
  }
260
258
  else if (event === 'snapshot') {
261
259
  ticker = this.parseTicker(message, market);
@@ -354,7 +352,7 @@ class blockchaincom extends blockchaincom$1 {
354
352
  //
355
353
  const event = this.safeString(message, 'event');
356
354
  if (event !== 'updated') {
357
- return message;
355
+ return;
358
356
  }
359
357
  const marketId = this.safeString(message, 'symbol');
360
358
  const symbol = this.safeSymbol(marketId);
@@ -516,7 +514,7 @@ class blockchaincom extends blockchaincom$1 {
516
514
  this.orders = new Cache.ArrayCacheBySymbolById(limit);
517
515
  }
518
516
  if (event === 'subscribed') {
519
- return message;
517
+ return;
520
518
  }
521
519
  else if (event === 'rejected') {
522
520
  throw new errors.ExchangeError(this.id + ' ' + this.json(message));
@@ -686,30 +684,30 @@ class blockchaincom extends blockchaincom$1 {
686
684
  const messageHash = 'orderbook:' + symbol + ':' + type;
687
685
  const datetime = this.safeString(message, 'timestamp');
688
686
  const timestamp = this.parse8601(datetime);
689
- let storedOrderBook = this.safeValue(this.orderbooks, symbol);
690
- if (storedOrderBook === undefined) {
691
- storedOrderBook = this.countedOrderBook({});
692
- this.orderbooks[symbol] = storedOrderBook;
687
+ let orderbook = this.safeValue(this.orderbooks, symbol);
688
+ if (orderbook === undefined) {
689
+ orderbook = this.countedOrderBook({});
690
+ this.orderbooks[symbol] = orderbook;
693
691
  }
694
692
  if (event === 'subscribed') {
695
- return message;
693
+ return;
696
694
  }
697
695
  else if (event === 'snapshot') {
698
696
  const snapshot = this.parseOrderBook(message, symbol, timestamp, 'bids', 'asks', 'px', 'qty', 'num');
699
- storedOrderBook.reset(snapshot);
697
+ orderbook.reset(snapshot);
700
698
  }
701
699
  else if (event === 'updated') {
702
700
  const asks = this.safeValue(message, 'asks', []);
703
701
  const bids = this.safeValue(message, 'bids', []);
704
- this.handleDeltas(storedOrderBook['asks'], asks);
705
- this.handleDeltas(storedOrderBook['bids'], bids);
706
- storedOrderBook['timestamp'] = timestamp;
707
- storedOrderBook['datetime'] = datetime;
702
+ this.handleDeltas(orderbook['asks'], asks);
703
+ this.handleDeltas(orderbook['bids'], bids);
704
+ orderbook['timestamp'] = timestamp;
705
+ orderbook['datetime'] = datetime;
708
706
  }
709
707
  else {
710
708
  throw new errors.NotSupported(this.id + ' watchOrderBook() does not support ' + event + ' yet');
711
709
  }
712
- client.resolve(storedOrderBook, messageHash);
710
+ client.resolve(orderbook, messageHash);
713
711
  }
714
712
  handleDelta(bookside, delta) {
715
713
  const bookArray = this.parseBidAsk(delta, 'px', 'qty', 'num');
@@ -750,7 +748,8 @@ class blockchaincom extends blockchaincom$1 {
750
748
  };
751
749
  const handler = this.safeValue(handlers, channel);
752
750
  if (handler !== undefined) {
753
- return handler.call(this, client, message);
751
+ handler.call(this, client, message);
752
+ return;
754
753
  }
755
754
  throw new errors.NotSupported(this.id + ' received an unsupported message: ' + this.json(message));
756
755
  }
@@ -772,7 +771,7 @@ class blockchaincom extends blockchaincom$1 {
772
771
  future.resolve(true);
773
772
  }
774
773
  }
775
- authenticate(params = {}) {
774
+ async authenticate(params = {}) {
776
775
  const url = this.urls['api']['ws'];
777
776
  const client = this.client(url);
778
777
  const messageHash = 'authenticated';
@@ -906,7 +906,7 @@ class bybit extends bybit$1 {
906
906
  * @name bybit#watchPositions
907
907
  * @see https://bybit-exchange.github.io/docs/v5/websocket/private/position
908
908
  * @description watch all open positions
909
- * @param {string[]|undefined} symbols list of unified market symbols
909
+ * @param {string[]} [symbols] list of unified market symbols
910
910
  * @param {object} params extra parameters specific to the exchange API endpoint
911
911
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
912
912
  */
@@ -939,7 +939,7 @@ class bybit extends bybit$1 {
939
939
  }
940
940
  setPositionsCache(client, symbols = undefined) {
941
941
  if (this.positions !== undefined) {
942
- return this.positions;
942
+ return;
943
943
  }
944
944
  const fetchPositionsSnapshot = this.handleOption('watchPositions', 'fetchPositionsSnapshot', true);
945
945
  if (fetchPositionsSnapshot) {
@@ -1072,7 +1072,7 @@ class bybit extends bybit$1 {
1072
1072
  }
1073
1073
  return this.filterBySymbolSinceLimit(orders, symbol, since, limit, true);
1074
1074
  }
1075
- handleOrder(client, message, subscription = undefined) {
1075
+ handleOrder(client, message) {
1076
1076
  //
1077
1077
  // spot
1078
1078
  // {
@@ -1638,7 +1638,7 @@ class bybit extends bybit$1 {
1638
1638
  const authenticated = this.safeValue(client.subscriptions, messageHash);
1639
1639
  if (authenticated === undefined) {
1640
1640
  const expiresInt = this.milliseconds() + 10000;
1641
- const expires = expiresInt.toString();
1641
+ const expires = this.numberToString(expiresInt);
1642
1642
  const path = 'GET/realtime';
1643
1643
  const auth = path + expires;
1644
1644
  const signature = this.hmac(this.encode(auth), this.encode(this.secret), sha256.sha256, 'hex');
@@ -1651,7 +1651,7 @@ class bybit extends bybit$1 {
1651
1651
  const message = this.extend(request, params);
1652
1652
  this.watch(url, messageHash, message, messageHash);
1653
1653
  }
1654
- return future;
1654
+ return await future;
1655
1655
  }
1656
1656
  handleErrorMessage(client, message) {
1657
1657
  //
@@ -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();