ccxt 4.2.44 → 4.2.46

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 (92) hide show
  1. package/CHANGELOG.md +3099 -8415
  2. package/README.md +4 -4
  3. package/change.sh +4 -2
  4. package/dist/ccxt.browser.js +1242 -195
  5. package/dist/ccxt.browser.min.js +7 -7
  6. package/dist/cjs/ccxt.js +1 -1
  7. package/dist/cjs/src/base/Exchange.js +48 -0
  8. package/dist/cjs/src/base/ws/Cache.js +13 -5
  9. package/dist/cjs/src/base/ws/OrderBook.js +2 -2
  10. package/dist/cjs/src/binance.js +407 -21
  11. package/dist/cjs/src/bingx.js +43 -5
  12. package/dist/cjs/src/bitfinex2.js +1 -0
  13. package/dist/cjs/src/bithumb.js +5 -0
  14. package/dist/cjs/src/bitstamp.js +1 -1
  15. package/dist/cjs/src/btcturk.js +11 -0
  16. package/dist/cjs/src/bybit.js +96 -43
  17. package/dist/cjs/src/coinbase.js +228 -38
  18. package/dist/cjs/src/coincheck.js +11 -0
  19. package/dist/cjs/src/coinmate.js +114 -1
  20. package/dist/cjs/src/coinspot.js +7 -0
  21. package/dist/cjs/src/cryptocom.js +2 -2
  22. package/dist/cjs/src/deribit.js +1 -1
  23. package/dist/cjs/src/hitbtc.js +2 -0
  24. package/dist/cjs/src/idex.js +60 -1
  25. package/dist/cjs/src/latoken.js +3 -0
  26. package/dist/cjs/src/mercado.js +3 -0
  27. package/dist/cjs/src/oceanex.js +3 -0
  28. package/dist/cjs/src/okx.js +1 -0
  29. package/dist/cjs/src/pro/bitget.js +12 -8
  30. package/dist/cjs/src/pro/bitmart.js +11 -11
  31. package/dist/cjs/src/pro/bitmex.js +4 -4
  32. package/dist/cjs/src/pro/cex.js +2 -2
  33. package/dist/cjs/src/pro/gate.js +76 -42
  34. package/dist/cjs/src/pro/gemini.js +4 -3
  35. package/dist/cjs/src/pro/hitbtc.js +1 -0
  36. package/dist/cjs/src/probit.js +3 -3
  37. package/dist/cjs/src/timex.js +65 -0
  38. package/js/ccxt.d.ts +1 -1
  39. package/js/ccxt.js +1 -1
  40. package/js/src/abstract/bequant.d.ts +2 -0
  41. package/js/src/abstract/bitcoincom.d.ts +2 -0
  42. package/js/src/abstract/bithumb.d.ts +5 -0
  43. package/js/src/abstract/coinbase.d.ts +1 -0
  44. package/js/src/abstract/coinmate.d.ts +12 -0
  45. package/js/src/abstract/fmfwio.d.ts +2 -0
  46. package/js/src/abstract/hitbtc.d.ts +2 -0
  47. package/js/src/abstract/hitbtc3.d.ts +2 -0
  48. package/js/src/abstract/okx.d.ts +1 -0
  49. package/js/src/base/Exchange.d.ts +12 -6
  50. package/js/src/base/Exchange.js +48 -0
  51. package/js/src/base/ws/Cache.d.ts +5 -1
  52. package/js/src/base/ws/Cache.js +13 -5
  53. package/js/src/base/ws/OrderBook.d.ts +5 -1
  54. package/js/src/base/ws/OrderBook.js +3 -3
  55. package/js/src/binance.d.ts +2 -1
  56. package/js/src/binance.js +407 -21
  57. package/js/src/bingx.d.ts +2 -1
  58. package/js/src/bingx.js +43 -5
  59. package/js/src/bitfinex2.js +1 -0
  60. package/js/src/bithumb.js +5 -0
  61. package/js/src/bitstamp.js +1 -1
  62. package/js/src/btcturk.js +11 -0
  63. package/js/src/bybit.d.ts +4 -1
  64. package/js/src/bybit.js +96 -43
  65. package/js/src/coinbase.d.ts +10 -4
  66. package/js/src/coinbase.js +228 -38
  67. package/js/src/coincheck.js +11 -0
  68. package/js/src/coinmate.d.ts +3 -1
  69. package/js/src/coinmate.js +114 -1
  70. package/js/src/coinspot.js +7 -0
  71. package/js/src/cryptocom.js +2 -2
  72. package/js/src/deribit.js +1 -1
  73. package/js/src/hitbtc.js +2 -0
  74. package/js/src/idex.d.ts +14 -0
  75. package/js/src/idex.js +60 -1
  76. package/js/src/latoken.js +3 -0
  77. package/js/src/mercado.js +3 -0
  78. package/js/src/oceanex.js +3 -0
  79. package/js/src/okx.js +1 -0
  80. package/js/src/pro/bitget.js +12 -8
  81. package/js/src/pro/bitmart.js +11 -11
  82. package/js/src/pro/bitmex.js +4 -4
  83. package/js/src/pro/cex.js +2 -2
  84. package/js/src/pro/gate.d.ts +4 -0
  85. package/js/src/pro/gate.js +76 -42
  86. package/js/src/pro/gemini.js +4 -3
  87. package/js/src/pro/hitbtc.js +1 -0
  88. package/js/src/probit.js +3 -3
  89. package/js/src/timex.d.ts +14 -0
  90. package/js/src/timex.js +65 -0
  91. package/package.json +1 -1
  92. package/skip-tests.json +4 -0
package/dist/cjs/ccxt.js CHANGED
@@ -177,7 +177,7 @@ var woo$1 = require('./src/pro/woo.js');
177
177
 
178
178
  //-----------------------------------------------------------------------------
179
179
  // this is updated by vss.js when building
180
- const version = '4.2.44';
180
+ const version = '4.2.46';
181
181
  Exchange["default"].ccxtVersion = version;
182
182
  const exchanges = {
183
183
  'ace': ace,
@@ -71,6 +71,7 @@ class Exchange {
71
71
  this.balance = {};
72
72
  this.orderbooks = {};
73
73
  this.tickers = {};
74
+ this.bidsasks = {};
74
75
  this.orders = undefined;
75
76
  this.triggerOrders = undefined;
76
77
  this.transactions = {};
@@ -3430,12 +3431,46 @@ class Exchange {
3430
3431
  const market = this.market(symbol);
3431
3432
  return this.safeString(market, 'symbol', symbol);
3432
3433
  }
3434
+ handleParamString(params, paramName, defaultValue = undefined) {
3435
+ const value = this.safeString(params, paramName, defaultValue);
3436
+ if (value !== undefined) {
3437
+ params = this.omit(params, paramName);
3438
+ }
3439
+ return [value, params];
3440
+ }
3433
3441
  resolvePath(path, params) {
3434
3442
  return [
3435
3443
  this.implodeParams(path, params),
3436
3444
  this.omit(params, this.extractParams(path)),
3437
3445
  ];
3438
3446
  }
3447
+ getListFromObjectValues(objects, key) {
3448
+ const newArray = this.toArray(objects);
3449
+ const results = [];
3450
+ for (let i = 0; i < newArray.length; i++) {
3451
+ results.push(newArray[i][key]);
3452
+ }
3453
+ return results;
3454
+ }
3455
+ getSymbolsForMarketType(marketType = undefined, subType = undefined, symbolWithActiveStatus = true, symbolWithUnknownStatus = true) {
3456
+ let filteredMarkets = this.markets;
3457
+ if (marketType !== undefined) {
3458
+ filteredMarkets = this.filterBy(filteredMarkets, 'type', marketType);
3459
+ }
3460
+ if (subType !== undefined) {
3461
+ this.checkRequiredArgument('getSymbolsForMarketType', subType, 'subType', ['linear', 'inverse', 'quanto']);
3462
+ filteredMarkets = this.filterBy(filteredMarkets, 'subType', subType);
3463
+ }
3464
+ const activeStatuses = [];
3465
+ if (symbolWithActiveStatus) {
3466
+ activeStatuses.push(true);
3467
+ }
3468
+ if (symbolWithUnknownStatus) {
3469
+ activeStatuses.push(undefined);
3470
+ }
3471
+ filteredMarkets = this.filterByArray(filteredMarkets, 'active', activeStatuses, false);
3472
+ return this.getListFromObjectValues(filteredMarkets, 'symbol');
3473
+ }
3439
3474
  filterByArray(objects, key, values = undefined, indexed = true) {
3440
3475
  objects = this.toArray(objects);
3441
3476
  // return all of them if no values were passed
@@ -4361,6 +4396,19 @@ class Exchange {
4361
4396
  return depositAddress;
4362
4397
  }
4363
4398
  }
4399
+ else if (this.has['fetchDepositAddressesByNetwork']) {
4400
+ const network = this.safeString(params, 'network');
4401
+ params = this.omit(params, 'network');
4402
+ const addressStructures = await this.fetchDepositAddressesByNetwork(code, params);
4403
+ if (network !== undefined) {
4404
+ return this.safeDict(addressStructures, network);
4405
+ }
4406
+ else {
4407
+ const keys = Object.keys(addressStructures);
4408
+ const key = this.safeString(keys, 0);
4409
+ return this.safeDict(addressStructures, key);
4410
+ }
4411
+ }
4364
4412
  else {
4365
4413
  throw new errors.NotSupported(this.id + ' fetchDepositAddress() is not supported yet');
4366
4414
  }
@@ -20,6 +20,7 @@ class BaseCache extends Array {
20
20
  class ArrayCache extends BaseCache {
21
21
  constructor(maxSize = undefined) {
22
22
  super(maxSize);
23
+ this.hashmap = {};
23
24
  Object.defineProperty(this, 'nestedNewUpdatesBySymbol', {
24
25
  __proto__: null,
25
26
  value: false,
@@ -45,6 +46,12 @@ class ArrayCache extends BaseCache {
45
46
  value: false,
46
47
  writable: true,
47
48
  });
49
+ Object.defineProperty(this, 'hashmap', {
50
+ __proto__: null,
51
+ value: {},
52
+ writable: true,
53
+ enumerable: false,
54
+ });
48
55
  }
49
56
  getLimit(symbol, limit) {
50
57
  let newUpdatesValue = undefined;
@@ -124,6 +131,7 @@ class ArrayCacheByTimestamp extends BaseCache {
124
131
  if (item[0] in this.hashmap) {
125
132
  const reference = this.hashmap[item[0]];
126
133
  if (reference !== item) {
134
+ // eslint-disable-next-line
127
135
  for (const prop in item) {
128
136
  reference[prop] = item[prop];
129
137
  }
@@ -149,11 +157,11 @@ class ArrayCacheBySymbolById extends ArrayCache {
149
157
  constructor(maxSize = undefined) {
150
158
  super(maxSize);
151
159
  this.nestedNewUpdatesBySymbol = true;
152
- Object.defineProperty(this, 'hashmap', {
153
- __proto__: null,
154
- value: {},
155
- writable: true,
156
- });
160
+ // Object.defineProperty (this, 'hashmap', {
161
+ // __proto__: null, // make it invisible
162
+ // value: {},
163
+ // writable: true,
164
+ // })
157
165
  }
158
166
  append(item) {
159
167
  const byId = this.hashmap[item.symbol] = this.hashmap[item.symbol] || {};
@@ -7,14 +7,14 @@ var generic = require('../functions/generic.js');
7
7
  var OrderBookSide = require('./OrderBookSide.js');
8
8
 
9
9
  /* eslint-disable max-classes-per-file */
10
- // ----------------------------------------------------------------------------
11
- // overwrites absolute volumes at price levels
12
10
  class OrderBook {
13
11
  constructor(snapshot = {}, depth = undefined) {
12
+ this.cache = []; // make prop visible so we use typed OrderBooks
14
13
  Object.defineProperty(this, 'cache', {
15
14
  __proto__: null,
16
15
  value: [],
17
16
  writable: true,
17
+ enumerable: false,
18
18
  });
19
19
  depth = depth || Number.MAX_SAFE_INTEGER;
20
20
  const defaults = {