ccxt 4.2.85 → 4.2.86

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.
package/dist/cjs/ccxt.js CHANGED
@@ -182,7 +182,7 @@ var woo$1 = require('./src/pro/woo.js');
182
182
 
183
183
  //-----------------------------------------------------------------------------
184
184
  // this is updated by vss.js when building
185
- const version = '4.2.85';
185
+ const version = '4.2.86';
186
186
  Exchange["default"].ccxtVersion = version;
187
187
  const exchanges = {
188
188
  'ace': ace,
@@ -629,7 +629,7 @@ class bingx extends bingx$1 {
629
629
  symbol += ':' + settle;
630
630
  }
631
631
  const fees = this.safeDict(this.fees, type, {});
632
- const contractSize = this.safeNumber(market, 'size');
632
+ const contractSize = (swap) ? this.parseNumber('1') : undefined;
633
633
  const isActive = this.safeString(market, 'status') === '1';
634
634
  const isInverse = (spot) ? undefined : false;
635
635
  const isLinear = (spot) ? undefined : swap;
@@ -670,7 +670,7 @@ class bingx extends bingx$1 {
670
670
  'max': this.safeInteger(market, 'maxLongLeverage'),
671
671
  },
672
672
  'amount': {
673
- 'min': this.safeNumber(market, 'minQty'),
673
+ 'min': this.safeNumber2(market, 'minQty', 'tradeMinQuantity'),
674
674
  'max': this.safeNumber(market, 'maxQty'),
675
675
  },
676
676
  'price': {
@@ -678,7 +678,7 @@ class bingx extends bingx$1 {
678
678
  'max': undefined,
679
679
  },
680
680
  'cost': {
681
- 'min': this.safeNumber(market, 'minNotional'),
681
+ 'min': this.safeNumber2(market, 'minNotional', 'tradeMinUSDT'),
682
682
  'max': this.safeNumber(market, 'maxNotional'),
683
683
  },
684
684
  },
@@ -1035,6 +1035,13 @@ class bingx extends bingx$1 {
1035
1035
  if (isMaker !== undefined) {
1036
1036
  takeOrMaker = isMaker ? 'maker' : 'taker';
1037
1037
  }
1038
+ let amount = this.safeStringN(trade, ['qty', 'amount', 'q']);
1039
+ if ((market !== undefined) && market['swap'] && ('volume' in trade)) {
1040
+ // private trade returns num of contracts instead of base currency (as the order-related methods do)
1041
+ const contractSize = this.safeString(market['info'], 'tradeMinQuantity');
1042
+ const volume = this.safeString(trade, 'volume');
1043
+ amount = Precise["default"].stringMul(volume, contractSize);
1044
+ }
1038
1045
  return this.safeTrade({
1039
1046
  'id': this.safeStringN(trade, ['id', 't']),
1040
1047
  'info': trade,
@@ -1046,7 +1053,7 @@ class bingx extends bingx$1 {
1046
1053
  'side': this.parseOrderSide(side),
1047
1054
  'takerOrMaker': takeOrMaker,
1048
1055
  'price': this.safeString2(trade, 'price', 'p'),
1049
- 'amount': this.safeStringN(trade, ['qty', 'volume', 'amount', 'q']),
1056
+ 'amount': amount,
1050
1057
  'cost': cost,
1051
1058
  'fee': {
1052
1059
  'cost': this.parseNumber(Precise["default"].stringAbs(this.safeString2(trade, 'commission', 'n'))),
@@ -1678,19 +1685,27 @@ class bingx extends bingx$1 {
1678
1685
  }
1679
1686
  parsePosition(position, market = undefined) {
1680
1687
  //
1681
- // {
1682
- // "symbol": "BTC-USDT",
1683
- // "positionId": "12345678",
1684
- // "positionSide": "LONG",
1685
- // "isolated": true,
1686
- // "positionAmt": "123.33",
1687
- // "availableAmt": "128.99",
1688
- // "unrealizedProfit": "1.22",
1689
- // "realisedProfit": "8.1",
1690
- // "initialMargin": "123.33",
1691
- // "avgPrice": "2.2",
1692
- // "leverage": 10,
1693
- // }
1688
+ // {
1689
+ // "positionId":"1773122376147623936",
1690
+ // "symbol":"XRP-USDT",
1691
+ // "currency":"USDT",
1692
+ // "positionAmt":"3",
1693
+ // "availableAmt":"3",
1694
+ // "positionSide":"LONG",
1695
+ // "isolated":false,
1696
+ // "avgPrice":"0.6139",
1697
+ // "initialMargin":"0.0897",
1698
+ // "leverage":20,
1699
+ // "unrealizedProfit":"-0.0023",
1700
+ // "realisedProfit":"-0.0009",
1701
+ // "liquidationPrice":0,
1702
+ // "pnlRatio":"-0.0260",
1703
+ // "maxMarginReduction":"",
1704
+ // "riskRate":"",
1705
+ // "markPrice":"",
1706
+ // "positionValue":"",
1707
+ // "onlyOnePosition":false
1708
+ // }
1694
1709
  //
1695
1710
  // standard position
1696
1711
  //
@@ -1717,7 +1732,7 @@ class bingx extends bingx$1 {
1717
1732
  'info': position,
1718
1733
  'id': this.safeString(position, 'positionId'),
1719
1734
  'symbol': this.safeSymbol(marketId, market, '-', 'swap'),
1720
- 'notional': this.safeNumber(position, 'positionAmt'),
1735
+ 'notional': this.safeNumber(position, 'positionValue'),
1721
1736
  'marginMode': marginMode,
1722
1737
  'liquidationPrice': undefined,
1723
1738
  'entryPrice': this.safeNumber2(position, 'avgPrice', 'entryPrice'),
@@ -1735,7 +1750,7 @@ class bingx extends bingx$1 {
1735
1750
  'lastUpdateTimestamp': undefined,
1736
1751
  'maintenanceMargin': undefined,
1737
1752
  'maintenanceMarginPercentage': undefined,
1738
- 'collateral': this.safeNumber(position, 'positionAmt'),
1753
+ 'collateral': undefined,
1739
1754
  'initialMargin': this.safeNumber(position, 'initialMargin'),
1740
1755
  'initialMarginPercentage': undefined,
1741
1756
  'leverage': this.safeNumber(position, 'leverage'),
@@ -138,21 +138,23 @@ class bitbank extends bitbank$1 {
138
138
  },
139
139
  'precisionMode': number.TICK_SIZE,
140
140
  'exceptions': {
141
- '20001': errors.AuthenticationError,
142
- '20002': errors.AuthenticationError,
143
- '20003': errors.AuthenticationError,
144
- '20005': errors.AuthenticationError,
145
- '20004': errors.InvalidNonce,
146
- '40020': errors.InvalidOrder,
147
- '40021': errors.InvalidOrder,
148
- '40025': errors.ExchangeError,
149
- '40013': errors.OrderNotFound,
150
- '40014': errors.OrderNotFound,
151
- '50008': errors.PermissionDenied,
152
- '50009': errors.OrderNotFound,
153
- '50010': errors.OrderNotFound,
154
- '60001': errors.InsufficientFunds,
155
- '60005': errors.InvalidOrder,
141
+ 'exact': {
142
+ '20001': errors.AuthenticationError,
143
+ '20002': errors.AuthenticationError,
144
+ '20003': errors.AuthenticationError,
145
+ '20005': errors.AuthenticationError,
146
+ '20004': errors.InvalidNonce,
147
+ '40020': errors.InvalidOrder,
148
+ '40021': errors.InvalidOrder,
149
+ '40025': errors.ExchangeError,
150
+ '40013': errors.OrderNotFound,
151
+ '40014': errors.OrderNotFound,
152
+ '50008': errors.PermissionDenied,
153
+ '50009': errors.OrderNotFound,
154
+ '50010': errors.OrderNotFound,
155
+ '60001': errors.InsufficientFunds,
156
+ '60005': errors.InvalidOrder,
157
+ },
156
158
  },
157
159
  });
158
160
  }
@@ -983,16 +985,10 @@ class bitbank extends bitbank$1 {
983
985
  '70009': 'We are currently temporarily restricting orders to be carried out. Please use the limit order.',
984
986
  '70010': 'We are temporarily raising the minimum order quantity as the system load is now rising.',
985
987
  };
986
- const errorClasses = this.exceptions;
987
988
  const code = this.safeString(data, 'code');
988
989
  const message = this.safeString(errorMessages, code, 'Error');
989
- const ErrorClass = this.safeValue(errorClasses, code);
990
- if (ErrorClass !== undefined) {
991
- throw new errorClasses[code](message);
992
- }
993
- else {
994
- throw new errors.ExchangeError(this.id + ' ' + this.json(response));
995
- }
990
+ this.throwExactlyMatchedException(this.exceptions['exact'], code, message);
991
+ throw new errors.ExchangeError(this.id + ' ' + this.json(response));
996
992
  }
997
993
  return undefined;
998
994
  }