ccxt 4.3.7 → 4.3.9

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 (44) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/ccxt.js +1 -1
  3. package/dist/cjs/src/base/Exchange.js +13 -3
  4. package/dist/cjs/src/binance.js +1 -1
  5. package/dist/cjs/src/bingx.js +22 -12
  6. package/dist/cjs/src/bitget.js +1 -1
  7. package/dist/cjs/src/coinex.js +629 -433
  8. package/dist/cjs/src/coinmetro.js +31 -31
  9. package/dist/cjs/src/okx.js +59 -2
  10. package/dist/cjs/src/woo.js +1 -1
  11. package/js/ccxt.d.ts +1 -1
  12. package/js/ccxt.js +1 -1
  13. package/js/src/abstract/bingx.d.ts +1 -1
  14. package/js/src/abstract/coinmetro.d.ts +1 -0
  15. package/js/src/base/Exchange.d.ts +19 -19
  16. package/js/src/base/Exchange.js +13 -3
  17. package/js/src/base/functions/generic.d.ts +20 -19
  18. package/js/src/binance.js +1 -1
  19. package/js/src/bingx.d.ts +2 -2
  20. package/js/src/bingx.js +22 -12
  21. package/js/src/bitget.js +1 -1
  22. package/js/src/bybit.d.ts +1 -1
  23. package/js/src/coinbase.d.ts +1 -1
  24. package/js/src/coinbaseinternational.d.ts +1 -1
  25. package/js/src/coinex.js +629 -433
  26. package/js/src/coinmetro.d.ts +1 -1
  27. package/js/src/coinmetro.js +31 -31
  28. package/js/src/gemini.d.ts +1 -1
  29. package/js/src/hollaex.d.ts +1 -1
  30. package/js/src/htx.d.ts +2 -2
  31. package/js/src/idex.d.ts +1 -1
  32. package/js/src/kucoin.d.ts +1 -1
  33. package/js/src/mexc.d.ts +1 -1
  34. package/js/src/okcoin.d.ts +1 -1
  35. package/js/src/okx.d.ts +5 -1
  36. package/js/src/okx.js +59 -2
  37. package/js/src/paymium.d.ts +1 -1
  38. package/js/src/pro/luno.d.ts +2 -2
  39. package/js/src/probit.d.ts +1 -1
  40. package/js/src/upbit.d.ts +1 -1
  41. package/js/src/whitebit.d.ts +1 -1
  42. package/js/src/woo.js +1 -1
  43. package/js/src/zonda.d.ts +1 -1
  44. package/package.json +7 -7
package/README.md CHANGED
@@ -213,13 +213,13 @@ console.log(version, Object.keys(exchanges));
213
213
 
214
214
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
215
215
 
216
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.7/dist/ccxt.browser.js
217
- * unpkg: https://unpkg.com/ccxt@4.3.7/dist/ccxt.browser.js
216
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.9/dist/ccxt.browser.js
217
+ * unpkg: https://unpkg.com/ccxt@4.3.9/dist/ccxt.browser.js
218
218
 
219
219
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
220
220
 
221
221
  ```HTML
222
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.7/dist/ccxt.browser.js"></script>
222
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.9/dist/ccxt.browser.js"></script>
223
223
  ```
224
224
 
225
225
  Creates a global `ccxt` object:
package/dist/cjs/ccxt.js CHANGED
@@ -182,7 +182,7 @@ var woo$1 = require('./src/pro/woo.js');
182
182
 
183
183
  //-----------------------------------------------------------------------------
184
184
  // this is updated by vss.js when building
185
- const version = '4.3.7';
185
+ const version = '4.3.9';
186
186
  Exchange["default"].ccxtVersion = version;
187
187
  const exchanges = {
188
188
  'ace': ace,
@@ -6104,7 +6104,7 @@ class Exchange {
6104
6104
  parseLeverage(leverage, market = undefined) {
6105
6105
  throw new errors.NotSupported(this.id + ' parseLeverage () is not supported yet');
6106
6106
  }
6107
- parseConversions(conversions, fromCurrencyKey = undefined, toCurrencyKey = undefined, since = undefined, limit = undefined, params = {}) {
6107
+ parseConversions(conversions, code = undefined, fromCurrencyKey = undefined, toCurrencyKey = undefined, since = undefined, limit = undefined, params = {}) {
6108
6108
  conversions = this.toArray(conversions);
6109
6109
  const result = [];
6110
6110
  let fromCurrency = undefined;
@@ -6123,8 +6123,18 @@ class Exchange {
6123
6123
  result.push(conversion);
6124
6124
  }
6125
6125
  const sorted = this.sortBy(result, 'timestamp');
6126
- const code = (fromCurrency !== undefined) ? fromCurrency['code'] : undefined;
6127
- return this.filterByCurrencySinceLimit(sorted, code, since, limit);
6126
+ let currency = undefined;
6127
+ if (code !== undefined) {
6128
+ currency = this.currency(code);
6129
+ code = currency['code'];
6130
+ }
6131
+ if (code === undefined) {
6132
+ return this.filterBySinceLimit(sorted, since, limit);
6133
+ }
6134
+ const fromConversion = this.filterBy(sorted, 'fromCurrency', code);
6135
+ const toConversion = this.filterBy(sorted, 'toCurrency', code);
6136
+ const both = this.arrayConcat(fromConversion, toConversion);
6137
+ return this.filterBySinceLimit(both, since, limit);
6128
6138
  }
6129
6139
  parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
6130
6140
  throw new errors.NotSupported(this.id + ' parseConversion () is not supported yet');
@@ -12919,7 +12919,7 @@ class binance extends binance$1 {
12919
12919
  //
12920
12920
  }
12921
12921
  const rows = this.safeList(response, responseQuery, []);
12922
- return this.parseConversions(rows, fromCurrencyKey, toCurrencyKey, since, limit);
12922
+ return this.parseConversions(rows, code, fromCurrencyKey, toCurrencyKey, since, limit);
12923
12923
  }
12924
12924
  parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
12925
12925
  //
@@ -289,7 +289,6 @@ class bingx extends bingx$1 {
289
289
  'get': {
290
290
  'list': 3,
291
291
  'assets': 3,
292
- 'apiKey/query': 1,
293
292
  },
294
293
  'post': {
295
294
  'create': 3,
@@ -306,6 +305,7 @@ class bingx extends bingx$1 {
306
305
  'private': {
307
306
  'get': {
308
307
  'uid': 1,
308
+ 'apiKey/query': 1,
309
309
  },
310
310
  'post': {
311
311
  'innerTransfer/authorizeSubAccount': 3,
@@ -1835,6 +1835,12 @@ class bingx extends bingx$1 {
1835
1835
  };
1836
1836
  const isMarketOrder = type === 'MARKET';
1837
1837
  const isSpot = marketType === 'spot';
1838
+ const stopLossPrice = this.safeString(params, 'stopLossPrice');
1839
+ const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
1840
+ const triggerPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
1841
+ const isTriggerOrder = triggerPrice !== undefined;
1842
+ const isStopLossPriceOrder = stopLossPrice !== undefined;
1843
+ const isTakeProfitPriceOrder = takeProfitPrice !== undefined;
1838
1844
  const exchangeClientOrderId = isSpot ? 'newClientOrderId' : 'clientOrderID';
1839
1845
  const clientOrderId = this.safeString2(params, exchangeClientOrderId, 'clientOrderId');
1840
1846
  if (clientOrderId !== undefined) {
@@ -1851,7 +1857,6 @@ class bingx extends bingx$1 {
1851
1857
  else if (timeInForce === 'GTC') {
1852
1858
  request['timeInForce'] = 'GTC';
1853
1859
  }
1854
- const triggerPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
1855
1860
  if (isSpot) {
1856
1861
  const cost = this.safeNumber2(params, 'cost', 'quoteOrderQty');
1857
1862
  params = this.omit(params, 'cost');
@@ -1883,19 +1888,24 @@ class bingx extends bingx$1 {
1883
1888
  request['type'] = 'TRIGGER_MARKET';
1884
1889
  }
1885
1890
  }
1891
+ else if ((stopLossPrice !== undefined) || (takeProfitPrice !== undefined)) {
1892
+ const stopTakePrice = (stopLossPrice !== undefined) ? stopLossPrice : takeProfitPrice;
1893
+ if (type === 'LIMIT') {
1894
+ request['type'] = 'TAKE_STOP_LIMIT';
1895
+ }
1896
+ else if (type === 'MARKET') {
1897
+ request['type'] = 'TAKE_STOP_MARKET';
1898
+ }
1899
+ request['stopPrice'] = this.parseToNumeric(this.priceToPrecision(symbol, stopTakePrice));
1900
+ }
1886
1901
  }
1887
1902
  else {
1888
1903
  if (timeInForce === 'FOK') {
1889
1904
  request['timeInForce'] = 'FOK';
1890
1905
  }
1891
- const stopLossPrice = this.safeString(params, 'stopLossPrice');
1892
- const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
1893
1906
  const trailingAmount = this.safeString(params, 'trailingAmount');
1894
1907
  const trailingPercent = this.safeString2(params, 'trailingPercent', 'priceRate');
1895
1908
  const trailingType = this.safeString(params, 'trailingType', 'TRAILING_STOP_MARKET');
1896
- const isTriggerOrder = triggerPrice !== undefined;
1897
- const isStopLossPriceOrder = stopLossPrice !== undefined;
1898
- const isTakeProfitPriceOrder = takeProfitPrice !== undefined;
1899
1909
  const isTrailingAmountOrder = trailingAmount !== undefined;
1900
1910
  const isTrailingPercentOrder = trailingPercent !== undefined;
1901
1911
  const isTrailing = isTrailingAmountOrder || isTrailingPercentOrder;
@@ -1994,8 +2004,8 @@ class bingx extends bingx$1 {
1994
2004
  }
1995
2005
  request['positionSide'] = positionSide;
1996
2006
  request['quantity'] = this.parseToNumeric(this.amountToPrecision(symbol, amount));
1997
- params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId']);
1998
2007
  }
2008
+ params = this.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId']);
1999
2009
  return this.extend(request, params);
2000
2010
  }
2001
2011
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
@@ -2015,9 +2025,9 @@ class bingx extends bingx$1 {
2015
2025
  * @param {bool} [params.postOnly] true to place a post only order
2016
2026
  * @param {string} [params.timeInForce] spot supports 'PO', 'GTC' and 'IOC', swap supports 'PO', 'GTC', 'IOC' and 'FOK'
2017
2027
  * @param {bool} [params.reduceOnly] *swap only* true or false whether the order is reduce only
2018
- * @param {float} [params.triggerPrice] *swap only* triggerPrice at which the attached take profit / stop loss order will be triggered
2019
- * @param {float} [params.stopLossPrice] *swap only* stop loss trigger price
2020
- * @param {float} [params.takeProfitPrice] *swap only* take profit trigger price
2028
+ * @param {float} [params.triggerPrice] triggerPrice at which the attached take profit / stop loss order will be triggered
2029
+ * @param {float} [params.stopLossPrice] stop loss trigger price
2030
+ * @param {float} [params.takeProfitPrice] take profit trigger price
2021
2031
  * @param {float} [params.cost] the quote quantity that can be used as an alternative for the amount
2022
2032
  * @param {float} [params.trailingAmount] *swap only* the quote amount to trail away from the current market price
2023
2033
  * @param {float} [params.trailingPercent] *swap only* the percent to trail away from the current market price
@@ -2463,7 +2473,7 @@ class bingx extends bingx$1 {
2463
2473
  return this.safeOrder({
2464
2474
  'info': info,
2465
2475
  'id': this.safeString2(order, 'orderId', 'i'),
2466
- 'clientOrderId': this.safeStringN(order, ['clientOrderID', 'origClientOrderId', 'c']),
2476
+ 'clientOrderId': this.safeStringN(order, ['clientOrderID', 'clientOrderId', 'origClientOrderId', 'c']),
2467
2477
  'symbol': this.safeSymbol(marketId, market, '-', marketType),
2468
2478
  'timestamp': timestamp,
2469
2479
  'datetime': this.iso8601(timestamp),
@@ -8672,7 +8672,7 @@ class bitget extends bitget$1 {
8672
8672
  //
8673
8673
  const data = this.safeDict(response, 'data', {});
8674
8674
  const dataList = this.safeList(data, 'dataList', []);
8675
- return this.parseConversions(dataList, 'fromCoin', 'toCoin', since, limit);
8675
+ return this.parseConversions(dataList, code, 'fromCoin', 'toCoin', since, limit);
8676
8676
  }
8677
8677
  parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
8678
8678
  //