ccxt 4.2.85__py2.py3-none-any.whl → 4.2.86__py2.py3-none-any.whl

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.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

@@ -173,13 +173,15 @@ class idex(Exchange, ImplicitAPI):
173
173
  'network': 'MATIC',
174
174
  },
175
175
  'exceptions': {
176
- 'INVALID_ORDER_QUANTITY': InvalidOrder,
177
- 'INSUFFICIENT_FUNDS': InsufficientFunds,
178
- 'SERVICE_UNAVAILABLE': ExchangeNotAvailable,
179
- 'EXCEEDED_RATE_LIMIT': DDoSProtection,
180
- 'INVALID_PARAMETER': BadRequest,
181
- 'WALLET_NOT_ASSOCIATED': InvalidAddress,
182
- 'INVALID_WALLET_SIGNATURE': AuthenticationError,
176
+ 'exact': {
177
+ 'INVALID_ORDER_QUANTITY': InvalidOrder,
178
+ 'INSUFFICIENT_FUNDS': InsufficientFunds,
179
+ 'SERVICE_UNAVAILABLE': ExchangeNotAvailable,
180
+ 'EXCEEDED_RATE_LIMIT': DDoSProtection,
181
+ 'INVALID_PARAMETER': BadRequest,
182
+ 'WALLET_NOT_ASSOCIATED': InvalidAddress,
183
+ 'INVALID_WALLET_SIGNATURE': AuthenticationError,
184
+ },
183
185
  },
184
186
  'requiredCredentials': {
185
187
  'walletAddress': True,
@@ -1413,10 +1415,8 @@ class idex(Exchange, ImplicitAPI):
1413
1415
  def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
1414
1416
  errorCode = self.safe_string(response, 'code')
1415
1417
  message = self.safe_string(response, 'message')
1416
- if errorCode in self.exceptions:
1417
- Exception = self.exceptions[errorCode]
1418
- raise Exception(self.id + ' ' + message)
1419
1418
  if errorCode is not None:
1419
+ self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, message)
1420
1420
  raise ExchangeError(self.id + ' ' + message)
1421
1421
  return None
1422
1422
 
@@ -1121,8 +1121,9 @@ class okcoin(Exchange, ImplicitAPI):
1121
1121
  request = {
1122
1122
  'instId': market['id'],
1123
1123
  'bar': bar,
1124
- 'limit': limit,
1125
1124
  }
1125
+ if limit is not None:
1126
+ request['limit'] = limit # default 100, max 100
1126
1127
  method = None
1127
1128
  method, params = self.handle_option_and_params(params, 'fetchOHLCV', 'method', 'publicGetMarketCandles')
1128
1129
  response = None
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.85'
7
+ __version__ = '4.2.86'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
ccxt/bingx.py CHANGED
@@ -630,7 +630,7 @@ class bingx(Exchange, ImplicitAPI):
630
630
  if settle is not None:
631
631
  symbol += ':' + settle
632
632
  fees = self.safe_dict(self.fees, type, {})
633
- contractSize = self.safe_number(market, 'size')
633
+ contractSize = self.parse_number('1') if (swap) else None
634
634
  isActive = self.safe_string(market, 'status') == '1'
635
635
  isInverse = None if (spot) else False
636
636
  isLinear = None if (spot) else swap
@@ -671,7 +671,7 @@ class bingx(Exchange, ImplicitAPI):
671
671
  'max': self.safe_integer(market, 'maxLongLeverage'),
672
672
  },
673
673
  'amount': {
674
- 'min': self.safe_number(market, 'minQty'),
674
+ 'min': self.safe_number_2(market, 'minQty', 'tradeMinQuantity'),
675
675
  'max': self.safe_number(market, 'maxQty'),
676
676
  },
677
677
  'price': {
@@ -679,7 +679,7 @@ class bingx(Exchange, ImplicitAPI):
679
679
  'max': None,
680
680
  },
681
681
  'cost': {
682
- 'min': self.safe_number(market, 'minNotional'),
682
+ 'min': self.safe_number_2(market, 'minNotional', 'tradeMinUSDT'),
683
683
  'max': self.safe_number(market, 'maxNotional'),
684
684
  },
685
685
  },
@@ -1009,6 +1009,12 @@ class bingx(Exchange, ImplicitAPI):
1009
1009
  isMaker = self.safe_bool(trade, 'isMaker')
1010
1010
  if isMaker is not None:
1011
1011
  takeOrMaker = 'maker' if isMaker else 'taker'
1012
+ amount = self.safe_string_n(trade, ['qty', 'amount', 'q'])
1013
+ if (market is not None) and market['swap'] and ('volume' in trade):
1014
+ # private trade returns num of contracts instead of base currency(as the order-related methods do)
1015
+ contractSize = self.safe_string(market['info'], 'tradeMinQuantity')
1016
+ volume = self.safe_string(trade, 'volume')
1017
+ amount = Precise.string_mul(volume, contractSize)
1012
1018
  return self.safe_trade({
1013
1019
  'id': self.safe_string_n(trade, ['id', 't']),
1014
1020
  'info': trade,
@@ -1020,7 +1026,7 @@ class bingx(Exchange, ImplicitAPI):
1020
1026
  'side': self.parse_order_side(side),
1021
1027
  'takerOrMaker': takeOrMaker,
1022
1028
  'price': self.safe_string_2(trade, 'price', 'p'),
1023
- 'amount': self.safe_string_n(trade, ['qty', 'volume', 'amount', 'q']),
1029
+ 'amount': amount,
1024
1030
  'cost': cost,
1025
1031
  'fee': {
1026
1032
  'cost': self.parse_number(Precise.string_abs(self.safe_string_2(trade, 'commission', 'n'))),
@@ -1607,19 +1613,27 @@ class bingx(Exchange, ImplicitAPI):
1607
1613
 
1608
1614
  def parse_position(self, position, market: Market = None):
1609
1615
  #
1610
- # {
1611
- # "symbol": "BTC-USDT",
1612
- # "positionId": "12345678",
1613
- # "positionSide": "LONG",
1614
- # "isolated": True,
1615
- # "positionAmt": "123.33",
1616
- # "availableAmt": "128.99",
1617
- # "unrealizedProfit": "1.22",
1618
- # "realisedProfit": "8.1",
1619
- # "initialMargin": "123.33",
1620
- # "avgPrice": "2.2",
1621
- # "leverage": 10,
1622
- # }
1616
+ # {
1617
+ # "positionId":"1773122376147623936",
1618
+ # "symbol":"XRP-USDT",
1619
+ # "currency":"USDT",
1620
+ # "positionAmt":"3",
1621
+ # "availableAmt":"3",
1622
+ # "positionSide":"LONG",
1623
+ # "isolated":false,
1624
+ # "avgPrice":"0.6139",
1625
+ # "initialMargin":"0.0897",
1626
+ # "leverage":20,
1627
+ # "unrealizedProfit":"-0.0023",
1628
+ # "realisedProfit":"-0.0009",
1629
+ # "liquidationPrice":0,
1630
+ # "pnlRatio":"-0.0260",
1631
+ # "maxMarginReduction":"",
1632
+ # "riskRate":"",
1633
+ # "markPrice":"",
1634
+ # "positionValue":"",
1635
+ # "onlyOnePosition":false
1636
+ # }
1623
1637
  #
1624
1638
  # standard position
1625
1639
  #
@@ -1645,7 +1659,7 @@ class bingx(Exchange, ImplicitAPI):
1645
1659
  'info': position,
1646
1660
  'id': self.safe_string(position, 'positionId'),
1647
1661
  'symbol': self.safe_symbol(marketId, market, '-', 'swap'),
1648
- 'notional': self.safe_number(position, 'positionAmt'),
1662
+ 'notional': self.safe_number(position, 'positionValue'),
1649
1663
  'marginMode': marginMode,
1650
1664
  'liquidationPrice': None,
1651
1665
  'entryPrice': self.safe_number_2(position, 'avgPrice', 'entryPrice'),
@@ -1663,7 +1677,7 @@ class bingx(Exchange, ImplicitAPI):
1663
1677
  'lastUpdateTimestamp': None,
1664
1678
  'maintenanceMargin': None,
1665
1679
  'maintenanceMarginPercentage': None,
1666
- 'collateral': self.safe_number(position, 'positionAmt'),
1680
+ 'collateral': None,
1667
1681
  'initialMargin': self.safe_number(position, 'initialMargin'),
1668
1682
  'initialMarginPercentage': None,
1669
1683
  'leverage': self.safe_number(position, 'leverage'),
ccxt/bitbank.py CHANGED
@@ -146,21 +146,23 @@ class bitbank(Exchange, ImplicitAPI):
146
146
  },
147
147
  'precisionMode': TICK_SIZE,
148
148
  'exceptions': {
149
- '20001': AuthenticationError,
150
- '20002': AuthenticationError,
151
- '20003': AuthenticationError,
152
- '20005': AuthenticationError,
153
- '20004': InvalidNonce,
154
- '40020': InvalidOrder,
155
- '40021': InvalidOrder,
156
- '40025': ExchangeError,
157
- '40013': OrderNotFound,
158
- '40014': OrderNotFound,
159
- '50008': PermissionDenied,
160
- '50009': OrderNotFound,
161
- '50010': OrderNotFound,
162
- '60001': InsufficientFunds,
163
- '60005': InvalidOrder,
149
+ 'exact': {
150
+ '20001': AuthenticationError,
151
+ '20002': AuthenticationError,
152
+ '20003': AuthenticationError,
153
+ '20005': AuthenticationError,
154
+ '20004': InvalidNonce,
155
+ '40020': InvalidOrder,
156
+ '40021': InvalidOrder,
157
+ '40025': ExchangeError,
158
+ '40013': OrderNotFound,
159
+ '40014': OrderNotFound,
160
+ '50008': PermissionDenied,
161
+ '50009': OrderNotFound,
162
+ '50010': OrderNotFound,
163
+ '60001': InsufficientFunds,
164
+ '60005': InvalidOrder,
165
+ },
164
166
  },
165
167
  })
166
168
 
@@ -944,12 +946,8 @@ class bitbank(Exchange, ImplicitAPI):
944
946
  '70009': 'We are currently temporarily restricting orders to be carried out. Please use the limit order.',
945
947
  '70010': 'We are temporarily raising the minimum order quantity system load is now rising.',
946
948
  }
947
- errorClasses = self.exceptions
948
949
  code = self.safe_string(data, 'code')
949
950
  message = self.safe_string(errorMessages, code, 'Error')
950
- ErrorClass = self.safe_value(errorClasses, code)
951
- if ErrorClass is not None:
952
- raise errorClasses[code](message)
953
- else:
954
- raise ExchangeError(self.id + ' ' + self.json(response))
951
+ self.throw_exactly_matched_exception(self.exceptions['exact'], code, message)
952
+ raise ExchangeError(self.id + ' ' + self.json(response))
955
953
  return None