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
@@ -886,7 +886,6 @@ class ascendex extends ascendex$1 {
886
886
  this.handleBalance(client, message);
887
887
  }
888
888
  }
889
- return message;
890
889
  }
891
890
  handleSubscriptionStatus(client, message) {
892
891
  //
@@ -926,7 +925,7 @@ class ascendex extends ascendex$1 {
926
925
  handlePing(client, message) {
927
926
  this.spawn(this.pong, client, message);
928
927
  }
929
- authenticate(url, params = {}) {
928
+ async authenticate(url, params = {}) {
930
929
  this.checkRequiredCredentials();
931
930
  const messageHash = 'authenticated';
932
931
  const client = this.client(url);
@@ -537,7 +537,7 @@ class binance extends binance$1 {
537
537
  */
538
538
  return await this.watchTradesForSymbols([symbol], since, limit, params);
539
539
  }
540
- parseTrade(trade, market = undefined) {
540
+ parseWsTrade(trade, market = undefined) {
541
541
  //
542
542
  // public watchTrades
543
543
  //
@@ -645,7 +645,7 @@ class binance extends binance$1 {
645
645
  const executionType = this.safeString(trade, 'x');
646
646
  const isTradeExecution = (executionType === 'TRADE');
647
647
  if (!isTradeExecution) {
648
- return super.parseTrade(trade, market);
648
+ return this.parseTrade(trade, market);
649
649
  }
650
650
  const id = this.safeString2(trade, 't', 'a');
651
651
  const timestamp = this.safeInteger(trade, 'T');
@@ -710,7 +710,7 @@ class binance extends binance$1 {
710
710
  const lowerCaseId = this.safeStringLower(message, 's');
711
711
  const event = this.safeString(message, 'e');
712
712
  const messageHash = lowerCaseId + '@' + event;
713
- const trade = this.parseTrade(message, market);
713
+ const trade = this.parseWsTrade(message, market);
714
714
  let tradesArray = this.safeValue(this.trades, symbol);
715
715
  if (tradesArray === undefined) {
716
716
  const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
@@ -1260,14 +1260,15 @@ class binance extends binance$1 {
1260
1260
  for (let j = 0; j < subscriptionKeys.length; j++) {
1261
1261
  const subscribeType = subscriptionKeys[j];
1262
1262
  if (subscribeType === type) {
1263
- return this.delay(listenKeyRefreshRate, this.keepAliveListenKey, params);
1263
+ this.delay(listenKeyRefreshRate, this.keepAliveListenKey, params);
1264
+ return;
1264
1265
  }
1265
1266
  }
1266
1267
  }
1267
1268
  }
1268
1269
  setBalanceCache(client, type) {
1269
1270
  if (type in client.subscriptions) {
1270
- return undefined;
1271
+ return;
1271
1272
  }
1272
1273
  const options = this.safeValue(this.options, 'watchBalance');
1273
1274
  const fetchBalanceSnapshot = this.safeBool(options, 'fetchBalanceSnapshot', false);
@@ -1368,7 +1369,7 @@ class binance extends binance$1 {
1368
1369
  //
1369
1370
  const messageHash = this.safeString(message, 'id');
1370
1371
  const result = this.safeValue(message, 'result', {});
1371
- const parsedBalances = this.parseBalance(result, 'spot');
1372
+ const parsedBalances = this.parseBalance(result);
1372
1373
  client.resolve(parsedBalances, messageHash);
1373
1374
  }
1374
1375
  async watchBalance(params = {}) {
@@ -2438,7 +2439,7 @@ class binance extends binance$1 {
2438
2439
  return this.safePosition({
2439
2440
  'info': position,
2440
2441
  'id': undefined,
2441
- 'symbol': this.safeSymbol(marketId, undefined, undefined, 'future'),
2442
+ 'symbol': this.safeSymbol(marketId, undefined, undefined, 'contract'),
2442
2443
  'notional': undefined,
2443
2444
  'marginMode': this.safeString(position, 'mt'),
2444
2445
  'liquidationPrice': undefined,
@@ -2592,9 +2593,9 @@ class binance extends binance$1 {
2592
2593
  const messageHash = 'myTrades';
2593
2594
  const executionType = this.safeString(message, 'x');
2594
2595
  if (executionType === 'TRADE') {
2595
- const trade = this.parseTrade(message);
2596
+ const trade = this.parseWsTrade(message);
2596
2597
  const orderId = this.safeString(trade, 'order');
2597
- let tradeFee = this.safeValue(trade, 'fee');
2598
+ let tradeFee = this.safeValue(trade, 'fee', {});
2598
2599
  tradeFee = this.extend({}, tradeFee);
2599
2600
  const symbol = this.safeString(trade, 'symbol');
2600
2601
  if (orderId !== undefined && tradeFee !== undefined && symbol !== undefined) {
@@ -2741,13 +2742,15 @@ class binance extends binance$1 {
2741
2742
  const status = this.safeString(message, 'status');
2742
2743
  const error = this.safeValue(message, 'error');
2743
2744
  if ((error !== undefined) || (status !== undefined && status !== '200')) {
2744
- return this.handleWsError(client, message);
2745
+ this.handleWsError(client, message);
2746
+ return;
2745
2747
  }
2746
2748
  const id = this.safeString(message, 'id');
2747
2749
  const subscriptions = this.safeValue(client.subscriptions, id);
2748
2750
  let method = this.safeValue(subscriptions, 'method');
2749
2751
  if (method !== undefined) {
2750
- return method.call(this, client, message);
2752
+ method.call(this, client, message);
2753
+ return;
2751
2754
  }
2752
2755
  // handle other APIs
2753
2756
  const methods = {
@@ -2777,7 +2780,8 @@ class binance extends binance$1 {
2777
2780
  if (method === undefined) {
2778
2781
  const requestId = this.safeString(message, 'id');
2779
2782
  if (requestId !== undefined) {
2780
- return this.handleSubscriptionStatus(client, message);
2783
+ this.handleSubscriptionStatus(client, message);
2784
+ return;
2781
2785
  }
2782
2786
  // special case for the real-time bookTicker, since it comes without an event identifier
2783
2787
  //
@@ -2796,7 +2800,7 @@ class binance extends binance$1 {
2796
2800
  }
2797
2801
  }
2798
2802
  else {
2799
- return method.call(this, client, message);
2803
+ method.call(this, client, message);
2800
2804
  }
2801
2805
  }
2802
2806
  }
@@ -717,7 +717,7 @@ class bingx extends bingx$1 {
717
717
  }
718
718
  setBalanceCache(client, type, subscriptionHash, params) {
719
719
  if (subscriptionHash in client.subscriptions) {
720
- return undefined;
720
+ return;
721
721
  }
722
722
  const fetchBalanceSnapshot = this.handleOptionAndParams(params, 'watchBalance', 'fetchBalanceSnapshot', true);
723
723
  if (fetchBalanceSnapshot) {
@@ -132,7 +132,6 @@ class bitfinex extends bitfinex$1 {
132
132
  stored.append(trade);
133
133
  }
134
134
  client.resolve(stored, messageHash);
135
- return message;
136
135
  }
137
136
  parseTrade(trade, market = undefined) {
138
137
  //
@@ -322,8 +321,9 @@ class bitfinex extends bitfinex$1 {
322
321
  const delta = deltas[i];
323
322
  const id = this.safeString(delta, 0);
324
323
  const price = this.safeFloat(delta, 1);
325
- const size = (delta[2] < 0) ? -delta[2] : delta[2];
326
- const side = (delta[2] < 0) ? 'asks' : 'bids';
324
+ const delta2Value = delta[2];
325
+ const size = (delta2Value < 0) ? -delta2Value : delta2Value;
326
+ const side = (delta2Value < 0) ? 'asks' : 'bids';
327
327
  const bookside = orderbook[side];
328
328
  bookside.store(price, size, id);
329
329
  }
@@ -332,10 +332,11 @@ class bitfinex extends bitfinex$1 {
332
332
  const deltas = message[1];
333
333
  for (let i = 0; i < deltas.length; i++) {
334
334
  const delta = deltas[i];
335
- const size = (delta[2] < 0) ? -delta[2] : delta[2];
336
- const side = (delta[2] < 0) ? 'asks' : 'bids';
337
- const bookside = orderbook[side];
338
- bookside.store(delta[0], size, delta[1]);
335
+ const delta2 = delta[2];
336
+ const size = (delta2 < 0) ? -delta2 : delta2;
337
+ const side = (delta2 < 0) ? 'asks' : 'bids';
338
+ const countedBookSide = orderbook[side];
339
+ countedBookSide.store(delta[0], size, delta[1]);
339
340
  }
340
341
  }
341
342
  client.resolve(orderbook, messageHash);
@@ -345,18 +346,20 @@ class bitfinex extends bitfinex$1 {
345
346
  if (isRaw) {
346
347
  const id = this.safeString(message, 1);
347
348
  const price = this.safeString(message, 2);
348
- const size = (message[3] < 0) ? -message[3] : message[3];
349
- const side = (message[3] < 0) ? 'asks' : 'bids';
349
+ const message3 = message[3];
350
+ const size = (message3 < 0) ? -message3 : message3;
351
+ const side = (message3 < 0) ? 'asks' : 'bids';
350
352
  const bookside = orderbook[side];
351
353
  // price = 0 means that you have to remove the order from your book
352
354
  const amount = Precise["default"].stringGt(price, '0') ? size : '0';
353
355
  bookside.store(this.parseNumber(price), this.parseNumber(amount), id);
354
356
  }
355
357
  else {
356
- const size = (message[3] < 0) ? -message[3] : message[3];
357
- const side = (message[3] < 0) ? 'asks' : 'bids';
358
- const bookside = orderbook[side];
359
- bookside.store(message[1], size, message[2]);
358
+ const message3Value = message[3];
359
+ const size = (message3Value < 0) ? -message3Value : message3Value;
360
+ const side = (message3Value < 0) ? 'asks' : 'bids';
361
+ const countedBookSide = orderbook[side];
362
+ countedBookSide.store(message[1], size, message[2]);
360
363
  }
361
364
  client.resolve(orderbook, messageHash);
362
365
  }
@@ -617,7 +620,7 @@ class bitfinex extends bitfinex$1 {
617
620
  // ]
618
621
  //
619
622
  if (message[1] === 'hb') {
620
- return message; // skip heartbeats within subscription channels for now
623
+ return; // skip heartbeats within subscription channels for now
621
624
  }
622
625
  const subscription = this.safeValue(client.subscriptions, channelId, {});
623
626
  const channel = this.safeString(subscription, 'channel');
@@ -632,11 +635,8 @@ class bitfinex extends bitfinex$1 {
632
635
  'oc': this.handleOrders,
633
636
  };
634
637
  const method = this.safeValue2(methods, channel, name);
635
- if (method === undefined) {
636
- return message;
637
- }
638
- else {
639
- return method.call(this, client, message, subscription);
638
+ if (method !== undefined) {
639
+ method.call(this, client, message, subscription);
640
640
  }
641
641
  }
642
642
  else {
@@ -658,11 +658,8 @@ class bitfinex extends bitfinex$1 {
658
658
  'auth': this.handleAuthenticationMessage,
659
659
  };
660
660
  const method = this.safeValue(methods, event);
661
- if (method === undefined) {
662
- return message;
663
- }
664
- else {
665
- return method.call(this, client, message);
661
+ if (method !== undefined) {
662
+ method.call(this, client, message);
666
663
  }
667
664
  }
668
665
  }
@@ -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
  //