ccxt 4.1.75 → 4.1.77

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 (131) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +287 -235
  3. package/dist/ccxt.browser.min.js +5 -5
  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 +8 -0
  8. package/dist/cjs/src/base/errors.js +7 -7
  9. package/dist/cjs/src/base/ws/Client.js +2 -0
  10. package/dist/cjs/src/binance.js +4 -0
  11. package/dist/cjs/src/binanceus.js +2 -0
  12. package/dist/cjs/src/bingx.js +80 -23
  13. package/dist/cjs/src/bit2c.js +2 -0
  14. package/dist/cjs/src/bitbank.js +2 -0
  15. package/dist/cjs/src/bithumb.js +2 -0
  16. package/dist/cjs/src/bitmex.js +6 -0
  17. package/dist/cjs/src/bitopro.js +2 -0
  18. package/dist/cjs/src/bitpanda.js +2 -0
  19. package/dist/cjs/src/bitrue.js +27 -1
  20. package/dist/cjs/src/bitso.js +2 -0
  21. package/dist/cjs/src/bitstamp.js +5 -2
  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 +37 -6
  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 +2 -0
  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/kucoin.js +2 -0
  44. package/dist/cjs/src/kuna.js +2 -0
  45. package/dist/cjs/src/latoken.js +2 -0
  46. package/dist/cjs/src/luno.js +2 -0
  47. package/dist/cjs/src/mercado.js +2 -0
  48. package/dist/cjs/src/mexc.js +2 -0
  49. package/dist/cjs/src/ndax.js +2 -0
  50. package/dist/cjs/src/novadax.js +2 -0
  51. package/dist/cjs/src/okx.js +25 -10
  52. package/dist/cjs/src/p2b.js +2 -0
  53. package/dist/cjs/src/static_dependencies/proxies/http-proxy-agent/index.js +8 -11
  54. package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/index.js +5 -8
  55. package/dist/cjs/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +5 -12
  56. package/dist/cjs/src/wavesexchange.js +2 -0
  57. package/dist/cjs/src/wazirx.js +2 -0
  58. package/dist/cjs/src/woo.js +2 -0
  59. package/dist/cjs/src/yobit.js +2 -0
  60. package/dist/cjs/src/zonda.js +2 -0
  61. package/js/ccxt.d.ts +1 -1
  62. package/js/ccxt.js +1 -1
  63. package/js/src/abstract/binance.d.ts +2 -0
  64. package/js/src/abstract/binancecoinm.d.ts +2 -0
  65. package/js/src/abstract/binanceus.d.ts +2 -0
  66. package/js/src/abstract/binanceusdm.d.ts +2 -0
  67. package/js/src/abstract/okx.d.ts +14 -0
  68. package/js/src/ace.js +2 -0
  69. package/js/src/alpaca.js +2 -0
  70. package/js/src/base/Exchange.d.ts +4 -0
  71. package/js/src/base/Exchange.js +8 -0
  72. package/js/src/base/errors.d.ts +4 -4
  73. package/js/src/base/errors.js +7 -7
  74. package/js/src/base/ws/Client.js +2 -0
  75. package/js/src/binance.js +4 -0
  76. package/js/src/binanceus.js +2 -0
  77. package/js/src/bingx.d.ts +4 -3
  78. package/js/src/bingx.js +80 -23
  79. package/js/src/bit2c.js +2 -0
  80. package/js/src/bitbank.js +2 -0
  81. package/js/src/bithumb.js +2 -0
  82. package/js/src/bitmex.d.ts +1 -1
  83. package/js/src/bitmex.js +6 -0
  84. package/js/src/bitopro.js +2 -0
  85. package/js/src/bitpanda.js +2 -0
  86. package/js/src/bitrue.d.ts +1 -0
  87. package/js/src/bitrue.js +27 -1
  88. package/js/src/bitso.js +2 -0
  89. package/js/src/bitstamp.js +5 -2
  90. package/js/src/bittrex.js +2 -0
  91. package/js/src/bitvavo.js +2 -0
  92. package/js/src/bl3p.js +2 -0
  93. package/js/src/btcalpha.js +2 -0
  94. package/js/src/btcbox.js +2 -0
  95. package/js/src/btcmarkets.js +2 -0
  96. package/js/src/btcturk.js +2 -0
  97. package/js/src/bybit.js +2 -0
  98. package/js/src/coinbase.d.ts +1 -0
  99. package/js/src/coinbase.js +37 -6
  100. package/js/src/coincheck.js +2 -0
  101. package/js/src/coinlist.js +2 -0
  102. package/js/src/coinmate.js +2 -0
  103. package/js/src/coinone.js +2 -0
  104. package/js/src/coinsph.js +2 -0
  105. package/js/src/coinspot.js +2 -0
  106. package/js/src/cryptocom.d.ts +0 -24
  107. package/js/src/cryptocom.js +2 -185
  108. package/js/src/gate.js +1 -0
  109. package/js/src/gemini.js +2 -0
  110. package/js/src/idex.js +2 -0
  111. package/js/src/independentreserve.js +2 -0
  112. package/js/src/indodax.js +2 -0
  113. package/js/src/kucoin.js +2 -0
  114. package/js/src/kuna.js +2 -0
  115. package/js/src/latoken.js +2 -0
  116. package/js/src/luno.js +2 -0
  117. package/js/src/mercado.js +2 -0
  118. package/js/src/mexc.js +2 -0
  119. package/js/src/ndax.js +2 -0
  120. package/js/src/novadax.js +2 -0
  121. package/js/src/okx.js +25 -10
  122. package/js/src/p2b.js +2 -0
  123. package/js/src/static_dependencies/proxies/http-proxy-agent/index.js +9 -8
  124. package/js/src/static_dependencies/proxies/https-proxy-agent/index.js +5 -7
  125. package/js/src/static_dependencies/proxies/https-proxy-agent/parse-proxy-response.js +5 -7
  126. package/js/src/wavesexchange.js +2 -0
  127. package/js/src/wazirx.js +2 -0
  128. package/js/src/woo.js +2 -0
  129. package/js/src/yobit.js +2 -0
  130. package/js/src/zonda.js +2 -0
  131. package/package.json +1 -1
package/js/src/bitrue.js CHANGED
@@ -35,6 +35,9 @@ export default class bitrue extends Exchange {
35
35
  'option': false,
36
36
  'cancelAllOrders': true,
37
37
  'cancelOrder': true,
38
+ 'createMarketBuyOrderWithCost': true,
39
+ 'createMarketOrderWithCost': false,
40
+ 'createMarketSellOrderWithCost': false,
38
41
  'createOrder': true,
39
42
  'createStopLimitOrder': true,
40
43
  'createStopMarketOrder': true,
@@ -1889,6 +1892,26 @@ export default class bitrue extends Exchange {
1889
1892
  'trades': fills,
1890
1893
  }, market);
1891
1894
  }
1895
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
1896
+ /**
1897
+ * @method
1898
+ * @name bitrue#createMarketBuyOrderWithCost
1899
+ * @description create a market buy order by providing the symbol and cost
1900
+ * @see https://www.bitrue.com/api-docs#new-order-trade-hmac-sha256
1901
+ * @see https://www.bitrue.com/api_docs_includes_file/delivery.html#new-order-trade-hmac-sha256
1902
+ * @param {string} symbol unified symbol of the market to create an order in
1903
+ * @param {float} cost how much you want to trade in units of the quote currency
1904
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1905
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1906
+ */
1907
+ await this.loadMarkets();
1908
+ const market = this.market(symbol);
1909
+ if (!market['swap']) {
1910
+ throw new NotSupported(this.id + ' createMarketBuyOrderWithCost() supports swap orders only');
1911
+ }
1912
+ params['createMarketBuyOrderRequiresPrice'] = false;
1913
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
1914
+ }
1892
1915
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
1893
1916
  /**
1894
1917
  * @method
@@ -1912,6 +1935,7 @@ export default class bitrue extends Exchange {
1912
1935
  * EXCHANGE SPECIFIC PARAMETERS
1913
1936
  * @param {decimal} [params.icebergQty]
1914
1937
  * @param {long} [params.recvWindow]
1938
+ * @param {float} [params.cost] *swap market buy only* the quote quantity that can be used as an alternative for the amount
1915
1939
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1916
1940
  */
1917
1941
  await this.loadMarkets();
@@ -1948,7 +1972,9 @@ export default class bitrue extends Exchange {
1948
1972
  request['type'] = 'IOC';
1949
1973
  }
1950
1974
  request['contractName'] = market['id'];
1951
- if (isMarket && (side === 'buy') && (this.options['createMarketBuyOrderRequiresPrice'])) {
1975
+ let createMarketBuyOrderRequiresPrice = true;
1976
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
1977
+ if (isMarket && (side === 'buy') && createMarketBuyOrderRequiresPrice) {
1952
1978
  const cost = this.safeString(params, 'cost');
1953
1979
  params = this.omit(params, 'cost');
1954
1980
  if (price === undefined && cost === undefined) {
package/js/src/bitso.js CHANGED
@@ -34,6 +34,8 @@ export default class bitso extends Exchange {
34
34
  'cancelAllOrders': true,
35
35
  'cancelOrder': true,
36
36
  'cancelOrders': true,
37
+ 'closeAllPositions': false,
38
+ 'closePosition': false,
37
39
  'createDepositAddress': false,
38
40
  'createOrder': true,
39
41
  'createReduceOnlyOrder': false,
@@ -36,6 +36,8 @@ export default class bitstamp extends Exchange {
36
36
  'addMargin': false,
37
37
  'cancelAllOrders': true,
38
38
  'cancelOrder': true,
39
+ 'closeAllPositions': false,
40
+ 'closePosition': false,
39
41
  'createOrder': true,
40
42
  'createReduceOnlyOrder': false,
41
43
  'createStopLimitOrder': false,
@@ -1040,6 +1042,7 @@ export default class bitstamp extends Exchange {
1040
1042
  * @method
1041
1043
  * @name bitstamp#fetchOHLCV
1042
1044
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1045
+ * @see https://www.bitstamp.net/api/#tag/Market-info/operation/GetOHLCData
1043
1046
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
1044
1047
  * @param {string} timeframe the length of time each candle represents
1045
1048
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -1062,7 +1065,7 @@ export default class bitstamp extends Exchange {
1062
1065
  limit = 1000;
1063
1066
  const start = this.parseToInt(since / 1000);
1064
1067
  request['start'] = start;
1065
- request['end'] = this.sum(start, limit * duration);
1068
+ request['end'] = this.sum(start, duration * (limit - 1));
1066
1069
  request['limit'] = limit;
1067
1070
  }
1068
1071
  }
@@ -1070,7 +1073,7 @@ export default class bitstamp extends Exchange {
1070
1073
  if (since !== undefined) {
1071
1074
  const start = this.parseToInt(since / 1000);
1072
1075
  request['start'] = start;
1073
- request['end'] = this.sum(start, limit * duration);
1076
+ request['end'] = this.sum(start, duration * (limit - 1));
1074
1077
  }
1075
1078
  request['limit'] = Math.min(limit, 1000); // min 1, max 1000
1076
1079
  }
package/js/src/bittrex.js CHANGED
@@ -35,6 +35,8 @@ export default class bittrex extends Exchange {
35
35
  'addMargin': false,
36
36
  'cancelAllOrders': true,
37
37
  'cancelOrder': true,
38
+ 'closeAllPositions': false,
39
+ 'closePosition': false,
38
40
  'createDepositAddress': true,
39
41
  'createMarketOrder': true,
40
42
  'createOrder': true,
package/js/src/bitvavo.js CHANGED
@@ -35,6 +35,8 @@ export default class bitvavo extends Exchange {
35
35
  'addMargin': false,
36
36
  'cancelAllOrders': true,
37
37
  'cancelOrder': true,
38
+ 'closeAllPositions': false,
39
+ 'closePosition': false,
38
40
  'createOrder': true,
39
41
  'createReduceOnlyOrder': false,
40
42
  'createStopLimitOrder': true,
package/js/src/bl3p.js CHANGED
@@ -33,6 +33,8 @@ export default class bl3p extends Exchange {
33
33
  'option': false,
34
34
  'addMargin': false,
35
35
  'cancelOrder': true,
36
+ 'closeAllPositions': false,
37
+ 'closePosition': false,
36
38
  'createOrder': true,
37
39
  'createReduceOnlyOrder': false,
38
40
  'createStopLimitOrder': false,
@@ -31,6 +31,8 @@ export default class btcalpha extends Exchange {
31
31
  'option': false,
32
32
  'addMargin': false,
33
33
  'cancelOrder': true,
34
+ 'closeAllPositions': false,
35
+ 'closePosition': false,
34
36
  'createOrder': true,
35
37
  'createReduceOnlyOrder': false,
36
38
  'createStopLimitOrder': false,
package/js/src/btcbox.js CHANGED
@@ -33,6 +33,8 @@ export default class btcbox extends Exchange {
33
33
  'option': false,
34
34
  'addMargin': false,
35
35
  'cancelOrder': true,
36
+ 'closeAllPositions': false,
37
+ 'closePosition': false,
36
38
  'createOrder': true,
37
39
  'createReduceOnlyOrder': false,
38
40
  'fetchBalance': true,
@@ -33,6 +33,8 @@ export default class btcmarkets extends Exchange {
33
33
  'addMargin': false,
34
34
  'cancelOrder': true,
35
35
  'cancelOrders': true,
36
+ 'closeAllPositions': false,
37
+ 'closePosition': false,
36
38
  'createOrder': true,
37
39
  'createReduceOnlyOrder': false,
38
40
  'fetchBalance': true,
package/js/src/btcturk.js CHANGED
@@ -32,6 +32,8 @@ export default class btcturk extends Exchange {
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
  'fetchBalance': true,
package/js/src/bybit.js CHANGED
@@ -38,6 +38,8 @@ export default class bybit extends Exchange {
38
38
  'borrowCrossMargin': true,
39
39
  'cancelAllOrders': true,
40
40
  'cancelOrder': true,
41
+ 'closeAllPositions': false,
42
+ 'closePosition': false,
41
43
  'createMarketBuyOrderWithCost': true,
42
44
  'createMarketSellOrderWithCost': false,
43
45
  'createOrder': true,
@@ -93,6 +93,7 @@ export default class coinbase extends Exchange {
93
93
  prepareAccountRequestWithCurrencyCode(code?: Str, limit?: Int, params?: {}): Promise<{
94
94
  account_id: string;
95
95
  }>;
96
+ createMarketBuyOrderWithCost(symbol: string, cost: any, params?: {}): Promise<Order>;
96
97
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
97
98
  parseOrder(order: any, market?: Market): Order;
98
99
  parseOrderStatus(status: any): string;
@@ -38,11 +38,16 @@ export default class coinbase extends Exchange {
38
38
  'addMargin': false,
39
39
  'cancelOrder': true,
40
40
  'cancelOrders': true,
41
+ 'closeAllPositions': false,
42
+ 'closePosition': false,
41
43
  'createDepositAddress': true,
42
44
  'createLimitBuyOrder': true,
43
45
  'createLimitSellOrder': true,
44
46
  'createMarketBuyOrder': true,
47
+ 'createMarketBuyOrderWithCost': true,
48
+ 'createMarketOrderWithCost': false,
45
49
  'createMarketSellOrder': true,
50
+ 'createMarketSellOrderWithCost': false,
46
51
  'createOrder': true,
47
52
  'createPostOnlyOrder': true,
48
53
  'createReduceOnlyOrder': false,
@@ -2081,6 +2086,25 @@ export default class coinbase extends Exchange {
2081
2086
  }
2082
2087
  return request;
2083
2088
  }
2089
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
2090
+ /**
2091
+ * @method
2092
+ * @name coinbase#createMarketBuyOrderWithCost
2093
+ * @description create a market buy order by providing the symbol and cost
2094
+ * @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_postorder
2095
+ * @param {string} symbol unified symbol of the market to create an order in
2096
+ * @param {float} cost how much you want to trade in units of the quote currency
2097
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
2098
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2099
+ */
2100
+ await this.loadMarkets();
2101
+ const market = this.market(symbol);
2102
+ if (!market['spot']) {
2103
+ throw new NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
2104
+ }
2105
+ params['createMarketBuyOrderRequiresPrice'] = false;
2106
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
2107
+ }
2084
2108
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
2085
2109
  /**
2086
2110
  * @method
@@ -2101,6 +2125,7 @@ export default class coinbase extends Exchange {
2101
2125
  * @param {string} [params.timeInForce] 'GTC', 'IOC', 'GTD' or 'PO'
2102
2126
  * @param {string} [params.stop_direction] 'UNKNOWN_STOP_DIRECTION', 'STOP_DIRECTION_STOP_UP', 'STOP_DIRECTION_STOP_DOWN' the direction the stopPrice is triggered from
2103
2127
  * @param {string} [params.end_time] '2023-05-25T17:01:05.092Z' for 'GTD' orders
2128
+ * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
2104
2129
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
2105
2130
  */
2106
2131
  await this.loadMarkets();
@@ -2203,21 +2228,27 @@ export default class coinbase extends Exchange {
2203
2228
  throw new NotSupported(this.id + ' createOrder() only stop limit orders are supported');
2204
2229
  }
2205
2230
  if (side === 'buy') {
2206
- const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
2207
2231
  let total = undefined;
2208
- if (createMarketBuyOrderRequiresPrice) {
2232
+ let createMarketBuyOrderRequiresPrice = true;
2233
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
2234
+ const cost = this.safeNumber(params, 'cost');
2235
+ params = this.omit(params, 'cost');
2236
+ if (cost !== undefined) {
2237
+ total = this.costToPrecision(symbol, cost);
2238
+ }
2239
+ else if (createMarketBuyOrderRequiresPrice) {
2209
2240
  if (price === undefined) {
2210
- throw new InvalidOrder(this.id + ' createOrder() requires a price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option to false and pass in the cost to spend into the amount parameter');
2241
+ throw new InvalidOrder(this.id + ' createOrder() requires a price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
2211
2242
  }
2212
2243
  else {
2213
2244
  const amountString = this.numberToString(amount);
2214
2245
  const priceString = this.numberToString(price);
2215
- const cost = this.parseNumber(Precise.stringMul(amountString, priceString));
2216
- total = this.priceToPrecision(symbol, cost);
2246
+ const costRequest = Precise.stringMul(amountString, priceString);
2247
+ total = this.costToPrecision(symbol, costRequest);
2217
2248
  }
2218
2249
  }
2219
2250
  else {
2220
- total = this.priceToPrecision(symbol, amount);
2251
+ total = this.costToPrecision(symbol, amount);
2221
2252
  }
2222
2253
  request['order_configuration'] = {
2223
2254
  'market_market_ioc': {
@@ -30,6 +30,8 @@ export default class coincheck extends Exchange {
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
  'fetchBalance': true,
@@ -35,6 +35,8 @@ export default class coinlist extends Exchange {
35
35
  'cancelAllOrders': true,
36
36
  'cancelOrder': true,
37
37
  'cancelOrders': true,
38
+ 'closeAllPositions': false,
39
+ 'closePosition': false,
38
40
  'createDepositAddress': false,
39
41
  'createOrder': true,
40
42
  'createPostOnlyOrder': true,
@@ -31,6 +31,8 @@ export default class coinmate extends Exchange {
31
31
  'option': false,
32
32
  'addMargin': false,
33
33
  'cancelOrder': true,
34
+ 'closeAllPositions': false,
35
+ 'closePosition': false,
34
36
  'createOrder': true,
35
37
  'createReduceOnlyOrder': false,
36
38
  'fetchBalance': true,
package/js/src/coinone.js CHANGED
@@ -34,6 +34,8 @@ export default class coinone extends Exchange {
34
34
  'option': false,
35
35
  'addMargin': false,
36
36
  'cancelOrder': true,
37
+ 'closeAllPositions': false,
38
+ 'closePosition': false,
37
39
  'createMarketOrder': false,
38
40
  'createOrder': true,
39
41
  'createReduceOnlyOrder': false,
package/js/src/coinsph.js CHANGED
@@ -35,6 +35,8 @@ export default class coinsph extends Exchange {
35
35
  'cancelAllOrders': true,
36
36
  'cancelOrder': true,
37
37
  'cancelOrders': false,
38
+ 'closeAllPositions': false,
39
+ 'closePosition': false,
38
40
  'createDepositAddress': false,
39
41
  'createOrder': true,
40
42
  'createPostOnlyOrder': false,
@@ -32,6 +32,8 @@ export default class coinspot extends Exchange {
32
32
  'option': false,
33
33
  'addMargin': false,
34
34
  'cancelOrder': true,
35
+ 'closeAllPositions': false,
36
+ 'closePosition': false,
35
37
  'createMarketOrder': false,
36
38
  'createOrder': true,
37
39
  'createReduceOnlyOrder': false,
@@ -32,30 +32,6 @@ export default class cryptocom extends Exchange {
32
32
  safeNetwork(networkId: any): string;
33
33
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
34
34
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
35
- transfer(code: string, amount: any, fromAccount: any, toAccount: any, params?: {}): Promise<{
36
- info: any;
37
- id: string;
38
- timestamp: any;
39
- datetime: string;
40
- currency: any;
41
- amount: any;
42
- fromAccount: any;
43
- toAccount: any;
44
- status: any;
45
- }>;
46
- fetchTransfers(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
47
- parseTransferStatus(status: any): string;
48
- parseTransfer(transfer: any, currency?: Currency): {
49
- info: any;
50
- id: string;
51
- timestamp: any;
52
- datetime: string;
53
- currency: any;
54
- amount: any;
55
- fromAccount: any;
56
- toAccount: any;
57
- status: any;
58
- };
59
35
  parseTicker(ticker: any, market?: Market): Ticker;
60
36
  parseTrade(trade: any, market?: Market): Trade;
61
37
  parseOHLCV(ohlcv: any, market?: Market): OHLCV;
@@ -90,7 +90,7 @@ export default class cryptocom extends Exchange {
90
90
  'fetchTradingFees': false,
91
91
  'fetchTransactionFees': false,
92
92
  'fetchTransactions': false,
93
- 'fetchTransfers': true,
93
+ 'fetchTransfers': false,
94
94
  'fetchUnderlyingAssets': false,
95
95
  'fetchVolatilityHistory': false,
96
96
  'fetchWithdrawals': true,
@@ -99,7 +99,7 @@ export default class cryptocom extends Exchange {
99
99
  'setLeverage': false,
100
100
  'setMarginMode': false,
101
101
  'setPositionMode': false,
102
- 'transfer': true,
102
+ 'transfer': false,
103
103
  'withdraw': true,
104
104
  },
105
105
  'timeframes': {
@@ -1856,189 +1856,6 @@ export default class cryptocom extends Exchange {
1856
1856
  const withdrawalList = this.safeValue(data, 'withdrawal_list', []);
1857
1857
  return this.parseTransactions(withdrawalList, currency, since, limit);
1858
1858
  }
1859
- async transfer(code, amount, fromAccount, toAccount, params = {}) {
1860
- /**
1861
- * @method
1862
- * @name cryptocom#transfer
1863
- * @description transfer currency internally between wallets on the same account
1864
- * @param {string} code unified currency code
1865
- * @param {float} amount amount to transfer
1866
- * @param {string} fromAccount account to transfer from
1867
- * @param {string} toAccount account to transfer to
1868
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1869
- * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
1870
- */
1871
- await this.loadMarkets();
1872
- const currency = this.currency(code);
1873
- fromAccount = fromAccount.toLowerCase();
1874
- toAccount = toAccount.toLowerCase();
1875
- const accountsById = this.safeValue(this.options, 'accountsById', {});
1876
- const fromId = this.safeString(accountsById, fromAccount, fromAccount);
1877
- const toId = this.safeString(accountsById, toAccount, toAccount);
1878
- const request = {
1879
- 'currency': currency['id'],
1880
- 'amount': parseFloat(amount),
1881
- 'from': fromId,
1882
- 'to': toId,
1883
- };
1884
- let method = 'v2PrivatePostPrivateDerivTransfer';
1885
- if ((fromAccount === 'margin') || (toAccount === 'margin')) {
1886
- method = 'v2PrivatePostPrivateMarginTransfer';
1887
- }
1888
- const response = await this[method](this.extend(request, params));
1889
- //
1890
- // {
1891
- // "id": 11,
1892
- // "method": "private/deriv/transfer",
1893
- // "code": 0
1894
- // }
1895
- //
1896
- return this.parseTransfer(response, currency);
1897
- }
1898
- async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
1899
- /**
1900
- * @method
1901
- * @name cryptocom#fetchTransfers
1902
- * @description fetch a history of internal transfers made on an account
1903
- * @param {string} code unified currency code of the currency transferred
1904
- * @param {int} [since] the earliest time in ms to fetch transfers for
1905
- * @param {int} [limit] the maximum number of transfers structures to retrieve
1906
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1907
- * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
1908
- */
1909
- if (!('direction' in params)) {
1910
- throw new ArgumentsRequired(this.id + ' fetchTransfers() requires a direction param to be either "IN" or "OUT"');
1911
- }
1912
- await this.loadMarkets();
1913
- let currency = undefined;
1914
- const request = {
1915
- 'direction': 'OUT',
1916
- };
1917
- if (code !== undefined) {
1918
- currency = this.currency(code);
1919
- request['currency'] = currency['id'];
1920
- }
1921
- if (since !== undefined) {
1922
- request['start_ts'] = since;
1923
- }
1924
- if (limit !== undefined) {
1925
- request['page_size'] = limit;
1926
- }
1927
- let method = 'v2PrivatePostPrivateDerivGetTransferHistory';
1928
- const [marginMode, query] = this.customHandleMarginModeAndParams('fetchTransfers', params);
1929
- if (marginMode !== undefined) {
1930
- method = 'v2PrivatePostPrivateMarginGetTransferHistory';
1931
- }
1932
- const response = await this[method](this.extend(request, query));
1933
- //
1934
- // {
1935
- // "id": "1641032709328",
1936
- // "method": "private/deriv/get-transfer-history",
1937
- // "code": "0",
1938
- // "result": {
1939
- // "transfer_list": [
1940
- // {
1941
- // "direction": "IN",
1942
- // "time": "1641025185223",
1943
- // "amount": "109.56",
1944
- // "status": "COMPLETED",
1945
- // "information": "From Spot Wallet",
1946
- // "currency": "USDC"
1947
- // }
1948
- // ]
1949
- // }
1950
- // }
1951
- //
1952
- const transfer = [];
1953
- transfer.push({
1954
- 'response': response,
1955
- });
1956
- return this.parseTransfers(transfer, currency, since, limit, params);
1957
- }
1958
- parseTransferStatus(status) {
1959
- const statuses = {
1960
- 'COMPLETED': 'ok',
1961
- 'PROCESSING': 'pending',
1962
- };
1963
- return this.safeString(statuses, status, status);
1964
- }
1965
- parseTransfer(transfer, currency = undefined) {
1966
- //
1967
- // {
1968
- // "response": {
1969
- // "id": "1641032709328",
1970
- // "method": "private/deriv/get-transfer-history",
1971
- // "code": "0",
1972
- // "result": {
1973
- // "transfer_list": [
1974
- // {
1975
- // "direction": "IN",
1976
- // "time": "1641025185223",
1977
- // "amount": "109.56",
1978
- // "status": "COMPLETED",
1979
- // "information": "From Spot Wallet",
1980
- // "currency": "USDC"
1981
- // }
1982
- // ]
1983
- // }
1984
- // }
1985
- // }
1986
- //
1987
- const response = this.safeValue(transfer, 'response', {});
1988
- const result = this.safeValue(response, 'result', {});
1989
- const transferList = this.safeValue(result, 'transfer_list', []);
1990
- let timestamp = undefined;
1991
- let amount = undefined;
1992
- let code = undefined;
1993
- let information = undefined;
1994
- let status = undefined;
1995
- for (let i = 0; i < transferList.length; i++) {
1996
- const entry = transferList[i];
1997
- timestamp = this.safeInteger(entry, 'time');
1998
- amount = this.safeNumber(entry, 'amount');
1999
- const currencyId = this.safeString(entry, 'currency');
2000
- code = this.safeCurrencyCode(currencyId);
2001
- information = this.safeString(entry, 'information');
2002
- const rawStatus = this.safeString(entry, 'status');
2003
- status = this.parseTransferStatus(rawStatus);
2004
- }
2005
- let fromAccount = undefined;
2006
- let toAccount = undefined;
2007
- if (information !== undefined) {
2008
- const parts = information.split(' ');
2009
- const direction = this.safeStringLower(parts, 0);
2010
- const method = this.safeString(response, 'method');
2011
- if (direction === 'from') {
2012
- fromAccount = this.safeStringLower(parts, 1);
2013
- if (method === 'private/margin/get-transfer-history') {
2014
- toAccount = 'margin';
2015
- }
2016
- else {
2017
- toAccount = 'derivative';
2018
- }
2019
- }
2020
- else if (direction === 'to') {
2021
- toAccount = this.safeStringLower(parts, 1);
2022
- if (method === 'private/margin/get-transfer-history') {
2023
- fromAccount = 'margin';
2024
- }
2025
- else {
2026
- fromAccount = 'derivative';
2027
- }
2028
- }
2029
- }
2030
- return {
2031
- 'info': transferList,
2032
- 'id': this.safeString(response, 'id'),
2033
- 'timestamp': timestamp,
2034
- 'datetime': this.iso8601(timestamp),
2035
- 'currency': code,
2036
- 'amount': amount,
2037
- 'fromAccount': fromAccount,
2038
- 'toAccount': toAccount,
2039
- 'status': status,
2040
- };
2041
- }
2042
1859
  parseTicker(ticker, market = undefined) {
2043
1860
  //
2044
1861
  // fetchTicker
package/js/src/gate.js CHANGED
@@ -545,6 +545,7 @@ export default class gate extends Exchange {
545
545
  '15m': '15m',
546
546
  '30m': '30m',
547
547
  '1h': '1h',
548
+ '2h': '2h',
548
549
  '4h': '4h',
549
550
  '8h': '8h',
550
551
  '1d': '1d',
package/js/src/gemini.js CHANGED
@@ -35,6 +35,8 @@ export default class gemini extends Exchange {
35
35
  'option': false,
36
36
  'addMargin': false,
37
37
  'cancelOrder': true,
38
+ 'closeAllPositions': false,
39
+ 'closePosition': false,
38
40
  'createDepositAddress': true,
39
41
  'createMarketOrder': false,
40
42
  'createOrder': true,
package/js/src/idex.js CHANGED
@@ -40,6 +40,8 @@ export default class idex extends Exchange {
40
40
  'cancelAllOrders': true,
41
41
  'cancelOrder': true,
42
42
  'cancelOrders': false,
43
+ 'closeAllPositions': false,
44
+ 'closePosition': false,
43
45
  'createDepositAddress': false,
44
46
  'createOrder': true,
45
47
  'createReduceOnlyOrder': false,
@@ -31,6 +31,8 @@ export default class independentreserve extends Exchange {
31
31
  'option': false,
32
32
  'addMargin': false,
33
33
  'cancelOrder': true,
34
+ 'closeAllPositions': false,
35
+ 'closePosition': false,
34
36
  'createOrder': true,
35
37
  'createReduceOnlyOrder': false,
36
38
  'createStopLimitOrder': false,
package/js/src/indodax.js CHANGED
@@ -34,6 +34,8 @@ export default class indodax extends Exchange {
34
34
  'cancelAllOrders': false,
35
35
  'cancelOrder': true,
36
36
  'cancelOrders': false,
37
+ 'closeAllPositions': false,
38
+ 'closePosition': false,
37
39
  'createDepositAddress': false,
38
40
  'createOrder': true,
39
41
  'createReduceOnlyOrder': false,
package/js/src/kucoin.js CHANGED
@@ -38,6 +38,8 @@ export default class kucoin extends Exchange {
38
38
  'borrowIsolatedMargin': true,
39
39
  'cancelAllOrders': true,
40
40
  'cancelOrder': true,
41
+ 'closeAllPositions': false,
42
+ 'closePosition': false,
41
43
  'createDepositAddress': true,
42
44
  'createOrder': true,
43
45
  'createOrders': true,
package/js/src/kuna.js CHANGED
@@ -36,6 +36,8 @@ export default class kuna extends Exchange {
36
36
  'borrowMargin': false,
37
37
  'cancelOrder': true,
38
38
  'cancelOrders': true,
39
+ 'closeAllPositions': false,
40
+ 'closePosition': false,
39
41
  'createDepositAddress': true,
40
42
  'createOrder': true,
41
43
  'createPostOnlyOrder': false,