ccxt 4.1.74 → 4.1.76

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 (140) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +620 -342
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/ace.js +2 -0
  6. package/dist/cjs/src/alpaca.js +2 -0
  7. package/dist/cjs/src/base/Exchange.js +14 -2
  8. package/dist/cjs/src/base/errors.js +7 -7
  9. package/dist/cjs/src/base/ws/Client.js +13 -14
  10. package/dist/cjs/src/bigone.js +38 -9
  11. package/dist/cjs/src/binance.js +4 -0
  12. package/dist/cjs/src/binanceus.js +2 -0
  13. package/dist/cjs/src/bingx.js +134 -40
  14. package/dist/cjs/src/bit2c.js +2 -0
  15. package/dist/cjs/src/bitbank.js +2 -0
  16. package/dist/cjs/src/bithumb.js +2 -0
  17. package/dist/cjs/src/bitmart.js +33 -11
  18. package/dist/cjs/src/bitopro.js +2 -0
  19. package/dist/cjs/src/bitpanda.js +2 -0
  20. package/dist/cjs/src/bitso.js +2 -0
  21. package/dist/cjs/src/bitstamp.js +2 -0
  22. package/dist/cjs/src/bittrex.js +2 -0
  23. package/dist/cjs/src/bitvavo.js +2 -0
  24. package/dist/cjs/src/bl3p.js +2 -0
  25. package/dist/cjs/src/btcalpha.js +2 -0
  26. package/dist/cjs/src/btcbox.js +2 -0
  27. package/dist/cjs/src/btcmarkets.js +2 -0
  28. package/dist/cjs/src/btcturk.js +2 -0
  29. package/dist/cjs/src/bybit.js +2 -0
  30. package/dist/cjs/src/coinbase.js +2 -0
  31. package/dist/cjs/src/coincheck.js +2 -0
  32. package/dist/cjs/src/coinlist.js +2 -0
  33. package/dist/cjs/src/coinmate.js +2 -0
  34. package/dist/cjs/src/coinone.js +2 -0
  35. package/dist/cjs/src/coinsph.js +2 -0
  36. package/dist/cjs/src/coinspot.js +2 -0
  37. package/dist/cjs/src/cryptocom.js +2 -185
  38. package/dist/cjs/src/gate.js +1 -0
  39. package/dist/cjs/src/gemini.js +23 -19
  40. package/dist/cjs/src/idex.js +2 -0
  41. package/dist/cjs/src/independentreserve.js +2 -0
  42. package/dist/cjs/src/indodax.js +2 -0
  43. package/dist/cjs/src/kraken.js +154 -11
  44. package/dist/cjs/src/kucoin.js +2 -0
  45. package/dist/cjs/src/kuna.js +2 -0
  46. package/dist/cjs/src/latoken.js +2 -0
  47. package/dist/cjs/src/luno.js +2 -0
  48. package/dist/cjs/src/mercado.js +2 -0
  49. package/dist/cjs/src/mexc.js +2 -0
  50. package/dist/cjs/src/ndax.js +2 -0
  51. package/dist/cjs/src/novadax.js +2 -0
  52. package/dist/cjs/src/okx.js +24 -9
  53. package/dist/cjs/src/p2b.js +2 -0
  54. package/dist/cjs/src/poloniex.js +27 -25
  55. package/dist/cjs/src/pro/binance.js +60 -8
  56. package/dist/cjs/src/pro/coinbasepro.js +1 -1
  57. package/dist/cjs/src/static_dependencies/proxies/http-proxy-agent/index.js +8 -11
  58. package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/index.js +5 -8
  59. package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +5 -12
  60. package/dist/cjs/src/wavesexchange.js +2 -0
  61. package/dist/cjs/src/wazirx.js +2 -0
  62. package/dist/cjs/src/woo.js +2 -0
  63. package/dist/cjs/src/yobit.js +2 -0
  64. package/dist/cjs/src/zonda.js +2 -0
  65. package/js/ccxt.d.ts +1 -1
  66. package/js/ccxt.js +1 -1
  67. package/js/src/abstract/binance.d.ts +2 -0
  68. package/js/src/abstract/binancecoinm.d.ts +2 -0
  69. package/js/src/abstract/binanceus.d.ts +2 -0
  70. package/js/src/abstract/binanceusdm.d.ts +2 -0
  71. package/js/src/abstract/okx.d.ts +14 -0
  72. package/js/src/ace.js +2 -0
  73. package/js/src/alpaca.js +2 -0
  74. package/js/src/base/Exchange.d.ts +4 -0
  75. package/js/src/base/Exchange.js +14 -2
  76. package/js/src/base/errors.d.ts +4 -4
  77. package/js/src/base/errors.js +7 -7
  78. package/js/src/base/ws/Client.js +13 -14
  79. package/js/src/bigone.d.ts +1 -0
  80. package/js/src/bigone.js +38 -9
  81. package/js/src/binance.js +4 -0
  82. package/js/src/binanceus.js +2 -0
  83. package/js/src/bingx.d.ts +7 -3
  84. package/js/src/bingx.js +135 -41
  85. package/js/src/bit2c.js +2 -0
  86. package/js/src/bitbank.js +2 -0
  87. package/js/src/bithumb.js +2 -0
  88. package/js/src/bitmart.d.ts +1 -0
  89. package/js/src/bitmart.js +33 -11
  90. package/js/src/bitopro.js +2 -0
  91. package/js/src/bitpanda.js +2 -0
  92. package/js/src/bitso.js +2 -0
  93. package/js/src/bitstamp.js +2 -0
  94. package/js/src/bittrex.js +2 -0
  95. package/js/src/bitvavo.js +2 -0
  96. package/js/src/bl3p.js +2 -0
  97. package/js/src/btcalpha.js +2 -0
  98. package/js/src/btcbox.js +2 -0
  99. package/js/src/btcmarkets.js +2 -0
  100. package/js/src/btcturk.js +2 -0
  101. package/js/src/bybit.js +2 -0
  102. package/js/src/coinbase.js +2 -0
  103. package/js/src/coincheck.js +2 -0
  104. package/js/src/coinlist.js +2 -0
  105. package/js/src/coinmate.js +2 -0
  106. package/js/src/coinone.js +2 -0
  107. package/js/src/coinsph.js +2 -0
  108. package/js/src/coinspot.js +2 -0
  109. package/js/src/cryptocom.d.ts +0 -24
  110. package/js/src/cryptocom.js +2 -185
  111. package/js/src/gate.js +1 -0
  112. package/js/src/gemini.js +23 -19
  113. package/js/src/idex.js +2 -0
  114. package/js/src/independentreserve.js +2 -0
  115. package/js/src/indodax.js +2 -0
  116. package/js/src/kraken.d.ts +2 -0
  117. package/js/src/kraken.js +154 -11
  118. package/js/src/kucoin.js +2 -0
  119. package/js/src/kuna.js +2 -0
  120. package/js/src/latoken.js +2 -0
  121. package/js/src/luno.js +2 -0
  122. package/js/src/mercado.js +2 -0
  123. package/js/src/mexc.js +2 -0
  124. package/js/src/ndax.js +2 -0
  125. package/js/src/novadax.js +2 -0
  126. package/js/src/okx.js +24 -9
  127. package/js/src/p2b.js +2 -0
  128. package/js/src/poloniex.js +27 -25
  129. package/js/src/pro/binance.d.ts +1 -0
  130. package/js/src/pro/binance.js +61 -9
  131. package/js/src/pro/coinbasepro.js +1 -1
  132. package/js/src/static_dependencies/proxies/http-proxy-agent/index.js +9 -8
  133. package/js/src/static_dependencies/proxies/https-proxy-agent/index.js +5 -7
  134. package/js/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +5 -7
  135. package/js/src/wavesexchange.js +2 -0
  136. package/js/src/wazirx.js +2 -0
  137. package/js/src/woo.js +2 -0
  138. package/js/src/yobit.js +2 -0
  139. package/js/src/zonda.js +2 -0
  140. package/package.json +1 -1
@@ -325,6 +325,91 @@ class kraken extends kraken$1 {
325
325
  'ZEC': 'Zcash (Transparent)',
326
326
  'ZRX': '0x (ZRX)',
327
327
  },
328
+ 'withdrawMethods': {
329
+ 'Lightning': 'Lightning',
330
+ 'Bitcoin': 'BTC',
331
+ 'Ripple': 'XRP',
332
+ 'Litecoin': 'LTC',
333
+ 'Dogecoin': 'DOGE',
334
+ 'Stellar': 'XLM',
335
+ 'Ethereum': 'ERC20',
336
+ 'Arbitrum One': 'Arbitrum',
337
+ 'Polygon': 'MATIC',
338
+ 'Arbitrum Nova': 'Arbitrum',
339
+ 'Optimism': 'Optimism',
340
+ 'zkSync Era': 'zkSync',
341
+ 'Ethereum Classic': 'ETC',
342
+ 'Zcash': 'ZEC',
343
+ 'Monero': 'XMR',
344
+ 'Tron': 'TRC20',
345
+ 'Solana': 'SOL',
346
+ 'EOS': 'EOS',
347
+ 'Bitcoin Cash': 'BCH',
348
+ 'Cardano': 'ADA',
349
+ 'Qtum': 'QTUM',
350
+ 'Tezos': 'XTZ',
351
+ 'Cosmos': 'ATOM',
352
+ 'Nano': 'NANO',
353
+ 'Siacoin': 'SC',
354
+ 'Lisk': 'LSK',
355
+ 'Waves': 'WAVES',
356
+ 'ICON': 'ICX',
357
+ 'Algorand': 'ALGO',
358
+ 'Polygon - USDC.e': 'MATIC',
359
+ 'Arbitrum One - USDC.e': 'Arbitrum',
360
+ 'Polkadot': 'DOT',
361
+ 'Kava': 'KAVA',
362
+ 'Filecoin': 'FIL',
363
+ 'Kusama': 'KSM',
364
+ 'Flow': 'FLOW',
365
+ 'Energy Web': 'EW',
366
+ 'Mina': 'MINA',
367
+ 'Centrifuge': 'CFG',
368
+ 'Karura': 'KAR',
369
+ 'Moonriver': 'MOVR',
370
+ 'Shiden': 'SDN',
371
+ 'Khala': 'PHA',
372
+ 'Bifrost Kusama': 'BNC',
373
+ 'Songbird': 'SGB',
374
+ 'Terra classic': 'LUNC',
375
+ 'KILT': 'KILT',
376
+ 'Basilisk': 'BSX',
377
+ 'Flare': 'FLR',
378
+ 'Avalanche C-Chain': 'AVAX',
379
+ 'Kintsugi': 'KINT',
380
+ 'Altair': 'AIR',
381
+ 'Moonbeam': 'GLMR',
382
+ 'Acala': 'ACA',
383
+ 'Astar': 'ASTR',
384
+ 'Akash': 'AKT',
385
+ 'Robonomics': 'XRT',
386
+ 'Fantom': 'FTM',
387
+ 'Elrond': 'EGLD',
388
+ 'THORchain': 'RUNE',
389
+ 'Secret': 'SCRT',
390
+ 'Near': 'NEAR',
391
+ 'Internet Computer Protocol': 'ICP',
392
+ 'Picasso': 'PICA',
393
+ 'Crust Shadow': 'CSM',
394
+ 'Integritee': 'TEER',
395
+ 'Parallel Finance': 'PARA',
396
+ 'HydraDX': 'HDX',
397
+ 'Interlay': 'INTR',
398
+ 'Fetch.ai': 'FET',
399
+ 'NYM': 'NYM',
400
+ 'Terra 2.0': 'LUNA2',
401
+ 'Juno': 'JUNO',
402
+ 'Nodle': 'NODL',
403
+ 'Stacks': 'STX',
404
+ 'Ethereum PoW': 'ETHW',
405
+ 'Aptos': 'APT',
406
+ 'Sui': 'SUI',
407
+ 'Genshiro': 'GENS',
408
+ 'Aventus': 'AVT',
409
+ 'Sei': 'SEI',
410
+ 'OriginTrail': 'OTP',
411
+ 'Celestia': 'TIA',
412
+ },
328
413
  },
329
414
  'precisionMode': number.TICK_SIZE,
330
415
  'exceptions': {
@@ -2071,6 +2156,10 @@ class kraken extends kraken$1 {
2071
2156
  };
2072
2157
  return this.safeString(statuses, status, status);
2073
2158
  }
2159
+ parseNetwork(network) {
2160
+ const withdrawMethods = this.safeValue(this.options, 'withdrawMethods', {});
2161
+ return this.safeString(withdrawMethods, network, network);
2162
+ }
2074
2163
  parseTransaction(transaction, currency = undefined) {
2075
2164
  //
2076
2165
  // fetchDeposits
@@ -2121,6 +2210,8 @@ class kraken extends kraken$1 {
2121
2210
  // "fee": "0.0050000000",
2122
2211
  // "time": 1530481750,
2123
2212
  // "status": "Success"
2213
+ // "key":"Huobi wallet",
2214
+ // "network":"Tron"
2124
2215
  // status-prop: 'on-hold' // this field might not be present in some cases
2125
2216
  // }
2126
2217
  //
@@ -2157,7 +2248,7 @@ class kraken extends kraken$1 {
2157
2248
  'id': id,
2158
2249
  'currency': code,
2159
2250
  'amount': amount,
2160
- 'network': undefined,
2251
+ 'network': this.parseNetwork(this.safeString(transaction, 'network')),
2161
2252
  'address': address,
2162
2253
  'addressTo': undefined,
2163
2254
  'addressFrom': undefined,
@@ -2261,19 +2352,28 @@ class kraken extends kraken$1 {
2261
2352
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
2262
2353
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
2263
2354
  * @param {object} [params] extra parameters specific to the exchange API endpoint
2355
+ * @param {object} [params.end] End timestamp, withdrawals created strictly after will be not be included in the response
2356
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times
2264
2357
  * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
2265
- */
2266
- // https://www.kraken.com/en-us/help/api#withdraw-status
2267
- if (code === undefined) {
2268
- throw new errors.ArgumentsRequired(this.id + ' fetchWithdrawals() requires a currency code argument');
2269
- }
2358
+ */
2270
2359
  await this.loadMarkets();
2271
- const currency = this.currency(code);
2272
- const request = {
2273
- 'asset': currency['id'],
2274
- };
2360
+ let paginate = false;
2361
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchWithdrawals', 'paginate');
2362
+ if (paginate) {
2363
+ params['cursor'] = true;
2364
+ return await this.fetchPaginatedCallCursor('fetchWithdrawals', code, since, limit, params, 'next_cursor', 'cursor');
2365
+ }
2366
+ const request = {};
2367
+ if (code !== undefined) {
2368
+ const currency = this.currency(code);
2369
+ request['asset'] = currency['id'];
2370
+ }
2371
+ if (since !== undefined) {
2372
+ request['since'] = since.toString();
2373
+ }
2275
2374
  const response = await this.privatePostWithdrawStatus(this.extend(request, params));
2276
2375
  //
2376
+ // with no pagination
2277
2377
  // { error: [],
2278
2378
  // "result": [ { "method": "Ether",
2279
2379
  // "aclass": "currency",
@@ -2285,8 +2385,51 @@ class kraken extends kraken$1 {
2285
2385
  // "fee": "0.0050000000",
2286
2386
  // "time": 1530481750,
2287
2387
  // "status": "Success" } ] }
2388
+ // with pagination
2389
+ // {
2390
+ // "error":[],
2391
+ // "result":{
2392
+ // "withdrawals":[
2393
+ // {
2394
+ // "method":"Tether USD (TRC20)",
2395
+ // "aclass":"currency",
2396
+ // "asset":"USDT",
2397
+ // "refid":"BSNFZU2-MEFN4G-J3NEZV",
2398
+ // "txid":"1c7a642fb7387bbc2c6a2c509fd1ae146937f4cf793b4079a4f0715e3a02615a",
2399
+ // "info":"TQmdxSuC16EhFg8FZWtYgrfFRosoRF7bCp",
2400
+ // "amount":"1996.50000000",
2401
+ // "fee":"2.50000000",
2402
+ // "time":1669126657,
2403
+ // "status":"Success",
2404
+ // "key":"poloniex",
2405
+ // "network":"Tron"
2406
+ // },
2407
+ // ...
2408
+ // ],
2409
+ // "next_cursor":"HgAAAAAAAABGVFRSd3k1LVF4Y0JQY05Gd0xRY0NxenFndHpybkwBAQH2AwEBAAAAAQAAAAAAAAABAAAAAAAZAAAAAAAAAA=="
2410
+ // }
2411
+ // }
2288
2412
  //
2289
- return this.parseTransactionsByType('withdrawal', response['result'], code, since, limit);
2413
+ let rawWithdrawals = undefined;
2414
+ const result = this.safeValue(response, 'result');
2415
+ if (!Array.isArray(result)) {
2416
+ rawWithdrawals = this.addPaginationCursorToResult(result);
2417
+ }
2418
+ else {
2419
+ rawWithdrawals = result;
2420
+ }
2421
+ return this.parseTransactionsByType('withdrawal', rawWithdrawals, code, since, limit);
2422
+ }
2423
+ addPaginationCursorToResult(result) {
2424
+ const cursor = this.safeString(result, 'next_cursor');
2425
+ const data = this.safeValue(result, 'withdrawals');
2426
+ const dataLength = data.length;
2427
+ if (cursor !== undefined && dataLength > 0) {
2428
+ const last = data[dataLength - 1];
2429
+ last['next_cursor'] = cursor;
2430
+ data[dataLength - 1] = last;
2431
+ }
2432
+ return data;
2290
2433
  }
2291
2434
  async createDepositAddress(code, params = {}) {
2292
2435
  /**
@@ -35,6 +35,8 @@ class kucoin extends kucoin$1 {
35
35
  'borrowIsolatedMargin': true,
36
36
  'cancelAllOrders': true,
37
37
  'cancelOrder': true,
38
+ 'closeAllPositions': false,
39
+ 'closePosition': false,
38
40
  'createDepositAddress': true,
39
41
  'createOrder': true,
40
42
  'createOrders': true,
@@ -33,6 +33,8 @@ class kuna extends kuna$1 {
33
33
  'borrowMargin': false,
34
34
  'cancelOrder': true,
35
35
  'cancelOrders': true,
36
+ 'closeAllPositions': false,
37
+ 'closePosition': false,
36
38
  'createDepositAddress': true,
37
39
  'createOrder': true,
38
40
  'createPostOnlyOrder': false,
@@ -28,6 +28,8 @@ class latoken extends latoken$1 {
28
28
  'option': false,
29
29
  'cancelAllOrders': true,
30
30
  'cancelOrder': true,
31
+ 'closeAllPositions': false,
32
+ 'closePosition': false,
31
33
  'createOrder': true,
32
34
  'createPostOnlyOrder': false,
33
35
  'createStopLimitOrder': true,
@@ -30,6 +30,8 @@ class luno extends luno$1 {
30
30
  'option': false,
31
31
  'addMargin': false,
32
32
  'cancelOrder': true,
33
+ 'closeAllPositions': false,
34
+ 'closePosition': false,
33
35
  'createOrder': true,
34
36
  'createReduceOnlyOrder': false,
35
37
  'fetchAccounts': true,
@@ -28,6 +28,8 @@ class mercado extends mercado$1 {
28
28
  'option': false,
29
29
  'addMargin': false,
30
30
  'cancelOrder': true,
31
+ 'closeAllPositions': false,
32
+ 'closePosition': false,
31
33
  'createMarketOrder': true,
32
34
  'createOrder': true,
33
35
  'createReduceOnlyOrder': false,
@@ -34,6 +34,8 @@ class mexc extends mexc$1 {
34
34
  'cancelAllOrders': true,
35
35
  'cancelOrder': true,
36
36
  'cancelOrders': undefined,
37
+ 'closeAllPositions': false,
38
+ 'closePosition': false,
37
39
  'createDepositAddress': true,
38
40
  'createOrder': true,
39
41
  'createOrders': true,
@@ -31,6 +31,8 @@ class ndax extends ndax$1 {
31
31
  'addMargin': false,
32
32
  'cancelAllOrders': true,
33
33
  'cancelOrder': true,
34
+ 'closeAllPositions': false,
35
+ 'closePosition': false,
34
36
  'createDepositAddress': true,
35
37
  'createOrder': true,
36
38
  'createReduceOnlyOrder': false,
@@ -32,6 +32,8 @@ class novadax extends novadax$1 {
32
32
  'option': false,
33
33
  'addMargin': false,
34
34
  'cancelOrder': true,
35
+ 'closeAllPositions': false,
36
+ 'closePosition': false,
35
37
  'createOrder': true,
36
38
  'createReduceOnlyOrder': false,
37
39
  'createStopLimitOrder': true,
@@ -235,6 +235,13 @@ class okx extends okx$1 {
235
235
  'finance/savings/lending-rate-history': 5 / 3,
236
236
  // public broker
237
237
  'finance/sfp/dcd/products': 2 / 3,
238
+ // copytrading
239
+ 'copytrading/public-lead-traders': 4,
240
+ 'copytrading/public-weekly-pnl': 4,
241
+ 'copytrading/public-stats': 4,
242
+ 'copytrading/public-preference-currency': 4,
243
+ 'copytrading/public-current-subpositions': 4,
244
+ 'copytrading/public-subpositions-history': 4,
238
245
  },
239
246
  },
240
247
  'private': {
@@ -344,12 +351,16 @@ class okx extends okx$1 {
344
351
  'finance/staking-defi/eth/balance': 5 / 3,
345
352
  'finance/staking-defi/eth/purchase-redeem-history': 5 / 3,
346
353
  // copytrading
347
- 'copytrading/current-subpositions': 4,
348
- 'copytrading/subpositions-history': 10,
349
- 'copytrading/instruments': 10,
350
- 'copytrading/profit-sharing-details': 10,
351
- 'copytrading/total-profit-sharing': 10,
352
- 'copytrading/unrealized-profit-sharing-details': 10,
354
+ 'copytrading/current-subpositions': 1,
355
+ 'copytrading/subpositions-history': 1,
356
+ 'copytrading/instruments': 4,
357
+ 'copytrading/profit-sharing-details': 4,
358
+ 'copytrading/total-profit-sharing': 4,
359
+ 'copytrading/unrealized-profit-sharing-details': 4,
360
+ 'copytrading/copy-settings': 4,
361
+ 'copytrading/batch-leverage-info': 4,
362
+ 'copytrading/current-lead-traders': 4,
363
+ 'copytrading/lead-traders-history': 4,
353
364
  // broker
354
365
  'broker/nd/info': 10,
355
366
  'broker/nd/subaccount-info': 10,
@@ -454,9 +465,13 @@ class okx extends okx$1 {
454
465
  'finance/staking-defi/eth/purchase': 5,
455
466
  'finance/staking-defi/eth/redeem': 5,
456
467
  // copytrading
457
- 'copytrading/algo-order': 20,
458
- 'copytrading/close-subposition': 4,
459
- 'copytrading/set-instruments': 10,
468
+ 'copytrading/algo-order': 1,
469
+ 'copytrading/close-subposition': 1,
470
+ 'copytrading/set-instruments': 4,
471
+ 'copytrading/first-copy-settings': 4,
472
+ 'copytrading/amend-copy-settings': 4,
473
+ 'copytrading/stop-copy-trading': 4,
474
+ 'copytrading/batch-set-leverage': 4,
460
475
  // broker
461
476
  'broker/nd/create-subaccount': 0.25,
462
477
  'broker/nd/delete-subaccount': 1,
@@ -30,6 +30,8 @@ class p2b extends p2b$1 {
30
30
  'cancelAllOrders': false,
31
31
  'cancelOrder': true,
32
32
  'cancelOrders': false,
33
+ 'closeAllPositions': false,
34
+ 'closePosition': false,
33
35
  'createDepositAddress': false,
34
36
  'createMarketOrder': false,
35
37
  'createOrder': true,
@@ -752,32 +752,34 @@ class poloniex extends poloniex$1 {
752
752
  let withdrawAvailable = this.safeValue(result[code], 'withdraw');
753
753
  withdrawAvailable = (withdrawEnabled) ? withdrawEnabled : withdrawAvailable;
754
754
  const networks = this.safeValue(result[code], 'networks', {});
755
- networks[networkCode] = {
756
- 'info': currency,
757
- 'id': networkId,
758
- 'network': networkCode,
759
- 'currencyId': id,
760
- 'numericId': numericId,
761
- 'deposit': depositEnabled,
762
- 'withdraw': withdrawEnabled,
763
- 'active': active,
764
- 'fee': this.parseNumber(feeString),
765
- 'precision': undefined,
766
- 'limits': {
767
- 'amount': {
768
- 'min': undefined,
769
- 'max': undefined,
770
- },
771
- 'withdraw': {
772
- 'min': undefined,
773
- 'max': undefined,
774
- },
775
- 'deposit': {
776
- 'min': undefined,
777
- 'max': undefined,
755
+ if (networkCode !== undefined) {
756
+ networks[networkCode] = {
757
+ 'info': currency,
758
+ 'id': networkId,
759
+ 'network': networkCode,
760
+ 'currencyId': id,
761
+ 'numericId': numericId,
762
+ 'deposit': depositEnabled,
763
+ 'withdraw': withdrawEnabled,
764
+ 'active': active,
765
+ 'fee': this.parseNumber(feeString),
766
+ 'precision': undefined,
767
+ 'limits': {
768
+ 'amount': {
769
+ 'min': undefined,
770
+ 'max': undefined,
771
+ },
772
+ 'withdraw': {
773
+ 'min': undefined,
774
+ 'max': undefined,
775
+ },
776
+ 'deposit': {
777
+ 'min': undefined,
778
+ 'max': undefined,
779
+ },
778
780
  },
779
- },
780
- };
781
+ };
782
+ }
781
783
  result[code]['networks'] = networks;
782
784
  const info = this.safeValue(result[code], 'info', []);
783
785
  const rawInfo = {};
@@ -23,6 +23,7 @@ class binance extends binance$1 {
23
23
  'watchOrderBook': true,
24
24
  'watchOrderBookForSymbols': true,
25
25
  'watchOrders': true,
26
+ 'watchOrdersForSymbols': true,
26
27
  'watchPositions': true,
27
28
  'watchTicker': true,
28
29
  'watchTickers': true,
@@ -2062,6 +2063,7 @@ class binance extends binance$1 {
2062
2063
  /**
2063
2064
  * @method
2064
2065
  * @name binance#watchOrders
2066
+ * @see https://binance-docs.github.io/apidocs/spot/en/#payload-order-update
2065
2067
  * @description watches information on multiple orders made by the user
2066
2068
  * @param {string} symbol unified market symbol of the market orders were made in
2067
2069
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -2075,7 +2077,7 @@ class binance extends binance$1 {
2075
2077
  if (symbol !== undefined) {
2076
2078
  market = this.market(symbol);
2077
2079
  symbol = market['symbol'];
2078
- messageHash += ':' + symbol;
2080
+ messageHash += '::' + symbol;
2079
2081
  }
2080
2082
  let type = undefined;
2081
2083
  [type, params] = this.handleMarketTypeAndParams('watchOrders', market, params);
@@ -2098,11 +2100,63 @@ class binance extends binance$1 {
2098
2100
  this.setBalanceCache(client, type);
2099
2101
  this.setPositionsCache(client, type);
2100
2102
  const message = undefined;
2101
- const orders = await this.watch(url, messageHash, message, type);
2103
+ const newOrder = await this.watch(url, messageHash, message, type);
2102
2104
  if (this.newUpdates) {
2103
- limit = orders.getLimit(symbol, limit);
2105
+ return newOrder;
2104
2106
  }
2105
- return this.filterBySymbolSinceLimit(orders, symbol, since, limit, true);
2107
+ return this.filterBySymbolSinceLimit(this.orders, symbol, since, limit, true);
2108
+ }
2109
+ async watchOrdersForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
2110
+ /**
2111
+ * @method
2112
+ * @name binance#watchOrdersForSymbols
2113
+ * @see https://binance-docs.github.io/apidocs/spot/en/#payload-order-update
2114
+ * @description watches information on multiple orders made by the user
2115
+ * @param {string[]} symbols unified symbol of the market to fetch orders for
2116
+ * @param {int} [since] the earliest time in ms to fetch orders for
2117
+ * @param {int} [limit] the maximum number of trade structures to retrieve
2118
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2119
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2120
+ */
2121
+ let marginMode = undefined;
2122
+ [marginMode, params] = this.handleMarginModeAndParams('authenticate', params);
2123
+ const isIsolatedMargin = (marginMode === 'isolated');
2124
+ if (isIsolatedMargin) {
2125
+ throw new errors.NotSupported(this.id + ' watchOrdersForSymbols does not support isolated margin markets, use watchOrders instead');
2126
+ }
2127
+ await this.loadMarkets();
2128
+ let type = undefined;
2129
+ const market = this.getMarketFromSymbols(symbols);
2130
+ [type, params] = this.handleMarketTypeAndParams('watchOrdersForSymbols', market, params);
2131
+ symbols = this.marketSymbols(symbols, type, true, true, true);
2132
+ let messageHash = 'orders';
2133
+ if (symbols !== undefined) {
2134
+ messageHash = messageHash + '::' + symbols.join(',');
2135
+ }
2136
+ let subType = undefined;
2137
+ [subType, params] = this.handleSubTypeAndParams('watchOrdersForSymbols', market, params);
2138
+ if (this.isLinear(type, subType)) {
2139
+ type = 'future';
2140
+ }
2141
+ else if (this.isInverse(type, subType)) {
2142
+ type = 'delivery';
2143
+ }
2144
+ params = this.extend(params, { 'type': type });
2145
+ await this.authenticate(params);
2146
+ let urlType = type;
2147
+ if (type === 'margin') {
2148
+ urlType = 'spot'; // spot-margin shares the same stream as regular spot
2149
+ }
2150
+ const url = this.urls['api']['ws'][urlType] + '/' + this.options[type]['listenKey'];
2151
+ const client = this.client(url);
2152
+ this.setBalanceCache(client, type);
2153
+ this.setPositionsCache(client, type);
2154
+ const message = undefined;
2155
+ const newOrders = await this.watch(url, messageHash, message, type);
2156
+ if (this.newUpdates) {
2157
+ return newOrders;
2158
+ }
2159
+ return this.filterBySymbolsSinceLimit(this.orders, symbols, since, limit, true);
2106
2160
  }
2107
2161
  parseWsOrder(order, market = undefined) {
2108
2162
  //
@@ -2733,7 +2787,6 @@ class binance extends binance$1 {
2733
2787
  }
2734
2788
  }
2735
2789
  handleOrder(client, message) {
2736
- const messageHash = 'orders';
2737
2790
  const parsed = this.parseWsOrder(message);
2738
2791
  const symbol = this.safeString(parsed, 'symbol');
2739
2792
  const orderId = this.safeString(parsed, 'id');
@@ -2762,9 +2815,8 @@ class binance extends binance$1 {
2762
2815
  }
2763
2816
  }
2764
2817
  cachedOrders.append(parsed);
2765
- client.resolve(this.orders, messageHash);
2766
- const messageHashSymbol = messageHash + ':' + symbol;
2767
- client.resolve(this.orders, messageHashSymbol);
2818
+ this.resolvePromiseIfMessagehashMatches(client, 'orders::', symbol, parsed);
2819
+ client.resolve(parsed, 'orders');
2768
2820
  }
2769
2821
  }
2770
2822
  handleAcountUpdate(client, message) {
@@ -248,8 +248,8 @@ class coinbasepro extends coinbasepro$1 {
248
248
  * @param {object} [params] extra parameters specific to the exchange API endpoint
249
249
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
250
250
  */
251
- symbols = this.marketSymbols(symbols, undefined, false);
252
251
  await this.loadMarkets();
252
+ symbols = this.marketSymbols(symbols, undefined, false);
253
253
  const name = 'user';
254
254
  const messageHash = 'multipleOrders::';
255
255
  const authentication = this.authenticate();
@@ -4,12 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var net = require('net');
6
6
  var tls = require('tls');
7
- var createDebug = require('debug');
8
7
  var events = require('events');
9
8
  var index = require('../agent-base/index.js');
10
9
 
11
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
-
13
10
  function _interopNamespace(e) {
14
11
  if (e && e.__esModule) return e;
15
12
  var n = Object.create(null);
@@ -30,9 +27,7 @@ function _interopNamespace(e) {
30
27
 
31
28
  var net__namespace = /*#__PURE__*/_interopNamespace(net);
32
29
  var tls__namespace = /*#__PURE__*/_interopNamespace(tls);
33
- var createDebug__default = /*#__PURE__*/_interopDefaultLegacy(createDebug);
34
30
 
35
- const debug = createDebug__default["default"]('http-proxy-agent');
36
31
  function isHTTPS(protocol) {
37
32
  return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false;
38
33
  }
@@ -45,7 +40,7 @@ class HttpProxyAgent extends index.Agent {
45
40
  super(opts);
46
41
  this.proxy = typeof proxy === 'string' ? new URL(proxy) : proxy;
47
42
  this.proxyHeaders = opts?.headers ?? {};
48
- debug('Creating new HttpProxyAgent instance: %o', this.proxy.href);
43
+ // debug('Creating new HttpProxyAgent instance: %o', this.proxy.href);
49
44
  // Trim off the brackets from IPv6 addresses
50
45
  const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, '');
51
46
  const port = this.proxy.port
@@ -97,11 +92,11 @@ class HttpProxyAgent extends index.Agent {
97
92
  // Create a socket connection to the proxy server.
98
93
  let socket;
99
94
  if (this.secureProxy) {
100
- debug('Creating `tls.Socket`: %o', this.connectOpts);
95
+ // debug('Creating `tls.Socket`: %o', this.connectOpts);
101
96
  socket = tls__namespace.connect(this.connectOpts);
102
97
  }
103
98
  else {
104
- debug('Creating `net.Socket`: %o', this.connectOpts);
99
+ // debug('Creating `net.Socket`: %o', this.connectOpts);
105
100
  socket = net__namespace.connect(this.connectOpts);
106
101
  }
107
102
  // At this point, the http ClientRequest's internal `_header` field
@@ -109,16 +104,18 @@ class HttpProxyAgent extends index.Agent {
109
104
  // to re-generate the string since we just changed the `req.path`.
110
105
  let first;
111
106
  let endOfHeaders;
112
- debug('Regenerating stored HTTP header string for request');
107
+ // debug('Regenerating stored HTTP header string for request');
113
108
  req._implicitHeader();
114
109
  if (req.outputData && req.outputData.length > 0) {
115
110
  // Node >= 12
116
- debug('Patching connection write() output buffer with updated header');
111
+ // debug(
112
+ // 'Patching connection write() output buffer with updated header'
113
+ // );
117
114
  first = req.outputData[0].data;
118
115
  endOfHeaders = first.indexOf('\r\n\r\n') + 4;
119
116
  req.outputData[0].data =
120
117
  req._header + first.substring(endOfHeaders);
121
- debug('Output buffer: %o', req.outputData[0].data);
118
+ // debug('Output buffer: %o', req.outputData[0].data);
122
119
  }
123
120
  // Wait for the socket's `connect` event, so that this `callback()`
124
121
  // function throws instead of the `http` request machinery. This is