ccxt 4.1.86 → 4.1.88

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 (234) hide show
  1. package/README.md +9 -11
  2. package/dist/ccxt.browser.js +5673 -8615
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -11
  5. package/dist/cjs/src/base/Exchange.js +95 -27
  6. package/dist/cjs/src/base/ws/Client.js +3 -3
  7. package/dist/cjs/src/base/ws/Future.js +9 -2
  8. package/dist/cjs/src/base/ws/WsClient.js +1 -1
  9. package/dist/cjs/src/binance.js +4 -105
  10. package/dist/cjs/src/binanceus.js +0 -2
  11. package/dist/cjs/src/bit2c.js +8 -2
  12. package/dist/cjs/src/bitforex.js +0 -2
  13. package/dist/cjs/src/bitget.js +3455 -2480
  14. package/dist/cjs/src/bitmart.js +35 -9
  15. package/dist/cjs/src/coinbase.js +2 -0
  16. package/dist/cjs/src/coinbasepro.js +0 -43
  17. package/dist/cjs/src/coinlist.js +0 -2
  18. package/dist/cjs/src/coinsph.js +0 -31
  19. package/dist/cjs/src/cryptocom.js +22 -12
  20. package/dist/cjs/src/gate.js +37 -249
  21. package/dist/cjs/src/gemini.js +1 -0
  22. package/dist/cjs/src/kuna.js +0 -2
  23. package/dist/cjs/src/mexc.js +0 -2
  24. package/dist/cjs/src/novadax.js +28 -16
  25. package/dist/cjs/src/okcoin.js +23 -5
  26. package/dist/cjs/src/okx.js +0 -1
  27. package/dist/cjs/src/pro/binance.js +18 -215
  28. package/dist/cjs/src/pro/bitget.js +780 -736
  29. package/dist/cjs/src/pro/bitmart.js +8 -10
  30. package/dist/cjs/src/pro/bitmex.js +9 -34
  31. package/dist/cjs/src/pro/bitpanda.js +4 -4
  32. package/dist/cjs/src/pro/bybit.js +21 -97
  33. package/dist/cjs/src/pro/coinbasepro.js +36 -40
  34. package/dist/cjs/src/pro/coinex.js +2 -1
  35. package/dist/cjs/src/pro/cryptocom.js +10 -26
  36. package/dist/cjs/src/pro/gate.js +20 -17
  37. package/dist/cjs/src/pro/kucoin.js +39 -39
  38. package/dist/cjs/src/pro/kucoinfutures.js +40 -36
  39. package/dist/cjs/src/pro/okx.js +16 -29
  40. package/dist/cjs/src/tokocrypto.js +0 -1
  41. package/dist/cjs/src/upbit.js +36 -26
  42. package/dist/cjs/src/wazirx.js +0 -2
  43. package/dist/cjs/src/whitebit.js +0 -2
  44. package/dist/cjs/src/woo.js +0 -2
  45. package/js/ccxt.d.ts +3 -15
  46. package/js/ccxt.js +2 -10
  47. package/js/src/abstract/bitget.d.ts +1 -1
  48. package/js/src/ace.d.ts +1 -1
  49. package/js/src/alpaca.d.ts +1 -1
  50. package/js/src/ascendex.d.ts +1 -1
  51. package/js/src/base/Exchange.d.ts +5 -6
  52. package/js/src/base/Exchange.js +96 -28
  53. package/js/src/base/ws/Client.d.ts +2 -2
  54. package/js/src/base/ws/Client.js +4 -4
  55. package/js/src/base/ws/Future.d.ts +5 -2
  56. package/js/src/base/ws/Future.js +8 -2
  57. package/js/src/base/ws/WsClient.d.ts +1 -1
  58. package/js/src/base/ws/WsClient.js +2 -2
  59. package/js/src/bigone.d.ts +1 -1
  60. package/js/src/binance.d.ts +1 -10
  61. package/js/src/binance.js +4 -105
  62. package/js/src/binanceus.js +0 -2
  63. package/js/src/bingx.d.ts +1 -1
  64. package/js/src/bit2c.d.ts +1 -1
  65. package/js/src/bit2c.js +8 -2
  66. package/js/src/bitbank.d.ts +1 -1
  67. package/js/src/bitbns.d.ts +1 -1
  68. package/js/src/bitfinex.d.ts +1 -1
  69. package/js/src/bitfinex2.d.ts +1 -1
  70. package/js/src/bitflyer.d.ts +1 -1
  71. package/js/src/bitforex.d.ts +1 -1
  72. package/js/src/bitforex.js +0 -2
  73. package/js/src/bitget.d.ts +13 -11
  74. package/js/src/bitget.js +3455 -2480
  75. package/js/src/bithumb.d.ts +1 -1
  76. package/js/src/bitmart.d.ts +1 -1
  77. package/js/src/bitmart.js +35 -9
  78. package/js/src/bitmex.d.ts +1 -1
  79. package/js/src/bitopro.d.ts +1 -1
  80. package/js/src/bitpanda.d.ts +1 -1
  81. package/js/src/bitrue.d.ts +1 -1
  82. package/js/src/bitso.d.ts +1 -1
  83. package/js/src/bitstamp.d.ts +1 -1
  84. package/js/src/bitvavo.d.ts +1 -1
  85. package/js/src/bl3p.d.ts +1 -1
  86. package/js/src/blockchaincom.d.ts +1 -1
  87. package/js/src/btcalpha.d.ts +1 -1
  88. package/js/src/btcbox.d.ts +1 -1
  89. package/js/src/btcmarkets.d.ts +1 -1
  90. package/js/src/btcturk.d.ts +1 -1
  91. package/js/src/bybit.d.ts +1 -1
  92. package/js/src/cex.d.ts +1 -1
  93. package/js/src/coinbase.d.ts +1 -1
  94. package/js/src/coinbase.js +2 -0
  95. package/js/src/coinbasepro.d.ts +1 -5
  96. package/js/src/coinbasepro.js +1 -44
  97. package/js/src/coincheck.d.ts +1 -1
  98. package/js/src/coinex.d.ts +1 -1
  99. package/js/src/coinlist.d.ts +1 -1
  100. package/js/src/coinlist.js +0 -2
  101. package/js/src/coinmate.d.ts +1 -1
  102. package/js/src/coinone.d.ts +1 -1
  103. package/js/src/coinsph.d.ts +1 -2
  104. package/js/src/coinsph.js +0 -31
  105. package/js/src/coinspot.d.ts +1 -1
  106. package/js/src/cryptocom.d.ts +1 -1
  107. package/js/src/cryptocom.js +22 -12
  108. package/js/src/currencycom.d.ts +1 -1
  109. package/js/src/delta.d.ts +1 -1
  110. package/js/src/deribit.d.ts +1 -1
  111. package/js/src/digifinex.d.ts +1 -1
  112. package/js/src/exmo.d.ts +1 -1
  113. package/js/src/gate.d.ts +1 -28
  114. package/js/src/gate.js +37 -249
  115. package/js/src/gemini.d.ts +1 -1
  116. package/js/src/gemini.js +1 -0
  117. package/js/src/hitbtc.d.ts +1 -1
  118. package/js/src/hollaex.d.ts +1 -1
  119. package/js/src/htx.d.ts +1 -1
  120. package/js/src/huobijp.d.ts +1 -1
  121. package/js/src/idex.d.ts +1 -1
  122. package/js/src/independentreserve.d.ts +1 -1
  123. package/js/src/indodax.d.ts +1 -1
  124. package/js/src/kraken.d.ts +1 -1
  125. package/js/src/krakenfutures.d.ts +1 -1
  126. package/js/src/kucoin.d.ts +1 -1
  127. package/js/src/kucoinfutures.d.ts +1 -1
  128. package/js/src/kuna.d.ts +1 -1
  129. package/js/src/kuna.js +0 -2
  130. package/js/src/latoken.d.ts +1 -1
  131. package/js/src/lbank.d.ts +1 -1
  132. package/js/src/luno.d.ts +1 -1
  133. package/js/src/lykke.d.ts +1 -1
  134. package/js/src/mercado.d.ts +1 -1
  135. package/js/src/mexc.d.ts +1 -1
  136. package/js/src/mexc.js +0 -2
  137. package/js/src/ndax.d.ts +1 -1
  138. package/js/src/novadax.d.ts +1 -1
  139. package/js/src/novadax.js +28 -16
  140. package/js/src/oceanex.d.ts +1 -1
  141. package/js/src/okcoin.d.ts +1 -1
  142. package/js/src/okcoin.js +23 -5
  143. package/js/src/okx.d.ts +1 -1
  144. package/js/src/okx.js +0 -1
  145. package/js/src/p2b.d.ts +1 -1
  146. package/js/src/paymium.d.ts +1 -1
  147. package/js/src/phemex.d.ts +1 -1
  148. package/js/src/poloniex.d.ts +1 -1
  149. package/js/src/poloniexfutures.d.ts +1 -1
  150. package/js/src/pro/alpaca.d.ts +8 -8
  151. package/js/src/pro/ascendex.d.ts +7 -7
  152. package/js/src/pro/binance.d.ts +22 -24
  153. package/js/src/pro/binance.js +19 -216
  154. package/js/src/pro/bingx.d.ts +7 -7
  155. package/js/src/pro/bitfinex.d.ts +6 -6
  156. package/js/src/pro/bitfinex2.d.ts +11 -11
  157. package/js/src/pro/bitget.d.ts +20 -22
  158. package/js/src/pro/bitget.js +780 -736
  159. package/js/src/pro/bitmart.d.ts +13 -13
  160. package/js/src/pro/bitmart.js +8 -10
  161. package/js/src/pro/bitmex.d.ts +10 -10
  162. package/js/src/pro/bitmex.js +9 -34
  163. package/js/src/pro/bitopro.d.ts +5 -5
  164. package/js/src/pro/bitpanda.d.ts +11 -11
  165. package/js/src/pro/bitpanda.js +4 -4
  166. package/js/src/pro/bitrue.d.ts +5 -5
  167. package/js/src/pro/bitstamp.d.ts +6 -6
  168. package/js/src/pro/bitvavo.d.ts +7 -7
  169. package/js/src/pro/blockchaincom.d.ts +10 -10
  170. package/js/src/pro/bybit.d.ts +15 -16
  171. package/js/src/pro/bybit.js +21 -97
  172. package/js/src/pro/cex.d.ts +20 -20
  173. package/js/src/pro/coinbase.d.ts +7 -6
  174. package/js/src/pro/coinbasepro.d.ts +12 -12
  175. package/js/src/pro/coinbasepro.js +36 -40
  176. package/js/src/pro/coinex.d.ts +12 -12
  177. package/js/src/pro/coinex.js +2 -1
  178. package/js/src/pro/cryptocom.d.ts +14 -14
  179. package/js/src/pro/cryptocom.js +10 -26
  180. package/js/src/pro/currencycom.d.ts +6 -6
  181. package/js/src/pro/deribit.d.ts +8 -8
  182. package/js/src/pro/exmo.d.ts +6 -6
  183. package/js/src/pro/gate.d.ts +12 -11
  184. package/js/src/pro/gate.js +20 -17
  185. package/js/src/pro/gemini.d.ts +7 -7
  186. package/js/src/pro/hitbtc.d.ts +13 -13
  187. package/js/src/pro/hollaex.d.ts +6 -6
  188. package/js/src/pro/htx.d.ts +12 -12
  189. package/js/src/pro/huobijp.d.ts +5 -5
  190. package/js/src/pro/idex.d.ts +7 -7
  191. package/js/src/pro/independentreserve.d.ts +4 -4
  192. package/js/src/pro/kraken.d.ts +11 -11
  193. package/js/src/pro/krakenfutures.d.ts +15 -15
  194. package/js/src/pro/kucoin.d.ts +14 -13
  195. package/js/src/pro/kucoin.js +39 -39
  196. package/js/src/pro/kucoinfutures.d.ts +12 -11
  197. package/js/src/pro/kucoinfutures.js +40 -36
  198. package/js/src/pro/luno.d.ts +3 -3
  199. package/js/src/pro/mexc.d.ts +11 -11
  200. package/js/src/pro/ndax.d.ts +5 -5
  201. package/js/src/pro/okcoin.d.ts +7 -7
  202. package/js/src/pro/okx.d.ts +17 -17
  203. package/js/src/pro/okx.js +16 -29
  204. package/js/src/pro/phemex.d.ts +9 -9
  205. package/js/src/pro/poloniex.d.ts +13 -13
  206. package/js/src/pro/poloniexfutures.d.ts +10 -10
  207. package/js/src/pro/probit.d.ts +7 -7
  208. package/js/src/pro/upbit.d.ts +4 -4
  209. package/js/src/pro/wazirx.d.ts +12 -12
  210. package/js/src/pro/whitebit.d.ts +10 -10
  211. package/js/src/pro/woo.d.ts +11 -11
  212. package/js/src/probit.d.ts +1 -1
  213. package/js/src/timex.d.ts +1 -1
  214. package/js/src/tokocrypto.d.ts +1 -1
  215. package/js/src/tokocrypto.js +0 -1
  216. package/js/src/upbit.d.ts +1 -1
  217. package/js/src/upbit.js +36 -26
  218. package/js/src/wavesexchange.d.ts +1 -1
  219. package/js/src/wazirx.d.ts +1 -1
  220. package/js/src/wazirx.js +0 -2
  221. package/js/src/whitebit.d.ts +1 -1
  222. package/js/src/whitebit.js +0 -2
  223. package/js/src/woo.d.ts +1 -1
  224. package/js/src/woo.js +0 -2
  225. package/js/src/yobit.d.ts +1 -1
  226. package/js/src/zaif.d.ts +1 -1
  227. package/js/src/zonda.d.ts +1 -1
  228. package/jsdoc2md.js +0 -2
  229. package/package.json +1 -1
  230. package/skip-tests.json +3 -14
  231. package/js/src/abstract/bittrex.d.ts +0 -79
  232. package/js/src/abstract/bittrex.js +0 -11
  233. package/js/src/abstract/coinbaseprime.d.ts +0 -69
  234. package/js/src/abstract/coinbaseprime.js +0 -11
package/dist/cjs/ccxt.js CHANGED
@@ -40,7 +40,6 @@ var bitpanda = require('./src/bitpanda.js');
40
40
  var bitrue = require('./src/bitrue.js');
41
41
  var bitso = require('./src/bitso.js');
42
42
  var bitstamp = require('./src/bitstamp.js');
43
- var bittrex = require('./src/bittrex.js');
44
43
  var bitvavo = require('./src/bitvavo.js');
45
44
  var bl3p = require('./src/bl3p.js');
46
45
  var blockchaincom = require('./src/blockchaincom.js');
@@ -51,7 +50,6 @@ var btcturk = require('./src/btcturk.js');
51
50
  var bybit = require('./src/bybit.js');
52
51
  var cex = require('./src/cex.js');
53
52
  var coinbase = require('./src/coinbase.js');
54
- var coinbaseprime = require('./src/coinbaseprime.js');
55
53
  var coinbasepro = require('./src/coinbasepro.js');
56
54
  var coincheck = require('./src/coincheck.js');
57
55
  var coinex = require('./src/coinex.js');
@@ -129,13 +127,11 @@ var bitopro$1 = require('./src/pro/bitopro.js');
129
127
  var bitpanda$1 = require('./src/pro/bitpanda.js');
130
128
  var bitrue$1 = require('./src/pro/bitrue.js');
131
129
  var bitstamp$1 = require('./src/pro/bitstamp.js');
132
- var bittrex$1 = require('./src/pro/bittrex.js');
133
130
  var bitvavo$1 = require('./src/pro/bitvavo.js');
134
131
  var blockchaincom$1 = require('./src/pro/blockchaincom.js');
135
132
  var bybit$1 = require('./src/pro/bybit.js');
136
133
  var cex$1 = require('./src/pro/cex.js');
137
134
  var coinbase$1 = require('./src/pro/coinbase.js');
138
- var coinbaseprime$1 = require('./src/pro/coinbaseprime.js');
139
135
  var coinbasepro$1 = require('./src/pro/coinbasepro.js');
140
136
  var coinex$1 = require('./src/pro/coinex.js');
141
137
  var cryptocom$1 = require('./src/pro/cryptocom.js');
@@ -172,7 +168,7 @@ var woo$1 = require('./src/pro/woo.js');
172
168
 
173
169
  //-----------------------------------------------------------------------------
174
170
  // this is updated by vss.js when building
175
- const version = '4.1.86';
171
+ const version = '4.1.88';
176
172
  Exchange["default"].ccxtVersion = version;
177
173
  const exchanges = {
178
174
  'ace': ace,
@@ -203,7 +199,6 @@ const exchanges = {
203
199
  'bitrue': bitrue,
204
200
  'bitso': bitso,
205
201
  'bitstamp': bitstamp,
206
- 'bittrex': bittrex,
207
202
  'bitvavo': bitvavo,
208
203
  'bl3p': bl3p,
209
204
  'blockchaincom': blockchaincom,
@@ -214,7 +209,6 @@ const exchanges = {
214
209
  'bybit': bybit,
215
210
  'cex': cex,
216
211
  'coinbase': coinbase,
217
- 'coinbaseprime': coinbaseprime,
218
212
  'coinbasepro': coinbasepro,
219
213
  'coincheck': coincheck,
220
214
  'coinex': coinex,
@@ -294,13 +288,11 @@ const pro = {
294
288
  'bitpanda': bitpanda$1,
295
289
  'bitrue': bitrue$1,
296
290
  'bitstamp': bitstamp$1,
297
- 'bittrex': bittrex$1,
298
291
  'bitvavo': bitvavo$1,
299
292
  'blockchaincom': blockchaincom$1,
300
293
  'bybit': bybit$1,
301
294
  'cex': cex$1,
302
295
  'coinbase': coinbase$1,
303
- 'coinbaseprime': coinbaseprime$1,
304
296
  'coinbasepro': coinbasepro$1,
305
297
  'coinex': coinex$1,
306
298
  'cryptocom': cryptocom$1,
@@ -404,7 +396,6 @@ exports.bitpanda = bitpanda;
404
396
  exports.bitrue = bitrue;
405
397
  exports.bitso = bitso;
406
398
  exports.bitstamp = bitstamp;
407
- exports.bittrex = bittrex;
408
399
  exports.bitvavo = bitvavo;
409
400
  exports.bl3p = bl3p;
410
401
  exports.blockchaincom = blockchaincom;
@@ -415,7 +406,6 @@ exports.btcturk = btcturk;
415
406
  exports.bybit = bybit;
416
407
  exports.cex = cex;
417
408
  exports.coinbase = coinbase;
418
- exports.coinbaseprime = coinbaseprime;
419
409
  exports.coinbasepro = coinbasepro;
420
410
  exports.coincheck = coincheck;
421
411
  exports.coinex = coinex;
@@ -976,7 +976,7 @@ class Exchange {
976
976
  }
977
977
  }
978
978
  spawn(method, ...args) {
979
- const future = Future.createFuture();
979
+ const future = Future.Future();
980
980
  method.apply(this, args).then(future.resolve).catch(future.reject);
981
981
  return future;
982
982
  }
@@ -1029,6 +1029,99 @@ class Exchange {
1029
1029
  }
1030
1030
  return this.clients[url];
1031
1031
  }
1032
+ watchMultiple(url, messageHashes, message = undefined, subscribeHashes = undefined, subscription = undefined) {
1033
+ //
1034
+ // Without comments the code of this method is short and easy:
1035
+ //
1036
+ // const client = this.client (url)
1037
+ // const backoffDelay = 0
1038
+ // const future = client.future (messageHash)
1039
+ // const connected = client.connect (backoffDelay)
1040
+ // connected.then (() => {
1041
+ // if (message && !client.subscriptions[subscribeHash]) {
1042
+ // client.subscriptions[subscribeHash] = true
1043
+ // client.send (message)
1044
+ // }
1045
+ // }).catch ((error) => {})
1046
+ // return future
1047
+ //
1048
+ // The following is a longer version of this method with comments
1049
+ //
1050
+ const client = this.client(url);
1051
+ // todo: calculate the backoff using the clients cache
1052
+ const backoffDelay = 0;
1053
+ //
1054
+ // watchOrderBook ---- future ----+---------------+----→ user
1055
+ // | |
1056
+ // ↓ ↑
1057
+ // | |
1058
+ // connect ......→ resolve
1059
+ // | |
1060
+ // ↓ ↑
1061
+ // | |
1062
+ // subscribe -----→ receive
1063
+ //
1064
+ const future = Future.Future.race(messageHashes.map(messageHash => client.future(messageHash)));
1065
+ // read and write subscription, this is done before connecting the client
1066
+ // to avoid race conditions when other parts of the code read or write to the client.subscriptions
1067
+ let missingSubscriptions = [];
1068
+ if (subscribeHashes !== undefined) {
1069
+ for (let i = 0; i < subscribeHashes.length; i++) {
1070
+ const subscribeHash = subscribeHashes[i];
1071
+ if (!client.subscriptions[subscribeHash]) {
1072
+ missingSubscriptions.push(subscribeHash);
1073
+ client.subscriptions[subscribeHash] = subscription || true;
1074
+ }
1075
+ }
1076
+ }
1077
+ // we intentionally do not use await here to avoid unhandled exceptions
1078
+ // the policy is to make sure that 100% of promises are resolved or rejected
1079
+ // either with a call to client.resolve or client.reject with
1080
+ // a proper exception class instance
1081
+ const connected = client.connect(backoffDelay);
1082
+ // the following is executed only if the catch-clause does not
1083
+ // catch any connection-level exceptions from the client
1084
+ // (connection established successfully)
1085
+ if ((subscribeHashes === undefined) || missingSubscriptions.length) {
1086
+ connected.then(() => {
1087
+ const options = this.safeValue(this.options, 'ws');
1088
+ const cost = this.safeValue(options, 'cost', 1);
1089
+ if (message) {
1090
+ if (this.enableRateLimit && client.throttle) {
1091
+ // add cost here |
1092
+ // |
1093
+ // V
1094
+ client.throttle(cost).then(() => {
1095
+ client.send(message);
1096
+ }).catch((e) => {
1097
+ for (let i = 0; i < missingSubscriptions.length; i++) {
1098
+ const subscribeHash = missingSubscriptions[i];
1099
+ delete client.subscriptions[subscribeHash];
1100
+ }
1101
+ future.reject(e);
1102
+ });
1103
+ }
1104
+ else {
1105
+ client.send(message)
1106
+ .catch((e) => {
1107
+ for (let i = 0; i < missingSubscriptions.length; i++) {
1108
+ const subscribeHash = missingSubscriptions[i];
1109
+ delete client.subscriptions[subscribeHash];
1110
+ }
1111
+ future.reject(e);
1112
+ });
1113
+ }
1114
+ }
1115
+ }).catch((e) => {
1116
+ for (let i = 0; i < missingSubscriptions.length; i++) {
1117
+ const subscribeHash = missingSubscriptions[i];
1118
+ delete client.subscriptions[subscribeHash];
1119
+ }
1120
+ future.reject(e);
1121
+ });
1122
+ }
1123
+ return future;
1124
+ }
1032
1125
  watch(url, messageHash, message = undefined, subscribeHash = undefined, subscription = undefined) {
1033
1126
  //
1034
1127
  // Without comments the code of this method is short and easy:
@@ -1393,7 +1486,7 @@ class Exchange {
1393
1486
  const length = usedProxies.length;
1394
1487
  if (length > 1) {
1395
1488
  const joinedProxyNames = usedProxies.join(',');
1396
- throw new errors.ExchangeError(this.id + ' you have multiple conflicting settings (' + joinedProxyNames + '), please use only one from: wsProxy, wssProxy, socksProxy');
1489
+ throw new errors.ExchangeError(this.id + ' you have multiple conflicting settings (' + joinedProxyNames + '), please use only one from: wsProxy, wssProxy, wsSocksProxy');
1397
1490
  }
1398
1491
  return [wsProxy, wssProxy, wsSocksProxy];
1399
1492
  }
@@ -4518,31 +4611,6 @@ class Exchange {
4518
4611
  */
4519
4612
  return this.filterByArray(objects, key, values, indexed);
4520
4613
  }
4521
- resolvePromiseIfMessagehashMatches(client, prefix, symbol, data) {
4522
- const messageHashes = this.findMessageHashes(client, prefix);
4523
- for (let i = 0; i < messageHashes.length; i++) {
4524
- const messageHash = messageHashes[i];
4525
- const parts = messageHash.split('::');
4526
- const symbolsString = parts[1];
4527
- const symbols = symbolsString.split(',');
4528
- if (this.inArray(symbol, symbols)) {
4529
- client.resolve(data, messageHash);
4530
- }
4531
- }
4532
- }
4533
- resolveMultipleOHLCV(client, prefix, symbol, timeframe, data) {
4534
- const messageHashes = this.findMessageHashes(client, 'multipleOHLCV::');
4535
- for (let i = 0; i < messageHashes.length; i++) {
4536
- const messageHash = messageHashes[i];
4537
- const parts = messageHash.split('::');
4538
- const symbolsAndTimeframes = parts[1];
4539
- const splitted = symbolsAndTimeframes.split(',');
4540
- const id = symbol + '#' + timeframe;
4541
- if (this.inArray(id, splitted)) {
4542
- client.resolve([symbol, timeframe, data], messageHash);
4543
- }
4544
- }
4545
- }
4546
4614
  createOHLCVObject(symbol, timeframe, data) {
4547
4615
  const res = {};
4548
4616
  res[symbol] = {};
@@ -44,11 +44,11 @@ class Client {
44
44
  };
45
45
  Object.assign(this, generic.deepExtend(defaults, config));
46
46
  // connection-related Future
47
- this.connected = Future.createFuture();
47
+ this.connected = Future.Future();
48
48
  }
49
49
  future(messageHash) {
50
50
  if (!(messageHash in this.futures)) {
51
- this.futures[messageHash] = Future.createFuture();
51
+ this.futures[messageHash] = Future.Future();
52
52
  }
53
53
  const future = this.futures[messageHash];
54
54
  if (messageHash in this.rejections) {
@@ -226,7 +226,7 @@ class Client {
226
226
  this.log(new Date(), 'sending', message);
227
227
  }
228
228
  message = (typeof message === 'string') ? message : JSON.stringify(message);
229
- const future = Future.createFuture();
229
+ const future = Future.Future();
230
230
  if (platform.isNode) {
231
231
  /* eslint-disable no-inner-declarations */
232
232
  function onSendComplete(error) {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  // @ts-nocheck
6
- function createFuture() {
6
+ function Future() {
7
7
  let resolve = undefined, reject = undefined;
8
8
  const p = new Promise((resolve_, reject_) => {
9
9
  resolve = resolve_;
@@ -23,5 +23,12 @@ function createFuture() {
23
23
  };
24
24
  return p;
25
25
  }
26
+ function wrapFuture(aggregatePromise) {
27
+ const p = Future();
28
+ // wrap the promises as a future
29
+ aggregatePromise.then(p.resolve, p.reject);
30
+ return p;
31
+ }
32
+ Future.race = (futures) => wrapFuture(Promise.race(futures));
26
33
 
27
- exports.createFuture = createFuture;
34
+ exports.Future = Future;
@@ -58,7 +58,7 @@ class WsClient extends Client {
58
58
  close() {
59
59
  if (this.connection instanceof WebSocketPlatform) {
60
60
  if (this.disconnected === undefined) {
61
- this.disconnected = Future.createFuture();
61
+ this.disconnected = Future.Future();
62
62
  }
63
63
  this.connection.close();
64
64
  }
@@ -78,7 +78,6 @@ class binance extends binance$1 {
78
78
  'fetchIsolatedBorrowRate': false,
79
79
  'fetchIsolatedBorrowRates': false,
80
80
  'fetchL3OrderBook': false,
81
- 'fetchLastPrices': true,
82
81
  'fetchLedger': true,
83
82
  'fetchLeverage': false,
84
83
  'fetchLeverageTiers': true,
@@ -3126,110 +3125,6 @@ class binance extends binance$1 {
3126
3125
  }
3127
3126
  return this.parseTickers(response, symbols);
3128
3127
  }
3129
- async fetchLastPrices(symbols = undefined, params = {}) {
3130
- /**
3131
- * @method
3132
- * @name binance#fetchLastPrices
3133
- * @description fetches the last price for multiple markets
3134
- * @see https://binance-docs.github.io/apidocs/spot/en/#symbol-price-ticker // spot
3135
- * @see https://binance-docs.github.io/apidocs/future/en/#symbol-price-ticker // swap
3136
- * @see https://binance-docs.github.io/apidocs/delivery/en/#symbol-price-ticker // future
3137
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the last prices
3138
- * @param {object} [params] extra parameters specific to the exchange API endpoint
3139
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
3140
- */
3141
- await this.loadMarkets();
3142
- symbols = this.marketSymbols(symbols);
3143
- const market = this.getMarketFromSymbols(symbols);
3144
- let type = undefined;
3145
- let subType = undefined;
3146
- [subType, params] = this.handleSubTypeAndParams('fetchLastPrices', market, params);
3147
- [type, params] = this.handleMarketTypeAndParams('fetchLastPrices', market, params);
3148
- let response = undefined;
3149
- if (this.isLinear(type, subType)) {
3150
- response = await this.fapiPublicV2GetTickerPrice(params);
3151
- //
3152
- // [
3153
- // {
3154
- // "symbol": "LTCBTC",
3155
- // "price": "4.00000200"
3156
- // "time": 1589437530011
3157
- // },
3158
- // ...
3159
- // ]
3160
- //
3161
- }
3162
- else if (this.isInverse(type, subType)) {
3163
- response = await this.dapiPublicGetTickerPrice(params);
3164
- //
3165
- // [
3166
- // {
3167
- // "symbol": "BTCUSD_200626",
3168
- // "ps": "9647.8",
3169
- // "price": "9647.8",
3170
- // "time": 1591257246176
3171
- // }
3172
- // ]
3173
- //
3174
- }
3175
- else if (type === 'spot') {
3176
- response = await this.publicGetTickerPrice(params);
3177
- //
3178
- // [
3179
- // {
3180
- // "symbol": "LTCBTC",
3181
- // "price": "4.00000200"
3182
- // },
3183
- // ...
3184
- // ]
3185
- //
3186
- }
3187
- else {
3188
- throw new errors.NotSupported(this.id + ' fetchLastPrices() does not support ' + type + ' markets yet');
3189
- }
3190
- return this.parseLastPrices(response, symbols);
3191
- }
3192
- parseLastPrice(info, market = undefined) {
3193
- //
3194
- // spot
3195
- //
3196
- // {
3197
- // "symbol": "LTCBTC",
3198
- // "price": "4.00000200"
3199
- // }
3200
- //
3201
- // usdm (swap/future)
3202
- //
3203
- // {
3204
- // "symbol": "BTCUSDT",
3205
- // "price": "6000.01",
3206
- // "time": 1589437530011 // Transaction time
3207
- // }
3208
- //
3209
- //
3210
- // coinm (swap/future)
3211
- //
3212
- // {
3213
- // "symbol": "BTCUSD_200626", // symbol ("BTCUSD_200626", "BTCUSD_PERP", etc..)
3214
- // "ps": "BTCUSD", // pair
3215
- // "price": "9647.8",
3216
- // "time": 1591257246176
3217
- // }
3218
- //
3219
- const timestamp = this.safeInteger(info, 'time');
3220
- const type = (timestamp === undefined) ? 'spot' : 'swap';
3221
- const marketId = this.safeString(info, 'symbol');
3222
- market = this.safeMarket(marketId, market, undefined, type);
3223
- const price = this.safeNumber(info, 'price');
3224
- return {
3225
- 'symbol': market['symbol'],
3226
- 'timestamp': timestamp,
3227
- 'datetime': this.iso8601(timestamp),
3228
- 'price': price,
3229
- 'side': undefined,
3230
- 'info': info,
3231
- };
3232
- }
3233
3128
  async fetchTickers(symbols = undefined, params = {}) {
3234
3129
  /**
3235
3130
  * @method
@@ -3823,6 +3718,7 @@ class binance extends binance$1 {
3823
3718
  /**
3824
3719
  * @method
3825
3720
  * @name binance#editSpotOrder
3721
+ * @ignore
3826
3722
  * @description edit a trade order
3827
3723
  * @see https://binance-docs.github.io/apidocs/spot/en/#cancel-an-existing-order-and-send-a-new-order-trade
3828
3724
  * @param {string} id cancel order id
@@ -6877,6 +6773,7 @@ class binance extends binance$1 {
6877
6773
  /**
6878
6774
  * @method
6879
6775
  * @name binance#futuresTransfer
6776
+ * @ignore
6880
6777
  * @description transfer between futures account
6881
6778
  * @see https://binance-docs.github.io/apidocs/spot/en/#new-future-account-transfer-user_data
6882
6779
  * @param {string} code unified currency code
@@ -7850,6 +7747,7 @@ class binance extends binance$1 {
7850
7747
  /**
7851
7748
  * @method
7852
7749
  * @name binance#fetchAccountPositions
7750
+ * @ignore
7853
7751
  * @description fetch account positions
7854
7752
  * @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
7855
7753
  * @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
@@ -7888,6 +7786,7 @@ class binance extends binance$1 {
7888
7786
  /**
7889
7787
  * @method
7890
7788
  * @name binance#fetchPositionsRisk
7789
+ * @ignore
7891
7790
  * @description fetch positions risk
7892
7791
  * @see https://binance-docs.github.io/apidocs/futures/en/#position-information-v2-user_data
7893
7792
  * @see https://binance-docs.github.io/apidocs/delivery/en/#position-information-user_data
@@ -47,7 +47,6 @@ class binanceus extends binance {
47
47
  'future': undefined,
48
48
  'option': false,
49
49
  'addMargin': false,
50
- 'borrowMargin': false,
51
50
  'closeAllPositions': false,
52
51
  'closePosition': false,
53
52
  'createReduceOnlyOrder': false,
@@ -73,7 +72,6 @@ class binanceus extends binance {
73
72
  'fetchPositionsRisk': false,
74
73
  'fetchPremiumIndexOHLCV': false,
75
74
  'reduceMargin': false,
76
- 'repayMargin': false,
77
75
  'setLeverage': false,
78
76
  'setMargin': false,
79
77
  'setMarginMode': false,
@@ -343,7 +343,13 @@ class bit2c extends bit2c$1 {
343
343
  if (limit !== undefined) {
344
344
  request['limit'] = limit; // max 100000
345
345
  }
346
- const response = await this[method](this.extend(request, params));
346
+ let response = undefined;
347
+ if (method === 'public_get_exchanges_pair_trades') {
348
+ response = await this.publicGetExchangesPairTrades(this.extend(request, params));
349
+ }
350
+ else {
351
+ response = await this.publicGetExchangesPairLasttrades(this.extend(request, params));
352
+ }
347
353
  //
348
354
  // [
349
355
  // {"date":1651785980,"price":127975.68,"amount":0.3750321,"isBid":true,"tid":1261018},
@@ -431,7 +437,7 @@ class bit2c extends bit2c$1 {
431
437
  request['Price'] = price;
432
438
  const amountString = this.numberToString(amount);
433
439
  const priceString = this.numberToString(price);
434
- request['Total'] = this.parseNumber(Precise["default"].stringMul(amountString, priceString));
440
+ request['Total'] = this.parseToNumeric(Precise["default"].stringMul(amountString, priceString));
435
441
  request['IsBid'] = (side === 'buy');
436
442
  }
437
443
  const response = await this[method](this.extend(request, params));
@@ -27,7 +27,6 @@ class bitforex extends bitforex$1 {
27
27
  'future': false,
28
28
  'option': false,
29
29
  'addMargin': false,
30
- 'borrowMargin': false,
31
30
  'cancelOrder': true,
32
31
  'createOrder': true,
33
32
  'createReduceOnlyOrder': false,
@@ -75,7 +74,6 @@ class bitforex extends bitforex$1 {
75
74
  'fetchWithdrawal': false,
76
75
  'fetchWithdrawals': false,
77
76
  'reduceMargin': false,
78
- 'repayMargin': false,
79
77
  'setLeverage': false,
80
78
  'setMargin': false,
81
79
  'setMarginMode': false,