ccxt 4.2.74 → 4.2.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 (71) hide show
  1. package/CHANGELOG.md +206 -10
  2. package/README.md +10 -9
  3. package/build.sh +1 -1
  4. package/dist/ccxt.browser.js +900 -217
  5. package/dist/ccxt.browser.min.js +3 -3
  6. package/dist/cjs/ccxt.js +4 -1
  7. package/dist/cjs/src/abstract/tradeogre.js +9 -0
  8. package/dist/cjs/src/ascendex.js +3 -2
  9. package/dist/cjs/src/binance.js +2 -0
  10. package/dist/cjs/src/bingx.js +12 -14
  11. package/dist/cjs/src/bitmart.js +1 -0
  12. package/dist/cjs/src/bybit.js +2 -1
  13. package/dist/cjs/src/coinbase.js +18 -2
  14. package/dist/cjs/src/coinbaseinternational.js +1 -1
  15. package/dist/cjs/src/coinex.js +4 -3
  16. package/dist/cjs/src/gate.js +2 -0
  17. package/dist/cjs/src/htx.js +1 -0
  18. package/dist/cjs/src/kraken.js +3 -3
  19. package/dist/cjs/src/kucoin.js +1 -1
  20. package/dist/cjs/src/pro/coinbaseinternational.js +1 -1
  21. package/dist/cjs/src/tradeogre.js +632 -0
  22. package/js/ccxt.d.ts +5 -2
  23. package/js/ccxt.js +4 -2
  24. package/js/src/abstract/binance.d.ts +1 -0
  25. package/js/src/abstract/binancecoinm.d.ts +1 -0
  26. package/js/src/abstract/binanceus.d.ts +1 -0
  27. package/js/src/abstract/binanceusdm.d.ts +1 -0
  28. package/js/src/abstract/bingx.d.ts +2 -0
  29. package/js/src/abstract/tradeogre.d.ts +19 -0
  30. package/js/src/abstract/tradeogre.js +11 -0
  31. package/js/src/ascendex.d.ts +2 -7
  32. package/js/src/ascendex.js +3 -2
  33. package/js/src/base/Exchange.d.ts +5 -5
  34. package/js/src/base/types.d.ts +7 -1
  35. package/js/src/binance.d.ts +1 -1
  36. package/js/src/binance.js +2 -0
  37. package/js/src/bingx.js +12 -14
  38. package/js/src/bitmart.d.ts +1 -1
  39. package/js/src/bitmart.js +2 -1
  40. package/js/src/bybit.js +2 -1
  41. package/js/src/coinbase.d.ts +4 -4
  42. package/js/src/coinbase.js +18 -2
  43. package/js/src/coinbaseinternational.d.ts +1 -1
  44. package/js/src/coinbaseinternational.js +1 -1
  45. package/js/src/coinbasepro.d.ts +2 -2
  46. package/js/src/coinex.js +4 -3
  47. package/js/src/coinlist.d.ts +2 -2
  48. package/js/src/cryptocom.d.ts +2 -2
  49. package/js/src/currencycom.d.ts +2 -2
  50. package/js/src/deribit.d.ts +2 -2
  51. package/js/src/gate.d.ts +1 -1
  52. package/js/src/gate.js +2 -0
  53. package/js/src/htx.d.ts +2 -2
  54. package/js/src/htx.js +1 -0
  55. package/js/src/huobijp.d.ts +2 -2
  56. package/js/src/kraken.d.ts +1 -1
  57. package/js/src/kraken.js +3 -3
  58. package/js/src/kucoin.d.ts +3 -3
  59. package/js/src/kucoin.js +1 -1
  60. package/js/src/luno.d.ts +2 -2
  61. package/js/src/mexc.d.ts +3 -3
  62. package/js/src/ndax.d.ts +2 -2
  63. package/js/src/novadax.d.ts +2 -2
  64. package/js/src/okx.d.ts +2 -2
  65. package/js/src/pro/bitfinex2.d.ts +1 -1
  66. package/js/src/pro/coinbaseinternational.js +1 -1
  67. package/js/src/tradeogre.d.ts +32 -0
  68. package/js/src/tradeogre.js +633 -0
  69. package/js/src/woo.d.ts +2 -2
  70. package/package.json +1 -1
  71. package/skip-tests.json +5 -0
package/dist/cjs/ccxt.js CHANGED
@@ -106,6 +106,7 @@ var poloniexfutures = require('./src/poloniexfutures.js');
106
106
  var probit = require('./src/probit.js');
107
107
  var timex = require('./src/timex.js');
108
108
  var tokocrypto = require('./src/tokocrypto.js');
109
+ var tradeogre = require('./src/tradeogre.js');
109
110
  var upbit = require('./src/upbit.js');
110
111
  var wavesexchange = require('./src/wavesexchange.js');
111
112
  var wazirx = require('./src/wazirx.js');
@@ -180,7 +181,7 @@ var woo$1 = require('./src/pro/woo.js');
180
181
 
181
182
  //-----------------------------------------------------------------------------
182
183
  // this is updated by vss.js when building
183
- const version = '4.2.74';
184
+ const version = '4.2.76';
184
185
  Exchange["default"].ccxtVersion = version;
185
186
  const exchanges = {
186
187
  'ace': ace,
@@ -277,6 +278,7 @@ const exchanges = {
277
278
  'probit': probit,
278
279
  'timex': timex,
279
280
  'tokocrypto': tokocrypto,
281
+ 'tradeogre': tradeogre,
280
282
  'upbit': upbit,
281
283
  'wavesexchange': wavesexchange,
282
284
  'wazirx': wazirx,
@@ -486,6 +488,7 @@ exports.poloniexfutures = poloniexfutures;
486
488
  exports.probit = probit;
487
489
  exports.timex = timex;
488
490
  exports.tokocrypto = tokocrypto;
491
+ exports.tradeogre = tradeogre;
489
492
  exports.upbit = upbit;
490
493
  exports.wavesexchange = wavesexchange;
491
494
  exports.wazirx = wazirx;
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var Exchange$1 = require('../base/Exchange.js');
4
+
5
+ // -------------------------------------------------------------------------------
6
+ class Exchange extends Exchange$1["default"] {
7
+ }
8
+
9
+ module.exports = Exchange;
@@ -750,7 +750,7 @@ class ascendex extends ascendex$1 {
750
750
  {
751
751
  'id': accountGroup,
752
752
  'type': undefined,
753
- 'currency': undefined,
753
+ 'code': undefined,
754
754
  'info': response,
755
755
  },
756
756
  ];
@@ -2730,7 +2730,8 @@ class ascendex extends ascendex$1 {
2730
2730
  if (Precise["default"].stringEq(notional, '0')) {
2731
2731
  notional = this.safeString(position, 'sellOpenOrderNotional');
2732
2732
  }
2733
- const marginMode = this.safeString(position, 'marginType');
2733
+ const marginType = this.safeString(position, 'marginType');
2734
+ const marginMode = (marginType === 'crossed') ? 'cross' : 'isolated';
2734
2735
  let collateral = undefined;
2735
2736
  if (marginMode === 'isolated') {
2736
2737
  collateral = this.safeString(position, 'isolatedMargin');
@@ -808,6 +808,7 @@ class binance extends binance$1 {
808
808
  'userTrades': 5,
809
809
  'income': 30,
810
810
  'commissionRate': 20,
811
+ 'rateLimit/order': 1,
811
812
  'apiTradingStatus': 1,
812
813
  'multiAssetsMargin': 30,
813
814
  // broker endpoints
@@ -11664,6 +11665,7 @@ class binance extends binance$1 {
11664
11665
  * @param {int} [limit] default 30, max 500
11665
11666
  * @param {object} [params] exchange specific parameters
11666
11667
  * @param {int} [params.until] the time(ms) of the latest record to retrieve as a unix timestamp
11668
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
11667
11669
  * @returns {object} an array of [open interest structure]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
11668
11670
  */
11669
11671
  if (timeframe === '1m') {
@@ -124,6 +124,7 @@ class bingx extends bingx$1 {
124
124
  'v1': {
125
125
  'public': {
126
126
  'get': {
127
+ 'server/time': 3,
127
128
  'common/symbols': 3,
128
129
  'market/trades': 3,
129
130
  'market/depth': 3,
@@ -147,6 +148,7 @@ class bingx extends bingx$1 {
147
148
  'trade/order/cancelReplace': 3,
148
149
  'trade/cancelOrders': 3,
149
150
  'trade/cancelOpenOrders': 3,
151
+ 'trade/cancelAllAfter': 1,
150
152
  },
151
153
  },
152
154
  },
@@ -1809,15 +1811,18 @@ class bingx extends bingx$1 {
1809
1811
  request[exchangeClientOrderId] = clientOrderId;
1810
1812
  }
1811
1813
  const timeInForce = this.safeStringUpper(params, 'timeInForce');
1812
- if (timeInForce === 'IOC') {
1814
+ [postOnly, params] = this.handlePostOnly(isMarketOrder, timeInForce === 'PostOnly', params);
1815
+ if (postOnly || (timeInForce === 'PostOnly')) {
1816
+ request['timeInForce'] = 'PostOnly';
1817
+ }
1818
+ else if (timeInForce === 'IOC') {
1813
1819
  request['timeInForce'] = 'IOC';
1814
1820
  }
1821
+ else if (timeInForce === 'GTC') {
1822
+ request['timeInForce'] = 'GTC';
1823
+ }
1815
1824
  const triggerPrice = this.safeString2(params, 'stopPrice', 'triggerPrice');
1816
1825
  if (isSpot) {
1817
- [postOnly, params] = this.handlePostOnly(isMarketOrder, timeInForce === 'POC', params);
1818
- if (postOnly || (timeInForce === 'POC')) {
1819
- request['timeInForce'] = 'POC';
1820
- }
1821
1826
  const cost = this.safeNumber2(params, 'cost', 'quoteOrderQty');
1822
1827
  params = this.omit(params, 'cost');
1823
1828
  if (cost !== undefined) {
@@ -1850,14 +1855,7 @@ class bingx extends bingx$1 {
1850
1855
  }
1851
1856
  }
1852
1857
  else {
1853
- [postOnly, params] = this.handlePostOnly(isMarketOrder, timeInForce === 'PostOnly', params);
1854
- if (postOnly || (timeInForce === 'PostOnly')) {
1855
- request['timeInForce'] = 'PostOnly';
1856
- }
1857
- else if (timeInForce === 'GTC') {
1858
- request['timeInForce'] = 'GTC';
1859
- }
1860
- else if (timeInForce === 'FOK') {
1858
+ if (timeInForce === 'FOK') {
1861
1859
  request['timeInForce'] = 'FOK';
1862
1860
  }
1863
1861
  const stopLossPrice = this.safeString(params, 'stopLossPrice');
@@ -1985,7 +1983,7 @@ class bingx extends bingx$1 {
1985
1983
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1986
1984
  * @param {string} [params.clientOrderId] a unique id for the order
1987
1985
  * @param {bool} [params.postOnly] true to place a post only order
1988
- * @param {string} [params.timeInForce] spot supports 'PO' and 'IOC', swap supports 'PO', 'GTC', 'IOC' and 'FOK'
1986
+ * @param {string} [params.timeInForce] spot supports 'PO', 'GTC' and 'IOC', swap supports 'PO', 'GTC', 'IOC' and 'FOK'
1989
1987
  * @param {bool} [params.reduceOnly] *swap only* true or false whether the order is reduce only
1990
1988
  * @param {float} [params.triggerPrice] *swap only* triggerPrice at which the attached take profit / stop loss order will be triggered
1991
1989
  * @param {float} [params.stopLossPrice] *swap only* stop loss trigger price
@@ -347,6 +347,7 @@ class bitmart extends bitmart$1 {
347
347
  '70000': errors.ExchangeError,
348
348
  '70001': errors.BadRequest,
349
349
  '70002': errors.BadSymbol,
350
+ '70003': errors.NetworkError,
350
351
  '71001': errors.BadRequest,
351
352
  '71002': errors.BadRequest,
352
353
  '71003': errors.BadRequest,
@@ -2650,7 +2650,7 @@ class bybit extends bybit$1 {
2650
2650
  //
2651
2651
  const id = this.safeStringN(trade, ['execId', 'id', 'tradeId']);
2652
2652
  const marketId = this.safeString(trade, 'symbol');
2653
- let marketType = 'contract';
2653
+ let marketType = ('createType' in trade) ? 'contract' : 'spot';
2654
2654
  if (market !== undefined) {
2655
2655
  marketType = market['type'];
2656
2656
  }
@@ -6789,6 +6789,7 @@ class bybit extends bybit$1 {
6789
6789
  * @param {int} [since] Not used by Bybit
6790
6790
  * @param {int} [limit] The number of open interest structures to return. Max 200, default 50
6791
6791
  * @param {object} [params] Exchange specific parameters
6792
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6792
6793
  * @returns An array of open interest structures
6793
6794
  */
6794
6795
  if (timeframe === '1m') {
@@ -1323,7 +1323,7 @@ class coinbase extends coinbase$1 {
1323
1323
  * @returns {object} an associative dictionary of currencies
1324
1324
  */
1325
1325
  const response = await this.fetchCurrenciesFromCache(params);
1326
- const currencies = this.safeDict(response, 'currencies', {});
1326
+ const currencies = this.safeList(response, 'currencies', []);
1327
1327
  //
1328
1328
  // fiat
1329
1329
  //
@@ -1875,9 +1875,15 @@ class coinbase extends coinbase$1 {
1875
1875
  * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
1876
1876
  * @param {int} [limit] max number of ledger entrys to return, default is undefined
1877
1877
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1878
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
1878
1879
  * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger-structure}
1879
1880
  */
1880
1881
  await this.loadMarkets();
1882
+ let paginate = false;
1883
+ [paginate, params] = this.handleOptionAndParams(params, 'fetchLedger', 'paginate');
1884
+ if (paginate) {
1885
+ return await this.fetchPaginatedCallCursor('fetchLedger', code, since, limit, params, 'next_starting_after', 'starting_after', undefined, 100);
1886
+ }
1881
1887
  let currency = undefined;
1882
1888
  if (code !== undefined) {
1883
1889
  currency = this.currency(code);
@@ -1888,7 +1894,17 @@ class coinbase extends coinbase$1 {
1888
1894
  // the value for the next page can be obtained from the result of the previous call in the 'pagination' field
1889
1895
  // eg: instance.last_json_response.pagination.next_starting_after
1890
1896
  const response = await this.v2PrivateGetAccountsAccountIdTransactions(this.extend(request, params));
1891
- return this.parseLedger(response['data'], currency, since, limit);
1897
+ const ledger = this.parseLedger(response['data'], currency, since, limit);
1898
+ const length = ledger.length;
1899
+ const lastIndex = length - 1;
1900
+ const last = this.safeDict(ledger, lastIndex);
1901
+ const pagination = this.safeDict(response, 'pagination', {});
1902
+ const cursor = this.safeString(pagination, 'next_starting_after');
1903
+ if ((cursor !== undefined) && (cursor !== '')) {
1904
+ last['next_starting_after'] = cursor;
1905
+ ledger[lastIndex] = last;
1906
+ }
1907
+ return ledger;
1892
1908
  }
1893
1909
  parseLedgerEntryStatus(status) {
1894
1910
  const types = {
@@ -16,7 +16,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
16
16
  describe() {
17
17
  return this.deepExtend(super.describe(), {
18
18
  'id': 'coinbaseinternational',
19
- 'name': 'coinbase International',
19
+ 'name': 'Coinbase International',
20
20
  'countries': ['US'],
21
21
  'certified': true,
22
22
  'pro': true,
@@ -134,7 +134,7 @@ class coinex extends coinex$1 {
134
134
  'perpetualPrivate': 'https://api.coinex.com/perpetual',
135
135
  },
136
136
  'www': 'https://www.coinex.com',
137
- 'doc': 'https://github.com/coinexcom/coinex_exchange_api/wiki',
137
+ 'doc': 'https://viabtc.github.io/coinex_api_en_doc',
138
138
  'fees': 'https://www.coinex.com/fees',
139
139
  'referral': 'https://www.coinex.com/register?refer_code=yw5fz',
140
140
  },
@@ -348,6 +348,7 @@ class coinex extends coinex$1 {
348
348
  },
349
349
  'broad': {
350
350
  'ip not allow visit': errors.PermissionDenied,
351
+ 'service too busy': errors.ExchangeNotAvailable,
351
352
  },
352
353
  },
353
354
  });
@@ -5154,7 +5155,7 @@ class coinex extends coinex$1 {
5154
5155
  * @method
5155
5156
  * @name coinex#borrowIsolatedMargin
5156
5157
  * @description create a loan to borrow margin
5157
- * @see https://github.com/coinexcom/coinex_exchange_api/wiki/086margin_loan
5158
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account017_margin_loan
5158
5159
  * @param {string} symbol unified market symbol, required for coinex
5159
5160
  * @param {string} code unified currency code of the currency to borrow
5160
5161
  * @param {float} amount the amount to borrow
@@ -5191,7 +5192,7 @@ class coinex extends coinex$1 {
5191
5192
  * @method
5192
5193
  * @name coinex#repayIsolatedMargin
5193
5194
  * @description repay borrowed margin and interest
5194
- * @see https://github.com/coinexcom/coinex_exchange_api/wiki/087margin_flat
5195
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account018_margin_flat
5195
5196
  * @param {string} symbol unified market symbol, required for coinex
5196
5197
  * @param {string} code unified currency code of the currency to repay
5197
5198
  * @param {float} amount the amount to repay
@@ -4286,6 +4286,7 @@ class gate extends gate$1 {
4286
4286
  'failed': 'canceled',
4287
4287
  'expired': 'canceled',
4288
4288
  'finished': 'closed',
4289
+ 'finish': 'closed',
4289
4290
  'succeeded': 'closed',
4290
4291
  };
4291
4292
  return this.safeString(statuses, status, status);
@@ -6154,6 +6155,7 @@ class gate extends gate$1 {
6154
6155
  * @param {int} [since] the time(ms) of the earliest record to retrieve as a unix timestamp
6155
6156
  * @param {int} [limit] default 30
6156
6157
  * @param {object} [params] exchange specific parameters
6158
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6157
6159
  * @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
6158
6160
  */
6159
6161
  await this.loadMarkets();
@@ -6792,6 +6792,7 @@ class htx extends htx$1 {
6792
6792
  * @param {int} [since] not used by huobi, but filtered internally by ccxt
6793
6793
  * @param {int} [limit] not used by huobi, but filtered internally by ccxt
6794
6794
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6795
+ * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6795
6796
  * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
6796
6797
  */
6797
6798
  if (symbol === undefined) {
@@ -2761,7 +2761,7 @@ class kraken extends kraken$1 {
2761
2761
  // todo unify parsePosition/parsePositions
2762
2762
  return result;
2763
2763
  }
2764
- parseAccount(account) {
2764
+ parseAccountType(account) {
2765
2765
  const accountByType = {
2766
2766
  'spot': 'Spot Wallet',
2767
2767
  'swap': 'Futures Wallet',
@@ -2795,8 +2795,8 @@ class kraken extends kraken$1 {
2795
2795
  */
2796
2796
  await this.loadMarkets();
2797
2797
  const currency = this.currency(code);
2798
- fromAccount = this.parseAccount(fromAccount);
2799
- toAccount = this.parseAccount(toAccount);
2798
+ fromAccount = this.parseAccountType(fromAccount);
2799
+ toAccount = this.parseAccountType(toAccount);
2800
2800
  const request = {
2801
2801
  'amount': this.currencyToPrecision(code, amount),
2802
2802
  'from': fromAccount,
@@ -461,7 +461,7 @@ class kucoin extends kucoin$1 {
461
461
  '400006': errors.AuthenticationError,
462
462
  '400007': errors.AuthenticationError,
463
463
  '400008': errors.NotSupported,
464
- '400100': errors.BadRequest,
464
+ '400100': errors.InsufficientFunds,
465
465
  '400200': errors.InvalidOrder,
466
466
  '400350': errors.InvalidOrder,
467
467
  '400370': errors.InvalidOrder,
@@ -51,7 +51,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
51
51
  'ordersLimit': 1000,
52
52
  'myTradesLimit': 1000,
53
53
  },
54
- 'errors': {
54
+ 'exceptions': {
55
55
  'exact': {
56
56
  'Unable to authenticate': errors.AuthenticationError,
57
57
  },