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
package/js/src/okx.js CHANGED
@@ -238,6 +238,13 @@ export default class okx extends Exchange {
238
238
  'finance/savings/lending-rate-history': 5 / 3,
239
239
  // public broker
240
240
  'finance/sfp/dcd/products': 2 / 3,
241
+ // copytrading
242
+ 'copytrading/public-lead-traders': 4,
243
+ 'copytrading/public-weekly-pnl': 4,
244
+ 'copytrading/public-stats': 4,
245
+ 'copytrading/public-preference-currency': 4,
246
+ 'copytrading/public-current-subpositions': 4,
247
+ 'copytrading/public-subpositions-history': 4,
241
248
  },
242
249
  },
243
250
  'private': {
@@ -347,12 +354,16 @@ export default class okx extends Exchange {
347
354
  'finance/staking-defi/eth/balance': 5 / 3,
348
355
  'finance/staking-defi/eth/purchase-redeem-history': 5 / 3,
349
356
  // copytrading
350
- 'copytrading/current-subpositions': 4,
351
- 'copytrading/subpositions-history': 10,
352
- 'copytrading/instruments': 10,
353
- 'copytrading/profit-sharing-details': 10,
354
- 'copytrading/total-profit-sharing': 10,
355
- 'copytrading/unrealized-profit-sharing-details': 10,
357
+ 'copytrading/current-subpositions': 1,
358
+ 'copytrading/subpositions-history': 1,
359
+ 'copytrading/instruments': 4,
360
+ 'copytrading/profit-sharing-details': 4,
361
+ 'copytrading/total-profit-sharing': 4,
362
+ 'copytrading/unrealized-profit-sharing-details': 4,
363
+ 'copytrading/copy-settings': 4,
364
+ 'copytrading/batch-leverage-info': 4,
365
+ 'copytrading/current-lead-traders': 4,
366
+ 'copytrading/lead-traders-history': 4,
356
367
  // broker
357
368
  'broker/nd/info': 10,
358
369
  'broker/nd/subaccount-info': 10,
@@ -457,9 +468,13 @@ export default class okx extends Exchange {
457
468
  'finance/staking-defi/eth/purchase': 5,
458
469
  'finance/staking-defi/eth/redeem': 5,
459
470
  // copytrading
460
- 'copytrading/algo-order': 20,
461
- 'copytrading/close-subposition': 4,
462
- 'copytrading/set-instruments': 10,
471
+ 'copytrading/algo-order': 1,
472
+ 'copytrading/close-subposition': 1,
473
+ 'copytrading/set-instruments': 4,
474
+ 'copytrading/first-copy-settings': 4,
475
+ 'copytrading/amend-copy-settings': 4,
476
+ 'copytrading/stop-copy-trading': 4,
477
+ 'copytrading/batch-set-leverage': 4,
463
478
  // broker
464
479
  'broker/nd/create-subaccount': 0.25,
465
480
  'broker/nd/delete-subaccount': 1,
package/js/src/p2b.js CHANGED
@@ -33,6 +33,8 @@ export default class p2b extends Exchange {
33
33
  'cancelAllOrders': false,
34
34
  'cancelOrder': true,
35
35
  'cancelOrders': false,
36
+ 'closeAllPositions': false,
37
+ 'closePosition': false,
36
38
  'createDepositAddress': false,
37
39
  'createMarketOrder': false,
38
40
  'createOrder': true,
@@ -755,32 +755,34 @@ export default class poloniex extends Exchange {
755
755
  let withdrawAvailable = this.safeValue(result[code], 'withdraw');
756
756
  withdrawAvailable = (withdrawEnabled) ? withdrawEnabled : withdrawAvailable;
757
757
  const networks = this.safeValue(result[code], 'networks', {});
758
- networks[networkCode] = {
759
- 'info': currency,
760
- 'id': networkId,
761
- 'network': networkCode,
762
- 'currencyId': id,
763
- 'numericId': numericId,
764
- 'deposit': depositEnabled,
765
- 'withdraw': withdrawEnabled,
766
- 'active': active,
767
- 'fee': this.parseNumber(feeString),
768
- 'precision': undefined,
769
- 'limits': {
770
- 'amount': {
771
- 'min': undefined,
772
- 'max': undefined,
773
- },
774
- 'withdraw': {
775
- 'min': undefined,
776
- 'max': undefined,
777
- },
778
- 'deposit': {
779
- 'min': undefined,
780
- 'max': undefined,
758
+ if (networkCode !== undefined) {
759
+ networks[networkCode] = {
760
+ 'info': currency,
761
+ 'id': networkId,
762
+ 'network': networkCode,
763
+ 'currencyId': id,
764
+ 'numericId': numericId,
765
+ 'deposit': depositEnabled,
766
+ 'withdraw': withdrawEnabled,
767
+ 'active': active,
768
+ 'fee': this.parseNumber(feeString),
769
+ 'precision': undefined,
770
+ 'limits': {
771
+ 'amount': {
772
+ 'min': undefined,
773
+ 'max': undefined,
774
+ },
775
+ 'withdraw': {
776
+ 'min': undefined,
777
+ 'max': undefined,
778
+ },
779
+ 'deposit': {
780
+ 'min': undefined,
781
+ 'max': undefined,
782
+ },
781
783
  },
782
- },
783
- };
784
+ };
785
+ }
784
786
  result[code]['networks'] = networks;
785
787
  const info = this.safeValue(result[code], 'info', []);
786
788
  const rawInfo = {};
@@ -68,6 +68,7 @@ export default class binance extends binanceRest {
68
68
  fetchOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
69
69
  fetchOpenOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
70
70
  watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
71
+ watchOrdersForSymbols(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<any>;
71
72
  parseWsOrder(order: any, market?: any): import("../base/types.js").Order;
72
73
  handleOrderUpdate(client: Client, message: any): void;
73
74
  watchPositions(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<any>;
@@ -7,7 +7,7 @@
7
7
  // ----------------------------------------------------------------------------
8
8
  import binanceRest from '../binance.js';
9
9
  import { Precise } from '../base/Precise.js';
10
- import { ExchangeError, ArgumentsRequired, BadRequest } from '../base/errors.js';
10
+ import { ExchangeError, ArgumentsRequired, BadRequest, NotSupported } from '../base/errors.js';
11
11
  import { ArrayCache, ArrayCacheByTimestamp, ArrayCacheBySymbolById, ArrayCacheBySymbolBySide } from '../base/ws/Cache.js';
12
12
  import { sha256 } from '../static_dependencies/noble-hashes/sha256.js';
13
13
  import { rsa } from '../base/functions/rsa.js';
@@ -26,6 +26,7 @@ export default class binance extends binanceRest {
26
26
  'watchOrderBook': true,
27
27
  'watchOrderBookForSymbols': true,
28
28
  'watchOrders': true,
29
+ 'watchOrdersForSymbols': true,
29
30
  'watchPositions': true,
30
31
  'watchTicker': true,
31
32
  'watchTickers': true,
@@ -2065,6 +2066,7 @@ export default class binance extends binanceRest {
2065
2066
  /**
2066
2067
  * @method
2067
2068
  * @name binance#watchOrders
2069
+ * @see https://binance-docs.github.io/apidocs/spot/en/#payload-order-update
2068
2070
  * @description watches information on multiple orders made by the user
2069
2071
  * @param {string} symbol unified market symbol of the market orders were made in
2070
2072
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -2078,7 +2080,7 @@ export default class binance extends binanceRest {
2078
2080
  if (symbol !== undefined) {
2079
2081
  market = this.market(symbol);
2080
2082
  symbol = market['symbol'];
2081
- messageHash += ':' + symbol;
2083
+ messageHash += '::' + symbol;
2082
2084
  }
2083
2085
  let type = undefined;
2084
2086
  [type, params] = this.handleMarketTypeAndParams('watchOrders', market, params);
@@ -2101,11 +2103,63 @@ export default class binance extends binanceRest {
2101
2103
  this.setBalanceCache(client, type);
2102
2104
  this.setPositionsCache(client, type);
2103
2105
  const message = undefined;
2104
- const orders = await this.watch(url, messageHash, message, type);
2106
+ const newOrder = await this.watch(url, messageHash, message, type);
2105
2107
  if (this.newUpdates) {
2106
- limit = orders.getLimit(symbol, limit);
2108
+ return newOrder;
2107
2109
  }
2108
- return this.filterBySymbolSinceLimit(orders, symbol, since, limit, true);
2110
+ return this.filterBySymbolSinceLimit(this.orders, symbol, since, limit, true);
2111
+ }
2112
+ async watchOrdersForSymbols(symbols = undefined, since = undefined, limit = undefined, params = {}) {
2113
+ /**
2114
+ * @method
2115
+ * @name binance#watchOrdersForSymbols
2116
+ * @see https://binance-docs.github.io/apidocs/spot/en/#payload-order-update
2117
+ * @description watches information on multiple orders made by the user
2118
+ * @param {string[]} symbols unified symbol of the market to fetch orders for
2119
+ * @param {int} [since] the earliest time in ms to fetch orders for
2120
+ * @param {int} [limit] the maximum number of trade structures to retrieve
2121
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2122
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2123
+ */
2124
+ let marginMode = undefined;
2125
+ [marginMode, params] = this.handleMarginModeAndParams('authenticate', params);
2126
+ const isIsolatedMargin = (marginMode === 'isolated');
2127
+ if (isIsolatedMargin) {
2128
+ throw new NotSupported(this.id + ' watchOrdersForSymbols does not support isolated margin markets, use watchOrders instead');
2129
+ }
2130
+ await this.loadMarkets();
2131
+ let type = undefined;
2132
+ const market = this.getMarketFromSymbols(symbols);
2133
+ [type, params] = this.handleMarketTypeAndParams('watchOrdersForSymbols', market, params);
2134
+ symbols = this.marketSymbols(symbols, type, true, true, true);
2135
+ let messageHash = 'orders';
2136
+ if (symbols !== undefined) {
2137
+ messageHash = messageHash + '::' + symbols.join(',');
2138
+ }
2139
+ let subType = undefined;
2140
+ [subType, params] = this.handleSubTypeAndParams('watchOrdersForSymbols', market, params);
2141
+ if (this.isLinear(type, subType)) {
2142
+ type = 'future';
2143
+ }
2144
+ else if (this.isInverse(type, subType)) {
2145
+ type = 'delivery';
2146
+ }
2147
+ params = this.extend(params, { 'type': type });
2148
+ await this.authenticate(params);
2149
+ let urlType = type;
2150
+ if (type === 'margin') {
2151
+ urlType = 'spot'; // spot-margin shares the same stream as regular spot
2152
+ }
2153
+ const url = this.urls['api']['ws'][urlType] + '/' + this.options[type]['listenKey'];
2154
+ const client = this.client(url);
2155
+ this.setBalanceCache(client, type);
2156
+ this.setPositionsCache(client, type);
2157
+ const message = undefined;
2158
+ const newOrders = await this.watch(url, messageHash, message, type);
2159
+ if (this.newUpdates) {
2160
+ return newOrders;
2161
+ }
2162
+ return this.filterBySymbolsSinceLimit(this.orders, symbols, since, limit, true);
2109
2163
  }
2110
2164
  parseWsOrder(order, market = undefined) {
2111
2165
  //
@@ -2736,7 +2790,6 @@ export default class binance extends binanceRest {
2736
2790
  }
2737
2791
  }
2738
2792
  handleOrder(client, message) {
2739
- const messageHash = 'orders';
2740
2793
  const parsed = this.parseWsOrder(message);
2741
2794
  const symbol = this.safeString(parsed, 'symbol');
2742
2795
  const orderId = this.safeString(parsed, 'id');
@@ -2765,9 +2818,8 @@ export default class binance extends binanceRest {
2765
2818
  }
2766
2819
  }
2767
2820
  cachedOrders.append(parsed);
2768
- client.resolve(this.orders, messageHash);
2769
- const messageHashSymbol = messageHash + ':' + symbol;
2770
- client.resolve(this.orders, messageHashSymbol);
2821
+ this.resolvePromiseIfMessagehashMatches(client, 'orders::', symbol, parsed);
2822
+ client.resolve(parsed, 'orders');
2771
2823
  }
2772
2824
  }
2773
2825
  handleAcountUpdate(client, message) {
@@ -251,8 +251,8 @@ export default class coinbasepro extends coinbaseproRest {
251
251
  * @param {object} [params] extra parameters specific to the exchange API endpoint
252
252
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
253
253
  */
254
- symbols = this.marketSymbols(symbols, undefined, false);
255
254
  await this.loadMarkets();
255
+ symbols = this.marketSymbols(symbols, undefined, false);
256
256
  const name = 'user';
257
257
  const messageHash = 'multipleOrders::';
258
258
  const authentication = this.authenticate();
@@ -6,10 +6,9 @@
6
6
 
7
7
  import * as net from 'net';
8
8
  import * as tls from 'tls';
9
- import createDebug from 'debug';
9
+ // import createDebug from 'debug';
10
10
  import { once } from 'events';
11
11
  import { Agent } from './../agent-base/index.js';
12
- const debug = createDebug('http-proxy-agent');
13
12
  function isHTTPS(protocol) {
14
13
  return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false;
15
14
  }
@@ -22,7 +21,7 @@ export class HttpProxyAgent extends Agent {
22
21
  super(opts);
23
22
  this.proxy = typeof proxy === 'string' ? new URL(proxy) : proxy;
24
23
  this.proxyHeaders = opts?.headers ?? {};
25
- debug('Creating new HttpProxyAgent instance: %o', this.proxy.href);
24
+ // debug('Creating new HttpProxyAgent instance: %o', this.proxy.href);
26
25
  // Trim off the brackets from IPv6 addresses
27
26
  const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, '');
28
27
  const port = this.proxy.port
@@ -74,11 +73,11 @@ export class HttpProxyAgent extends Agent {
74
73
  // Create a socket connection to the proxy server.
75
74
  let socket;
76
75
  if (this.secureProxy) {
77
- debug('Creating `tls.Socket`: %o', this.connectOpts);
76
+ // debug('Creating `tls.Socket`: %o', this.connectOpts);
78
77
  socket = tls.connect(this.connectOpts);
79
78
  }
80
79
  else {
81
- debug('Creating `net.Socket`: %o', this.connectOpts);
80
+ // debug('Creating `net.Socket`: %o', this.connectOpts);
82
81
  socket = net.connect(this.connectOpts);
83
82
  }
84
83
  // At this point, the http ClientRequest's internal `_header` field
@@ -86,16 +85,18 @@ export class HttpProxyAgent extends Agent {
86
85
  // to re-generate the string since we just changed the `req.path`.
87
86
  let first;
88
87
  let endOfHeaders;
89
- debug('Regenerating stored HTTP header string for request');
88
+ // debug('Regenerating stored HTTP header string for request');
90
89
  req._implicitHeader();
91
90
  if (req.outputData && req.outputData.length > 0) {
92
91
  // Node >= 12
93
- debug('Patching connection write() output buffer with updated header');
92
+ // debug(
93
+ // 'Patching connection write() output buffer with updated header'
94
+ // );
94
95
  first = req.outputData[0].data;
95
96
  endOfHeaders = first.indexOf('\r\n\r\n') + 4;
96
97
  req.outputData[0].data =
97
98
  req._header + first.substring(endOfHeaders);
98
- debug('Output buffer: %o', req.outputData[0].data);
99
+ // debug('Output buffer: %o', req.outputData[0].data);
99
100
  }
100
101
  // Wait for the socket's `connect` event, so that this `callback()`
101
102
  // function throws instead of the `http` request machinery. This is
@@ -7,10 +7,8 @@
7
7
  import * as net from 'net';
8
8
  import * as tls from 'tls';
9
9
  import assert from 'assert';
10
- import createDebug from 'debug';
11
10
  import { Agent } from './../agent-base/index.js';
12
11
  import { parseProxyResponse } from './parse-proxy-response.js';
13
- const debug = createDebug('https-proxy-agent');
14
12
  /**
15
13
  * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
16
14
  * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
@@ -29,7 +27,7 @@ export class HttpsProxyAgent extends Agent {
29
27
  this.options = { path: undefined };
30
28
  this.proxy = typeof proxy === 'string' ? new URL(proxy) : proxy;
31
29
  this.proxyHeaders = opts?.headers ?? {};
32
- debug('Creating new HttpsProxyAgent instance: %o', this.proxy.href);
30
+ // debug('Creating new HttpsProxyAgent instance: %o', this.proxy.href);
33
31
  // Trim off the brackets from IPv6 addresses
34
32
  const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, '');
35
33
  const port = this.proxy.port
@@ -60,11 +58,11 @@ export class HttpsProxyAgent extends Agent {
60
58
  // Create a socket connection to the proxy server.
61
59
  let socket;
62
60
  if (secureProxy) {
63
- debug('Creating `tls.Socket`: %o', this.connectOpts);
61
+ // debug('Creating `tls.Socket`: %o', this.connectOpts);
64
62
  socket = tls.connect(this.connectOpts);
65
63
  }
66
64
  else {
67
- debug('Creating `net.Socket`: %o', this.connectOpts);
65
+ // debug('Creating `net.Socket`: %o', this.connectOpts);
68
66
  socket = net.connect(this.connectOpts);
69
67
  }
70
68
  const headers = typeof this.proxyHeaders === 'function'
@@ -97,7 +95,7 @@ export class HttpsProxyAgent extends Agent {
97
95
  if (opts.secureEndpoint) {
98
96
  // The proxy is connecting to a TLS server, so upgrade
99
97
  // this socket connection to a TLS connection.
100
- debug('Upgrading socket connection to TLS');
98
+ // debug('Upgrading socket connection to TLS');
101
99
  const servername = opts.servername || opts.host;
102
100
  return tls.connect({
103
101
  ...omit(opts, 'host', 'path', 'port'),
@@ -122,7 +120,7 @@ export class HttpsProxyAgent extends Agent {
122
120
  fakeSocket.readable = true;
123
121
  // Need to wait for the "socket" event to re-play the "data" events.
124
122
  req.once('socket', (s) => {
125
- debug('Replaying proxy buffer for failed request');
123
+ // debug('Replaying proxy buffer for failed request');
126
124
  assert(s.listenerCount('data') > 0);
127
125
  // Replay the "buffered" Buffer onto the fake `socket`, since at
128
126
  // this point the HTTP module machinery has been hooked up for
@@ -4,8 +4,6 @@
4
4
  // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
5
  // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
6
 
7
- import createDebug from 'debug';
8
- const debug = createDebug('https-proxy-agent:parse-proxy-response');
9
7
  export function parseProxyResponse(socket) {
10
8
  return new Promise((resolve, reject) => {
11
9
  // we need to buffer any HTTP traffic that happens with the proxy before we get
@@ -28,14 +26,14 @@ export function parseProxyResponse(socket) {
28
26
  socket.removeListener('readable', read);
29
27
  }
30
28
  function onclose(err) {
31
- debug('onclose had error %o', err);
29
+ // debug('onclose had error %o', err);
32
30
  }
33
31
  function onend() {
34
- debug('onend');
32
+ // debug('onend');
35
33
  }
36
34
  function onerror(err) {
37
35
  cleanup();
38
- debug('onerror %o', err);
36
+ // debug('onerror %o', err);
39
37
  reject(err);
40
38
  }
41
39
  function ondata(b) {
@@ -45,7 +43,7 @@ export function parseProxyResponse(socket) {
45
43
  const endOfHeaders = buffered.indexOf('\r\n\r\n');
46
44
  if (endOfHeaders === -1) {
47
45
  // keep buffering
48
- debug('have not received end of HTTP headers yet...');
46
+ // debug('have not received end of HTTP headers yet...');
49
47
  read();
50
48
  return;
51
49
  }
@@ -78,7 +76,7 @@ export function parseProxyResponse(socket) {
78
76
  headers[key] = value;
79
77
  }
80
78
  }
81
- debug('got proxy server response: %o', firstLine);
79
+ // debug('got proxy server response: %o', firstLine);
82
80
  cleanup();
83
81
  resolve({
84
82
  connect: {
@@ -32,6 +32,8 @@ export default class wavesexchange extends Exchange {
32
32
  'option': false,
33
33
  'addMargin': false,
34
34
  'cancelOrder': true,
35
+ 'closeAllPositions': false,
36
+ 'closePosition': false,
35
37
  'createMarketOrder': true,
36
38
  'createOrder': true,
37
39
  'createReduceOnlyOrder': false,
package/js/src/wazirx.js CHANGED
@@ -33,6 +33,8 @@ export default class wazirx extends Exchange {
33
33
  'borrowMargin': false,
34
34
  'cancelAllOrders': true,
35
35
  'cancelOrder': true,
36
+ 'closeAllPositions': false,
37
+ 'closePosition': false,
36
38
  'createOrder': true,
37
39
  'createReduceOnlyOrder': false,
38
40
  'createStopLimitOrder': true,
package/js/src/woo.js CHANGED
@@ -38,6 +38,8 @@ export default class woo extends Exchange {
38
38
  'cancelAllOrders': true,
39
39
  'cancelOrder': true,
40
40
  'cancelWithdraw': false,
41
+ 'closeAllPositions': false,
42
+ 'closePosition': false,
41
43
  'createDepositAddress': false,
42
44
  'createMarketOrder': false,
43
45
  'createOrder': true,
package/js/src/yobit.js CHANGED
@@ -33,6 +33,8 @@ export default class yobit extends Exchange {
33
33
  'option': false,
34
34
  'addMargin': false,
35
35
  'cancelOrder': true,
36
+ 'closeAllPositions': false,
37
+ 'closePosition': false,
36
38
  'createDepositAddress': true,
37
39
  'createMarketOrder': false,
38
40
  'createOrder': true,
package/js/src/zonda.js CHANGED
@@ -33,6 +33,8 @@ export default class zonda extends Exchange {
33
33
  'cancelAllOrders': false,
34
34
  'cancelOrder': true,
35
35
  'cancelOrders': false,
36
+ 'closeAllPositions': false,
37
+ 'closePosition': false,
36
38
  'createDepositAddress': false,
37
39
  'createOrder': true,
38
40
  'createReduceOnlyOrder': false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.1.74",
3
+ "version": "4.1.76",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 130+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",