ccxt 4.1.16 → 4.1.18

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 (54) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +447 -172
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/ascendex.js +1 -1
  6. package/dist/cjs/src/base/Exchange.js +81 -0
  7. package/dist/cjs/src/base/functions/type.js +1 -1
  8. package/dist/cjs/src/bingx.js +8 -3
  9. package/dist/cjs/src/bit2c.js +4 -4
  10. package/dist/cjs/src/bitget.js +269 -96
  11. package/dist/cjs/src/bitstamp1.js +12 -12
  12. package/dist/cjs/src/bl3p.js +1 -1
  13. package/dist/cjs/src/btcbox.js +4 -4
  14. package/dist/cjs/src/btctradeua.js +17 -17
  15. package/dist/cjs/src/bybit.js +9 -2
  16. package/dist/cjs/src/coincheck.js +5 -5
  17. package/dist/cjs/src/coinspot.js +14 -14
  18. package/dist/cjs/src/gate.js +2 -2
  19. package/dist/cjs/src/kraken.js +1 -1
  20. package/dist/cjs/src/okx.js +12 -3
  21. package/dist/cjs/src/paymium.js +1 -1
  22. package/dist/cjs/src/pro/hollaex.js +1 -1
  23. package/dist/cjs/src/pro/mexc.js +1 -1
  24. package/dist/cjs/src/whitebit.js +1 -1
  25. package/dist/cjs/src/woo.js +1 -1
  26. package/js/ccxt.d.ts +1 -1
  27. package/js/ccxt.js +1 -1
  28. package/js/src/abstract/okex.d.ts +9 -0
  29. package/js/src/abstract/okex5.d.ts +9 -0
  30. package/js/src/abstract/okx.d.ts +9 -0
  31. package/js/src/ascendex.js +1 -1
  32. package/js/src/base/Exchange.d.ts +1 -0
  33. package/js/src/base/Exchange.js +81 -0
  34. package/js/src/base/functions/type.js +1 -1
  35. package/js/src/bingx.js +8 -3
  36. package/js/src/bit2c.js +4 -4
  37. package/js/src/bitget.js +269 -96
  38. package/js/src/bitstamp1.js +12 -12
  39. package/js/src/bl3p.js +1 -1
  40. package/js/src/btcbox.js +4 -4
  41. package/js/src/btctradeua.js +17 -17
  42. package/js/src/bybit.js +9 -2
  43. package/js/src/coincheck.js +5 -5
  44. package/js/src/coinspot.js +14 -14
  45. package/js/src/gate.js +2 -2
  46. package/js/src/kraken.js +1 -1
  47. package/js/src/okx.js +12 -3
  48. package/js/src/paymium.js +1 -1
  49. package/js/src/pro/hollaex.js +1 -1
  50. package/js/src/pro/mexc.js +1 -1
  51. package/js/src/whitebit.js +1 -1
  52. package/js/src/woo.js +1 -1
  53. package/package.json +1 -1
  54. package/skip-tests.json +10 -2
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.16';
183
+ const version = '4.1.18';
184
184
  Exchange["default"].ccxtVersion = version;
185
185
  const exchanges = {
186
186
  'ace': ace,
@@ -2743,7 +2743,7 @@ class ascendex extends ascendex$1 {
2743
2743
  * @param {object} [params] extra parameters specific to the ascendex api endpoint
2744
2744
  * @returns {object} a [margin structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#reduce-margin-structure}
2745
2745
  */
2746
- return await this.modifyMarginHelper(symbol, amount, 'reduce', params);
2746
+ return await this.modifyMarginHelper(symbol, -amount, 'reduce', params);
2747
2747
  }
2748
2748
  async addMargin(symbol, amount, params = {}) {
2749
2749
  /**
@@ -1522,6 +1522,87 @@ class Exchange {
1522
1522
  },
1523
1523
  }, currency);
1524
1524
  }
1525
+ safeMarketStructure(market = undefined) {
1526
+ const cleanStructure = {
1527
+ 'id': undefined,
1528
+ 'lowercaseId': undefined,
1529
+ 'symbol': undefined,
1530
+ 'base': undefined,
1531
+ 'quote': undefined,
1532
+ 'settle': undefined,
1533
+ 'baseId': undefined,
1534
+ 'quoteId': undefined,
1535
+ 'settleId': undefined,
1536
+ 'type': undefined,
1537
+ 'spot': undefined,
1538
+ 'margin': undefined,
1539
+ 'swap': undefined,
1540
+ 'future': undefined,
1541
+ 'option': undefined,
1542
+ 'index': undefined,
1543
+ 'active': undefined,
1544
+ 'contract': undefined,
1545
+ 'linear': undefined,
1546
+ 'inverse': undefined,
1547
+ 'taker': undefined,
1548
+ 'maker': undefined,
1549
+ 'contractSize': undefined,
1550
+ 'expiry': undefined,
1551
+ 'expiryDatetime': undefined,
1552
+ 'strike': undefined,
1553
+ 'optionType': undefined,
1554
+ 'precision': {
1555
+ 'amount': undefined,
1556
+ 'price': undefined,
1557
+ 'cost': undefined,
1558
+ 'base': undefined,
1559
+ 'quote': undefined,
1560
+ },
1561
+ 'limits': {
1562
+ 'leverage': {
1563
+ 'min': undefined,
1564
+ 'max': undefined,
1565
+ },
1566
+ 'amount': {
1567
+ 'min': undefined,
1568
+ 'max': undefined,
1569
+ },
1570
+ 'price': {
1571
+ 'min': undefined,
1572
+ 'max': undefined,
1573
+ },
1574
+ 'cost': {
1575
+ 'min': undefined,
1576
+ 'max': undefined,
1577
+ },
1578
+ },
1579
+ 'created': undefined,
1580
+ 'info': undefined,
1581
+ };
1582
+ if (market !== undefined) {
1583
+ const result = this.extend(cleanStructure, market);
1584
+ // set undefined swap/future/etc
1585
+ if (result['spot']) {
1586
+ if (result['contract'] === undefined) {
1587
+ result['contract'] = false;
1588
+ }
1589
+ if (result['swap'] === undefined) {
1590
+ result['swap'] = false;
1591
+ }
1592
+ if (result['future'] === undefined) {
1593
+ result['future'] = false;
1594
+ }
1595
+ if (result['option'] === undefined) {
1596
+ result['option'] = false;
1597
+ }
1598
+ if (result['index'] === undefined) {
1599
+ result['index'] = false;
1600
+ }
1601
+ }
1602
+ return result;
1603
+ }
1604
+ return cleanStructure;
1605
+ }
1525
1606
  setMarkets(markets, currencies = undefined) {
1526
1607
  const values = [];
1527
1608
  this.markets_by_id = {};
@@ -35,7 +35,7 @@ const safeInteger = (o, k, $default) => {
35
35
  return isNumber(n) ? n : $default;
36
36
  };
37
37
  const safeIntegerProduct = (o, k, $factor, $default) => {
38
- const n = asInteger(prop(o, k));
38
+ const n = asFloat(prop(o, k));
39
39
  return isNumber(n) ? parseInt(n * $factor) : $default;
40
40
  };
41
41
  const safeTimestamp = (o, k, $default) => {
@@ -880,14 +880,19 @@ class bingx extends bingx$1 {
880
880
  if (time === 0) {
881
881
  time = undefined;
882
882
  }
883
- const isBuyerMaker = this.safeValue2(trade, 'buyerMaker', 'isBuyerMaker');
884
- const side = this.safeStringLower2(trade, 'side', 'S');
885
883
  const cost = this.safeString(trade, 'quoteQty');
886
884
  const type = (cost === undefined) ? 'spot' : 'swap';
887
885
  const currencyId = this.safeString2(trade, 'currency', 'N');
888
886
  const currencyCode = this.safeCurrencyCode(currencyId);
889
887
  const m = this.safeValue(trade, 'm', false);
890
888
  const marketId = this.safeString(trade, 's');
889
+ const isBuyerMaker = this.safeValue2(trade, 'buyerMaker', 'isBuyerMaker');
890
+ let takeOrMaker = (isBuyerMaker || m) ? 'maker' : 'taker';
891
+ let side = this.safeStringLower2(trade, 'side', 'S');
892
+ if (side === undefined) {
893
+ side = (isBuyerMaker || m) ? 'sell' : 'buy';
894
+ takeOrMaker = 'taker';
895
+ }
891
896
  return this.safeTrade({
892
897
  'id': this.safeStringN(trade, ['id', 't']),
893
898
  'info': trade,
@@ -897,7 +902,7 @@ class bingx extends bingx$1 {
897
902
  'order': this.safeString2(trade, 'orderId', 'i'),
898
903
  'type': this.safeStringLower(trade, 'o'),
899
904
  'side': this.parseOrderSide(side),
900
- 'takerOrMaker': (isBuyerMaker || m) ? 'maker' : 'taker',
905
+ 'takerOrMaker': takeOrMaker,
901
906
  'price': this.safeString2(trade, 'price', 'p'),
902
907
  'amount': this.safeStringN(trade, ['qty', 'amount', 'q']),
903
908
  'cost': cost,
@@ -118,10 +118,10 @@ class bit2c extends bit2c$1 {
118
118
  },
119
119
  },
120
120
  'markets': {
121
- 'BTC/NIS': { 'id': 'BtcNis', 'symbol': 'BTC/NIS', 'base': 'BTC', 'quote': 'NIS', 'baseId': 'Btc', 'quoteId': 'Nis', 'type': 'spot', 'spot': true },
122
- 'ETH/NIS': { 'id': 'EthNis', 'symbol': 'ETH/NIS', 'base': 'ETH', 'quote': 'NIS', 'baseId': 'Eth', 'quoteId': 'Nis', 'type': 'spot', 'spot': true },
123
- 'LTC/NIS': { 'id': 'LtcNis', 'symbol': 'LTC/NIS', 'base': 'LTC', 'quote': 'NIS', 'baseId': 'Ltc', 'quoteId': 'Nis', 'type': 'spot', 'spot': true },
124
- 'USDC/NIS': { 'id': 'UsdcNis', 'symbol': 'USDC/NIS', 'base': 'USDC', 'quote': 'NIS', 'baseId': 'Usdc', 'quoteId': 'Nis', 'type': 'spot', 'spot': true },
121
+ 'BTC/NIS': this.safeMarketStructure({ 'id': 'BtcNis', 'symbol': 'BTC/NIS', 'base': 'BTC', 'quote': 'NIS', 'baseId': 'Btc', 'quoteId': 'Nis', 'type': 'spot', 'spot': true }),
122
+ 'ETH/NIS': this.safeMarketStructure({ 'id': 'EthNis', 'symbol': 'ETH/NIS', 'base': 'ETH', 'quote': 'NIS', 'baseId': 'Eth', 'quoteId': 'Nis', 'type': 'spot', 'spot': true }),
123
+ 'LTC/NIS': this.safeMarketStructure({ 'id': 'LtcNis', 'symbol': 'LTC/NIS', 'base': 'LTC', 'quote': 'NIS', 'baseId': 'Ltc', 'quoteId': 'Nis', 'type': 'spot', 'spot': true }),
124
+ 'USDC/NIS': this.safeMarketStructure({ 'id': 'UsdcNis', 'symbol': 'USDC/NIS', 'base': 'USDC', 'quote': 'NIS', 'baseId': 'Usdc', 'quoteId': 'Nis', 'type': 'spot', 'spot': true }),
125
125
  },
126
126
  'fees': {
127
127
  'trading': {