ccxt 4.1.34 → 4.1.36

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 (51) hide show
  1. package/README.md +8 -3
  2. package/build.sh +4 -0
  3. package/dist/ccxt.browser.js +739 -437
  4. package/dist/ccxt.browser.min.js +2 -2
  5. package/dist/cjs/ccxt.js +1 -1
  6. package/dist/cjs/src/base/Exchange.js +12 -0
  7. package/dist/cjs/src/base/errors.js +15 -1
  8. package/dist/cjs/src/binance.js +1 -0
  9. package/dist/cjs/src/bingx.js +19 -18
  10. package/dist/cjs/src/bitget.js +1 -0
  11. package/dist/cjs/src/bitopro.js +1 -0
  12. package/dist/cjs/src/bitstamp.js +12 -0
  13. package/dist/cjs/src/bybit.js +112 -109
  14. package/dist/cjs/src/digifinex.js +109 -3
  15. package/dist/cjs/src/huobi.js +206 -39
  16. package/dist/cjs/src/kraken.js +15 -8
  17. package/dist/cjs/src/kucoin.js +233 -257
  18. package/dist/cjs/src/phemex.js +1 -0
  19. package/dist/cjs/src/pro/okx.js +1 -1
  20. package/examples2md.js +79 -0
  21. package/js/ccxt.d.ts +1 -1
  22. package/js/ccxt.js +1 -1
  23. package/js/src/abstract/binance.d.ts +1 -0
  24. package/js/src/abstract/binancecoinm.d.ts +1 -0
  25. package/js/src/abstract/binanceus.d.ts +1 -0
  26. package/js/src/abstract/binanceusdm.d.ts +1 -0
  27. package/js/src/abstract/bitopro.d.ts +1 -0
  28. package/js/src/abstract/bitstamp.d.ts +10 -0
  29. package/js/src/abstract/kucoin.d.ts +81 -83
  30. package/js/src/abstract/kucoinfutures.d.ts +90 -86
  31. package/js/src/base/Exchange.d.ts +4 -0
  32. package/js/src/base/Exchange.js +12 -0
  33. package/js/src/base/errorHierarchy.d.ts +1 -1
  34. package/js/src/base/errorHierarchy.js +1 -1
  35. package/js/src/base/errors.d.ts +9 -1
  36. package/js/src/base/errors.js +14 -2
  37. package/js/src/binance.js +1 -0
  38. package/js/src/bingx.js +19 -18
  39. package/js/src/bitget.js +1 -0
  40. package/js/src/bitopro.js +1 -0
  41. package/js/src/bitstamp.js +12 -0
  42. package/js/src/bybit.js +112 -109
  43. package/js/src/digifinex.d.ts +13 -0
  44. package/js/src/digifinex.js +109 -3
  45. package/js/src/huobi.js +206 -39
  46. package/js/src/kraken.js +15 -8
  47. package/js/src/kucoin.d.ts +0 -1
  48. package/js/src/kucoin.js +233 -257
  49. package/js/src/phemex.js +1 -0
  50. package/js/src/pro/okx.js +1 -1
  51. package/package.json +8 -4
package/dist/cjs/ccxt.js CHANGED
@@ -180,7 +180,7 @@ var woo$1 = require('./src/pro/woo.js');
180
180
 
181
181
  //-----------------------------------------------------------------------------
182
182
  // this is updated by vss.js when building
183
- const version = '4.1.34';
183
+ const version = '4.1.36';
184
184
  Exchange["default"].ccxtVersion = version;
185
185
  const exchanges = {
186
186
  'ace': ace,
@@ -80,6 +80,9 @@ class Exchange {
80
80
  this.last_json_response = undefined;
81
81
  this.last_response_headers = undefined;
82
82
  this.last_request_headers = undefined;
83
+ this.last_request_body = undefined;
84
+ this.last_request_url = undefined;
85
+ this.last_request_path = undefined;
83
86
  this.id = undefined;
84
87
  this.markets = undefined;
85
88
  this.status = undefined;
@@ -274,6 +277,9 @@ class Exchange {
274
277
  this.last_json_response = undefined;
275
278
  this.last_response_headers = undefined;
276
279
  this.last_request_headers = undefined;
280
+ this.last_request_body = undefined;
281
+ this.last_request_url = undefined;
282
+ this.last_request_path = undefined;
277
283
  // camelCase and snake_notation support
278
284
  const unCamelCaseProperties = (obj = this) => {
279
285
  if (obj !== null) {
@@ -2836,6 +2842,8 @@ class Exchange {
2836
2842
  this.lastRestRequestTimestamp = this.milliseconds();
2837
2843
  const request = this.sign(path, api, method, params, headers, body);
2838
2844
  this.last_request_headers = request['headers'];
2845
+ this.last_request_body = request['body'];
2846
+ this.last_request_url = request['url'];
2839
2847
  return await this.fetch(request['url'], request['method'], request['headers'], request['body']);
2840
2848
  }
2841
2849
  async request(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined, config = {}) {
@@ -3673,6 +3681,10 @@ class Exchange {
3673
3681
  filterByCurrencySinceLimit(array, code = undefined, since = undefined, limit = undefined, tail = false) {
3674
3682
  return this.filterByValueSinceLimit(array, 'currency', code, since, limit, 'timestamp', tail);
3675
3683
  }
3684
+ filterBySymbolsSinceLimit(array, symbols = undefined, since = undefined, limit = undefined, tail = false) {
3685
+ const result = this.filterByArray(array, 'symbol', symbols, false);
3686
+ return this.filterBySinceLimit(result, since, limit, 'timestamp', tail);
3687
+ }
3676
3688
  parseLastPrices(pricesData, symbols = undefined, params = {}) {
3677
3689
  //
3678
3690
  // the value of tickers is either a dict or a list
@@ -46,6 +46,12 @@ class ExchangeError extends Error {
46
46
  this.name = 'ExchangeError';
47
47
  }
48
48
  }
49
+ class OperationFailed extends ExchangeError {
50
+ constructor(message) {
51
+ super(message);
52
+ this.name = 'OperationFailed';
53
+ }
54
+ }
49
55
  class AuthenticationError extends ExchangeError {
50
56
  constructor(message) {
51
57
  super(message);
@@ -82,6 +88,12 @@ class BadRequest extends ExchangeError {
82
88
  this.name = 'BadRequest';
83
89
  }
84
90
  }
91
+ class OperationRejected extends BadRequest {
92
+ constructor(message) {
93
+ super(message);
94
+ this.name = 'OperationRejected';
95
+ }
96
+ }
85
97
  class BadSymbol extends BadRequest {
86
98
  constructor(message) {
87
99
  super(message);
@@ -234,7 +246,7 @@ class RequestTimeout extends NetworkError {
234
246
  // // Derived class hierarchy
235
247
  // errorHierarchy
236
248
  // )
237
- const errors = { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, ContractUnavailable, NoChange };
249
+ const errors = { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, ContractUnavailable, NoChange, OperationRejected, OperationFailed };
238
250
 
239
251
  exports.AccountNotEnabled = AccountNotEnabled;
240
252
  exports.AccountSuspended = AccountSuspended;
@@ -261,6 +273,8 @@ exports.NoChange = NoChange;
261
273
  exports.NotSupported = NotSupported;
262
274
  exports.NullResponse = NullResponse;
263
275
  exports.OnMaintenance = OnMaintenance;
276
+ exports.OperationFailed = OperationFailed;
277
+ exports.OperationRejected = OperationRejected;
264
278
  exports.OrderImmediatelyFillable = OrderImmediatelyFillable;
265
279
  exports.OrderNotCached = OrderNotCached;
266
280
  exports.OrderNotFillable = OrderNotFillable;
@@ -721,6 +721,7 @@ class binance extends binance$1 {
721
721
  'topLongShortPositionRatio': 1,
722
722
  'globalLongShortAccountRatio': 1,
723
723
  'takerlongshortRatio': 1,
724
+ 'basis': 1,
724
725
  },
725
726
  },
726
727
  'fapiPrivate': {
@@ -339,7 +339,8 @@ class bingx extends bingx$1 {
339
339
  'PFUTURES': 'swap',
340
340
  'SFUTURES': 'future',
341
341
  },
342
- 'recvWindow': 5 * 1000, // 5 sec
342
+ 'recvWindow': 5 * 1000,
343
+ 'broker': 'CCXT',
343
344
  },
344
345
  });
345
346
  }
@@ -623,7 +624,7 @@ class bingx extends bingx$1 {
623
624
  * @see https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20Symbols
624
625
  * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Contract%20Information
625
626
  * @param {object} [params] extra parameters specific to the exchange api endpoint
626
- * @returns {[object]} an array of objects representing market data
627
+ * @returns {object[]} an array of objects representing market data
627
628
  */
628
629
  const requests = [this.fetchSpotMarkets(params), this.fetchSwapMarkets(params)];
629
630
  const promises = await Promise.all(requests);
@@ -646,7 +647,7 @@ class bingx extends bingx$1 {
646
647
  * @param {object} [params] extra parameters specific to the bingx api endpoint
647
648
  * @param {int} [params.until] timestamp in ms of the latest candle to fetch
648
649
  * @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)
649
- * @returns {[[int]]} A list of candles ordered as timestamp, open, high, low, close, volume
650
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
650
651
  */
651
652
  await this.loadMarkets();
652
653
  let paginate = false;
@@ -752,7 +753,7 @@ class bingx extends bingx$1 {
752
753
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
753
754
  * @param {int} [limit] the maximum amount of trades to fetch
754
755
  * @param {object} [params] extra parameters specific to the bingx api endpoint
755
- * @returns {[object]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
756
+ * @returns {object[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
756
757
  */
757
758
  await this.loadMarkets();
758
759
  const market = this.market(symbol);
@@ -1082,7 +1083,7 @@ class bingx extends bingx$1 {
1082
1083
  * @param {object} [params] extra parameters specific to the bingx api endpoint
1083
1084
  * @param {int} [params.until] timestamp in ms of the latest funding rate to fetch
1084
1085
  * @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)
1085
- * @returns {[object]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
1086
+ * @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
1086
1087
  */
1087
1088
  this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
1088
1089
  await this.loadMarkets();
@@ -1245,7 +1246,7 @@ class bingx extends bingx$1 {
1245
1246
  * @name bingx#fetchTickers
1246
1247
  * @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
1247
1248
  * @see https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Ticker
1248
- * @param {[string]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1249
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
1249
1250
  * @param {object} [params] extra parameters specific to the bingx api endpoint
1250
1251
  * @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
1251
1252
  */
@@ -1482,10 +1483,10 @@ class bingx extends bingx$1 {
1482
1483
  * @description fetch all open positions
1483
1484
  * @see https://bingx-api.github.io/docs/#/swapV2/account-api.html#Perpetual%20Swap%20Positions
1484
1485
  * @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Query%20standard%20contract%20balance
1485
- * @param {[string]|undefined} symbols list of unified market symbols
1486
+ * @param {string[]|undefined} symbols list of unified market symbols
1486
1487
  * @param {object} [params] extra parameters specific to the bingx api endpoint
1487
1488
  * @param {boolean} [params.standard] whether to fetch standard contract positions
1488
- * @returns {[object]} a list of [position structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#position-structure}
1489
+ * @returns {object[]} a list of [position structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#position-structure}
1489
1490
  */
1490
1491
  await this.loadMarkets();
1491
1492
  symbols = this.marketSymbols(symbols);
@@ -2009,7 +2010,7 @@ class bingx extends bingx$1 {
2009
2010
  * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%20All%20Orders
2010
2011
  * @param {string} [symbol] unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
2011
2012
  * @param {object} [params] extra parameters specific to the bingx api endpoint
2012
- * @returns {[object]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2013
+ * @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2013
2014
  */
2014
2015
  this.checkRequiredSymbol('cancelAllOrders', symbol);
2015
2016
  await this.loadMarkets();
@@ -2059,7 +2060,7 @@ class bingx extends bingx$1 {
2059
2060
  * @description cancel multiple orders
2060
2061
  * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%20a%20Batch%20of%20Orders
2061
2062
  * @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Cancel%20a%20Batch%20of%20Orders
2062
- * @param {[string]} ids order ids
2063
+ * @param {string[]} ids order ids
2063
2064
  * @param {string} symbol unified market symbol, default is undefined
2064
2065
  * @param {object} [params] extra parameters specific to the bingx api endpoint
2065
2066
  * @returns {object} an list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
@@ -2208,7 +2209,7 @@ class bingx extends bingx$1 {
2208
2209
  * @param {int} [since] the earliest time in ms to fetch open orders for
2209
2210
  * @param {int} [limit] the maximum number of open order structures to retrieve
2210
2211
  * @param {object} [params] extra parameters specific to the bingx api endpoint
2211
- * @returns {[object]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2212
+ * @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2212
2213
  */
2213
2214
  this.checkRequiredSymbol('fetchOrders', symbol);
2214
2215
  await this.loadMarkets();
@@ -2297,7 +2298,7 @@ class bingx extends bingx$1 {
2297
2298
  * @param {object} [params] extra parameters specific to the bingx api endpoint
2298
2299
  * @param {int} [params.until] the latest time in ms to fetch orders for
2299
2300
  * @param {boolean} [params.standard] whether to fetch standard contract orders
2300
- * @returns {[object]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2301
+ * @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2301
2302
  */
2302
2303
  this.checkRequiredSymbol('fetchClosedOrders', symbol);
2303
2304
  await this.loadMarkets();
@@ -2428,7 +2429,7 @@ class bingx extends bingx$1 {
2428
2429
  * @param {int} [since] the earliest time in ms to fetch transfers for
2429
2430
  * @param {int} [limit] the maximum number of transfers structures to retrieve
2430
2431
  * @param {object} [params] extra parameters specific to the bingx api endpoint
2431
- * @returns {[object]} a list of [transfer structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure}
2432
+ * @returns {object[]} a list of [transfer structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transfer-structure}
2432
2433
  */
2433
2434
  await this.loadMarkets();
2434
2435
  let currency = undefined;
@@ -2573,7 +2574,7 @@ class bingx extends bingx$1 {
2573
2574
  * @param {int} [since] the earliest time in ms to fetch deposits for
2574
2575
  * @param {int} [limit] the maximum number of deposits structures to retrieve
2575
2576
  * @param {object} [params] extra parameters specific to the bingx api endpoint
2576
- * @returns {[object]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
2577
+ * @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
2577
2578
  */
2578
2579
  await this.loadMarkets();
2579
2580
  const request = {};
@@ -2618,7 +2619,7 @@ class bingx extends bingx$1 {
2618
2619
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
2619
2620
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
2620
2621
  * @param {object} [params] extra parameters specific to the bingx api endpoint
2621
- * @returns {[object]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
2622
+ * @returns {object[]} a list of [transaction structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#transaction-structure}
2622
2623
  */
2623
2624
  await this.loadMarkets();
2624
2625
  const request = {};
@@ -2891,7 +2892,7 @@ class bingx extends bingx$1 {
2891
2892
  * @param {int} [limit] the maximum number of trades structures to retrieve
2892
2893
  * @param {object} [params] extra parameters specific to the bingx api endpoint
2893
2894
  * @param {string} params.trandingUnit COIN (directly represent assets such as BTC and ETH) or CONT (represents the number of contract sheets)
2894
- * @returns {[object]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
2895
+ * @returns {object[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
2895
2896
  */
2896
2897
  this.checkRequiredArgument('fetchMyTrades', symbol, 'symbol');
2897
2898
  this.checkRequiredArgument('fetchMyTrades', since, 'since');
@@ -3001,7 +3002,7 @@ class bingx extends bingx$1 {
3001
3002
  * @name bingx#fetchDepositWithdrawFees
3002
3003
  * @description fetch deposit and withdraw fees
3003
3004
  * @see https://bingx-api.github.io/docs/#/common/account-api.html#All%20Coins'%20Information
3004
- * @param {[string]|undefined} codes list of unified currency codes
3005
+ * @param {string[]|undefined} codes list of unified currency codes
3005
3006
  * @param {object} [params] extra parameters specific to the bingx api endpoint
3006
3007
  * @returns {object} a list of [fee structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#fee-structure}
3007
3008
  */
@@ -3113,7 +3114,7 @@ class bingx extends bingx$1 {
3113
3114
  query += 'signature=' + signature;
3114
3115
  headers = {
3115
3116
  'X-BX-APIKEY': this.apiKey,
3116
- 'X-SOURCE-KEY': 'CCXT',
3117
+ 'X-SOURCE-KEY': this.safeString(this.options, 'broker', 'CCXT'),
3117
3118
  };
3118
3119
  url += query;
3119
3120
  }
@@ -822,6 +822,7 @@ class bitget extends bitget$1 {
822
822
  '40017': errors.ExchangeError,
823
823
  '40018': errors.PermissionDenied,
824
824
  '40019': errors.BadRequest,
825
+ '40037': errors.AuthenticationError,
825
826
  '40102': errors.BadRequest,
826
827
  '40103': errors.BadRequest,
827
828
  '40104': errors.ExchangeError,
@@ -120,6 +120,7 @@ class bitopro extends bitopro$1 {
120
120
  'provisioning/trading-pairs': 1,
121
121
  'provisioning/limitations-and-fees': 1,
122
122
  'trading-history/{pair}': 1,
123
+ 'price/otc/{currency}': 1,
123
124
  },
124
125
  },
125
126
  'private': {
@@ -123,9 +123,16 @@ class bitstamp extends bitstamp$1 {
123
123
  'trading-pairs-info/': 1,
124
124
  'currencies/': 1,
125
125
  'eur_usd/': 1,
126
+ 'travel_rule/vasps/': 1,
126
127
  },
127
128
  },
128
129
  'private': {
130
+ 'get': {
131
+ 'travel_rule/contacts/': 1,
132
+ 'contacts/{contact_uuid}/': 1,
133
+ 'earn/subscriptions/': 1,
134
+ 'earn/transactions/': 1,
135
+ },
129
136
  'post': {
130
137
  'account_balances/': 1,
131
138
  'account_balances/{currency}/': 1,
@@ -152,6 +159,7 @@ class bitstamp extends bitstamp$1 {
152
159
  'transfer-from-main/': 1,
153
160
  'my_trading_pairs/': 1,
154
161
  'fees/trading/': 1,
162
+ 'fees/trading/{pair}': 1,
155
163
  'fees/withdrawal/': 1,
156
164
  'fees/withdrawal/{currency}/': 1,
157
165
  'withdrawal-requests/': 1,
@@ -325,6 +333,10 @@ class bitstamp extends bitstamp$1 {
325
333
  'dgld_address/': 1,
326
334
  'ldo_withdrawal/': 1,
327
335
  'ldo_address/': 1,
336
+ 'travel_rule/contacts/': 1,
337
+ 'earn/subscribe/': 1,
338
+ 'earn/subscriptions/setting/': 1,
339
+ 'earn/unsubscribe': 1,
328
340
  },
329
341
  },
330
342
  },