ccxt 4.2.20 → 4.2.22

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 (82) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +1405 -274
  3. package/dist/ccxt.browser.min.js +6 -6
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/base/Exchange.js +37 -4
  6. package/dist/cjs/src/base/ws/WsClient.js +3 -1
  7. package/dist/cjs/src/bigone.js +1 -0
  8. package/dist/cjs/src/binance.js +14 -3
  9. package/dist/cjs/src/bitget.js +12 -2
  10. package/dist/cjs/src/bitrue.js +1 -0
  11. package/dist/cjs/src/bitvavo.js +271 -172
  12. package/dist/cjs/src/blockchaincom.js +3 -1
  13. package/dist/cjs/src/bybit.js +57 -9
  14. package/dist/cjs/src/coinbasepro.js +1 -0
  15. package/dist/cjs/src/coinex.js +37 -12
  16. package/dist/cjs/src/deribit.js +164 -0
  17. package/dist/cjs/src/gate.js +32 -1
  18. package/dist/cjs/src/novadax.js +26 -22
  19. package/dist/cjs/src/okcoin.js +3 -0
  20. package/dist/cjs/src/phemex.js +7 -3
  21. package/dist/cjs/src/poloniex.js +1 -0
  22. package/dist/cjs/src/pro/bequant.js +6 -1
  23. package/dist/cjs/src/pro/binance.js +7 -4
  24. package/dist/cjs/src/pro/binancecoinm.js +6 -1
  25. package/dist/cjs/src/pro/binanceus.js +6 -1
  26. package/dist/cjs/src/pro/bitcoincom.js +6 -1
  27. package/dist/cjs/src/pro/bitget.js +1 -1
  28. package/dist/cjs/src/pro/bitopro.js +7 -3
  29. package/dist/cjs/src/pro/bitrue.js +6 -1
  30. package/dist/cjs/src/pro/bitvavo.js +668 -22
  31. package/dist/cjs/src/pro/lbank.js +1 -1
  32. package/dist/cjs/src/pro/okx.js +13 -3
  33. package/dist/cjs/src/woo.js +1 -1
  34. package/js/ccxt.d.ts +1 -1
  35. package/js/ccxt.js +1 -1
  36. package/js/src/abstract/binance.d.ts +3 -0
  37. package/js/src/abstract/binancecoinm.d.ts +3 -0
  38. package/js/src/abstract/binanceus.d.ts +4 -0
  39. package/js/src/abstract/binanceusdm.d.ts +3 -0
  40. package/js/src/abstract/gate.d.ts +1 -0
  41. package/js/src/abstract/gateio.d.ts +1 -0
  42. package/js/src/abstract/novadax.d.ts +5 -1
  43. package/js/src/abstract/phemex.d.ts +1 -0
  44. package/js/src/base/Exchange.d.ts +12 -1
  45. package/js/src/base/Exchange.js +37 -4
  46. package/js/src/base/ws/WsClient.js +3 -2
  47. package/js/src/bigone.js +1 -0
  48. package/js/src/binance.js +14 -3
  49. package/js/src/bitget.js +12 -2
  50. package/js/src/bitrue.js +1 -0
  51. package/js/src/bitvavo.d.ts +14 -2
  52. package/js/src/bitvavo.js +271 -172
  53. package/js/src/blockchaincom.js +3 -1
  54. package/js/src/bybit.d.ts +2 -1
  55. package/js/src/bybit.js +57 -9
  56. package/js/src/coinbasepro.js +1 -0
  57. package/js/src/coinex.d.ts +1 -0
  58. package/js/src/coinex.js +37 -12
  59. package/js/src/deribit.d.ts +6 -1
  60. package/js/src/deribit.js +164 -0
  61. package/js/src/gate.d.ts +1 -0
  62. package/js/src/gate.js +32 -1
  63. package/js/src/novadax.js +26 -22
  64. package/js/src/okcoin.js +3 -0
  65. package/js/src/phemex.js +7 -3
  66. package/js/src/poloniex.js +1 -0
  67. package/js/src/pro/bequant.js +6 -1
  68. package/js/src/pro/binance.js +7 -4
  69. package/js/src/pro/binancecoinm.js +6 -1
  70. package/js/src/pro/binanceus.js +6 -1
  71. package/js/src/pro/bitcoincom.js +6 -1
  72. package/js/src/pro/bitget.js +1 -1
  73. package/js/src/pro/bitopro.js +7 -3
  74. package/js/src/pro/bitrue.js +6 -1
  75. package/js/src/pro/bitvavo.d.ts +35 -2
  76. package/js/src/pro/bitvavo.js +669 -23
  77. package/js/src/pro/lbank.js +1 -1
  78. package/js/src/pro/okx.js +13 -3
  79. package/js/src/woo.js +1 -1
  80. package/jsdoc2md.js +38 -16
  81. package/package.json +4 -1
  82. package/skip-tests.json +4 -0
package/dist/cjs/ccxt.js CHANGED
@@ -174,7 +174,7 @@ var woo$1 = require('./src/pro/woo.js');
174
174
 
175
175
  //-----------------------------------------------------------------------------
176
176
  // this is updated by vss.js when building
177
- const version = '4.2.20';
177
+ const version = '4.2.22';
178
178
  Exchange["default"].ccxtVersion = version;
179
179
  const exchanges = {
180
180
  'ace': ace,
@@ -400,11 +400,13 @@ class Exchange {
400
400
  'fetchCrossBorrowRate': undefined,
401
401
  'fetchCrossBorrowRates': undefined,
402
402
  'fetchCurrencies': 'emulated',
403
+ 'fetchCurrenciesWs': 'emulated',
403
404
  'fetchDeposit': undefined,
404
405
  'fetchDepositAddress': undefined,
405
406
  'fetchDepositAddresses': undefined,
406
407
  'fetchDepositAddressesByNetwork': undefined,
407
408
  'fetchDeposits': undefined,
409
+ 'fetchDepositsWs': undefined,
408
410
  'fetchDepositsWithdrawals': undefined,
409
411
  'fetchTransactionFee': undefined,
410
412
  'fetchTransactionFees': undefined,
@@ -422,9 +424,11 @@ class Exchange {
422
424
  'fetchLeverageTiers': undefined,
423
425
  'fetchMarketLeverageTiers': undefined,
424
426
  'fetchMarkets': true,
427
+ 'fetchMarketsWs': undefined,
425
428
  'fetchMarkOHLCV': undefined,
426
429
  'fetchMyTrades': undefined,
427
430
  'fetchOHLCV': undefined,
431
+ 'fetchOHLCVWs': undefined,
428
432
  'fetchOpenInterest': undefined,
429
433
  'fetchOpenInterestHistory': undefined,
430
434
  'fetchOpenOrder': undefined,
@@ -447,12 +451,14 @@ class Exchange {
447
451
  'fetchTrades': true,
448
452
  'fetchTradingFee': undefined,
449
453
  'fetchTradingFees': undefined,
454
+ 'fetchTradingFeesWs': undefined,
450
455
  'fetchTradingLimits': undefined,
451
456
  'fetchTransactions': undefined,
452
457
  'fetchTransfers': undefined,
453
458
  'fetchWithdrawAddresses': undefined,
454
459
  'fetchWithdrawal': undefined,
455
460
  'fetchWithdrawals': undefined,
461
+ 'fetchWithdrawalsWs': undefined,
456
462
  'reduceMargin': undefined,
457
463
  'setLeverage': undefined,
458
464
  'setMargin': undefined,
@@ -972,6 +978,13 @@ class Exchange {
972
978
  // and may be changed for consistency later
973
979
  return new Promise((resolve, reject) => resolve(this.currencies));
974
980
  }
981
+ fetchCurrenciesWs(params = {}) {
982
+ // markets are returned as a list
983
+ // currencies are returned as a dict
984
+ // this is for historical reasons
985
+ // and may be changed for consistency later
986
+ return new Promise((resolve, reject) => resolve(this.currencies));
987
+ }
975
988
  fetchMarkets(params = {}) {
976
989
  // markets are returned as a list
977
990
  // currencies are returned as a dict
@@ -979,6 +992,13 @@ class Exchange {
979
992
  // and may be changed for consistency later
980
993
  return new Promise((resolve, reject) => resolve(Object.values(this.markets)));
981
994
  }
995
+ fetchMarketsWs(params = {}) {
996
+ // markets are returned as a list
997
+ // currencies are returned as a dict
998
+ // this is for historical reasons
999
+ // and may be changed for consistency later
1000
+ return new Promise((resolve, reject) => resolve(Object.values(this.markets)));
1001
+ }
982
1002
  checkRequiredDependencies() {
983
1003
  return;
984
1004
  }
@@ -2757,6 +2777,13 @@ class Exchange {
2757
2777
  }
2758
2778
  throw new errors.NotSupported(this.id + ' fetchOHLCV() is not supported yet' + message);
2759
2779
  }
2780
+ async fetchOHLCVWs(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
2781
+ let message = '';
2782
+ if (this.has['fetchTradesWs']) {
2783
+ message = '. If you want to build OHLCV candles from trade executions data, visit https://github.com/ccxt/ccxt/tree/master/examples/ and see "build-ohlcv-bars" file';
2784
+ }
2785
+ throw new errors.NotSupported(this.id + ' fetchOHLCVWs() is not supported yet. Try using fetchOHLCV instead.' + message);
2786
+ }
2760
2787
  async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
2761
2788
  throw new errors.NotSupported(this.id + ' watchOHLCV() is not supported yet');
2762
2789
  }
@@ -3116,7 +3143,7 @@ class Exchange {
3116
3143
  for (let i = 0; i < response.length; i++) {
3117
3144
  const item = response[i];
3118
3145
  const id = this.safeString(item, marketIdKey);
3119
- const market = this.safeMarket(id, undefined, undefined, this.safeString(this.options, 'defaultType'));
3146
+ const market = this.safeMarket(id, undefined, undefined, 'swap');
3120
3147
  const symbol = market['symbol'];
3121
3148
  const contract = this.safeValue(market, 'contract', false);
3122
3149
  if (contract && ((symbols === undefined) || this.inArray(symbol, symbols))) {
@@ -4110,9 +4137,6 @@ class Exchange {
4110
4137
  async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4111
4138
  throw new errors.NotSupported(this.id + ' watchMyTrades() is not supported yet');
4112
4139
  }
4113
- async fetchOHLCVWs(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
4114
- throw new errors.NotSupported(this.id + ' fetchOHLCVWs() is not supported yet');
4115
- }
4116
4140
  async fetchGreeks(symbol, params = {}) {
4117
4141
  throw new errors.NotSupported(this.id + ' fetchGreeks() is not supported yet');
4118
4142
  }
@@ -4132,9 +4156,15 @@ class Exchange {
4132
4156
  async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
4133
4157
  throw new errors.NotSupported(this.id + ' fetchDeposits() is not supported yet');
4134
4158
  }
4159
+ async fetchDepositsWs(code = undefined, since = undefined, limit = undefined, params = {}) {
4160
+ throw new errors.NotSupported(this.id + ' fetchDepositsWs() is not supported yet');
4161
+ }
4135
4162
  async fetchWithdrawals(code = undefined, since = undefined, limit = undefined, params = {}) {
4136
4163
  throw new errors.NotSupported(this.id + ' fetchWithdrawals() is not supported yet');
4137
4164
  }
4165
+ async fetchWithdrawalsWs(code = undefined, since = undefined, limit = undefined, params = {}) {
4166
+ throw new errors.NotSupported(this.id + ' fetchWithdrawalsWs() is not supported yet');
4167
+ }
4138
4168
  async fetchOpenInterest(symbol, params = {}) {
4139
4169
  throw new errors.NotSupported(this.id + ' fetchOpenInterest() is not supported yet');
4140
4170
  }
@@ -4614,6 +4644,9 @@ class Exchange {
4614
4644
  async fetchTradingFees(params = {}) {
4615
4645
  throw new errors.NotSupported(this.id + ' fetchTradingFees() is not supported yet');
4616
4646
  }
4647
+ async fetchTradingFeesWs(params = {}) {
4648
+ throw new errors.NotSupported(this.id + ' fetchTradingFeesWs() is not supported yet');
4649
+ }
4617
4650
  async fetchTradingFee(symbol, params = {}) {
4618
4651
  if (!this.has['fetchTradingFees']) {
4619
4652
  throw new errors.NotSupported(this.id + ' fetchTradingFee() is not supported yet');
@@ -1,17 +1,19 @@
1
1
  'use strict';
2
2
 
3
+ var WebSocket = require('ws');
3
4
  var Client = require('./Client.js');
4
5
  var platform = require('../functions/platform.js');
5
6
  require('../functions/encode.js');
6
7
  require('../functions/crypto.js');
7
8
  var time = require('../functions/time.js');
8
- var WebSocket = require('ws');
9
9
  var Future = require('./Future.js');
10
10
 
11
11
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
12
 
13
13
  var WebSocket__default = /*#__PURE__*/_interopDefaultLegacy(WebSocket);
14
14
 
15
+ // eslint-disable-next-line no-shadow
16
+ // eslint-disable-next-line no-restricted-globals
15
17
  const WebSocketPlatform = platform.isNode ? WebSocket__default["default"] : self.WebSocket;
16
18
  class WsClient extends Client {
17
19
  createConnection() {
@@ -43,6 +43,7 @@ class bigone extends bigone$1 {
43
43
  'fetchCurrencies': true,
44
44
  'fetchDepositAddress': true,
45
45
  'fetchDeposits': true,
46
+ 'fetchFundingRate': false,
46
47
  'fetchMarkets': true,
47
48
  'fetchMyTrades': true,
48
49
  'fetchOHLCV': true,
@@ -308,6 +308,7 @@ class binance extends binance$1 {
308
308
  'convert/exchangeInfo': 50,
309
309
  'convert/assetInfo': 10,
310
310
  'convert/orderStatus': 0.6667,
311
+ 'convert/limit/queryOpenOrders': 20.001,
311
312
  'account/status': 0.1,
312
313
  'account/apiTradingStatus': 0.1,
313
314
  'account/apiRestrictions/ipRestriction': 0.1,
@@ -579,6 +580,8 @@ class binance extends binance$1 {
579
580
  'loan/vip/repay': 40.002,
580
581
  'convert/getQuote': 1.3334,
581
582
  'convert/acceptQuote': 3.3335,
583
+ 'convert/limit/placeOrder': 3.3335,
584
+ 'convert/limit/cancelOrder': 1.3334,
582
585
  'portfolio/auto-collection': 150,
583
586
  'portfolio/asset-collection': 6,
584
587
  'portfolio/bnb-transfer': 150,
@@ -7965,12 +7968,20 @@ class binance extends binance$1 {
7965
7968
  /**
7966
7969
  * @method
7967
7970
  * @name binance#fetchPositions
7971
+ * @see https://binance-docs.github.io/apidocs/futures/en/#position-information-v2-user_data
7972
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#position-information-user_data
7973
+ * @see https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
7974
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
7975
+ * @see https://binance-docs.github.io/apidocs/voptions/en/#option-position-information-user_data
7968
7976
  * @description fetch all open positions
7969
- * @param {string[]|undefined} symbols list of unified market symbols
7977
+ * @param {string[]} [symbols] list of unified market symbols
7970
7978
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7979
+ * @param {string} [method] method name to call, "positionRisk", "account" or "option", default is "positionRisk"
7971
7980
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
7972
7981
  */
7973
- const defaultMethod = this.safeString(this.options, 'fetchPositions', 'positionRisk');
7982
+ const defaultValue = this.safeString(this.options, 'fetchPositions', 'positionRisk');
7983
+ let defaultMethod = undefined;
7984
+ [defaultMethod, params] = this.handleOptionAndParams(params, 'fetchPositions', 'method', defaultValue);
7974
7985
  if (defaultMethod === 'positionRisk') {
7975
7986
  return await this.fetchPositionsRisk(symbols, params);
7976
7987
  }
@@ -7981,7 +7992,7 @@ class binance extends binance$1 {
7981
7992
  return await this.fetchOptionPositions(symbols, params);
7982
7993
  }
7983
7994
  else {
7984
- throw new errors.NotSupported(this.id + '.options["fetchPositions"] = "' + defaultMethod + '" is invalid, please choose between "account", "positionRisk" and "option"');
7995
+ throw new errors.NotSupported(this.id + '.options["fetchPositions"]/params["method"] = "' + defaultMethod + '" is invalid, please choose between "account", "positionRisk" and "option"');
7985
7996
  }
7986
7997
  }
7987
7998
  async fetchAccountPositions(symbols = undefined, params = {}) {
@@ -37,6 +37,7 @@ class bitget extends bitget$1 {
37
37
  'cancelOrders': true,
38
38
  'closeAllPositions': true,
39
39
  'closePosition': true,
40
+ 'createDepositAddress': false,
40
41
  'createMarketBuyOrderWithCost': true,
41
42
  'createMarketOrderWithCost': false,
42
43
  'createMarketSellOrderWithCost': false,
@@ -46,16 +47,21 @@ class bitget extends bitget$1 {
46
47
  'createReduceOnlyOrder': false,
47
48
  'createStopLossOrder': true,
48
49
  'createTakeProfitOrder': true,
50
+ 'createPostOnlyOrder': true,
51
+ 'createStopOrder': true,
52
+ 'createStopLimitOrder': true,
53
+ 'createStopMarketOrder': true,
49
54
  'createTrailingPercentOrder': true,
50
55
  'createTriggerOrder': true,
56
+ 'signIn': false,
51
57
  'editOrder': true,
52
58
  'fetchAccounts': false,
53
59
  'fetchBalance': true,
54
60
  'fetchBorrowInterest': true,
55
61
  'fetchBorrowRateHistories': false,
56
62
  'fetchBorrowRateHistory': false,
57
- 'fetchCanceledOrders': true,
58
63
  'fetchCanceledAndClosedOrders': true,
64
+ 'fetchCanceledOrders': true,
59
65
  'fetchClosedOrders': true,
60
66
  'fetchCrossBorrowRate': true,
61
67
  'fetchCrossBorrowRates': false,
@@ -65,7 +71,10 @@ class bitget extends bitget$1 {
65
71
  'fetchDeposits': true,
66
72
  'fetchDepositWithdrawFee': 'emulated',
67
73
  'fetchDepositWithdrawFees': true,
74
+ 'fetchDepositsWithdrawals': false,
68
75
  'fetchFundingHistory': true,
76
+ 'fetchWithdrawAddresses': false,
77
+ 'fetchTransactions': false,
69
78
  'fetchFundingRate': true,
70
79
  'fetchFundingRateHistory': true,
71
80
  'fetchFundingRates': false,
@@ -76,7 +85,7 @@ class bitget extends bitget$1 {
76
85
  'fetchLeverage': true,
77
86
  'fetchLeverageTiers': false,
78
87
  'fetchLiquidations': false,
79
- 'fetchMarginMode': undefined,
88
+ 'fetchMarginMode': false,
80
89
  'fetchMarketLeverageTiers': true,
81
90
  'fetchMarkets': true,
82
91
  'fetchMarkOHLCV': true,
@@ -89,6 +98,7 @@ class bitget extends bitget$1 {
89
98
  'fetchOrder': true,
90
99
  'fetchOrderBook': true,
91
100
  'fetchOrders': false,
101
+ 'createTrailingAmountOrder': false,
92
102
  'fetchOrderTrades': false,
93
103
  'fetchPosition': true,
94
104
  'fetchPositionMode': false,
@@ -52,6 +52,7 @@ class bitrue extends bitrue$1 {
52
52
  'fetchDepositsWithdrawals': false,
53
53
  'fetchDepositWithdrawFee': 'emulated',
54
54
  'fetchDepositWithdrawFees': true,
55
+ 'fetchFundingRate': false,
55
56
  'fetchIsolatedBorrowRate': false,
56
57
  'fetchIsolatedBorrowRates': false,
57
58
  'fetchMarginMode': false,