ccxt 4.3.84__py2.py3-none-any.whl → 4.3.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.
Files changed (51) hide show
  1. ccxt/__init__.py +4 -1
  2. ccxt/abstract/cryptocom.py +2 -0
  3. ccxt/abstract/hashkey.py +67 -0
  4. ccxt/abstract/kucoinfutures.py +2 -0
  5. ccxt/async_support/__init__.py +4 -1
  6. ccxt/async_support/base/exchange.py +2 -2
  7. ccxt/async_support/binance.py +4 -2
  8. ccxt/async_support/bitfinex.py +2 -2
  9. ccxt/async_support/bitmex.py +2 -0
  10. ccxt/async_support/bybit.py +16 -14
  11. ccxt/async_support/cryptocom.py +113 -3
  12. ccxt/async_support/hashkey.py +4062 -0
  13. ccxt/async_support/hyperliquid.py +80 -62
  14. ccxt/async_support/indodax.py +29 -8
  15. ccxt/async_support/kraken.py +28 -1
  16. ccxt/async_support/krakenfutures.py +10 -9
  17. ccxt/async_support/kucoinfutures.py +5 -0
  18. ccxt/async_support/mexc.py +2 -2
  19. ccxt/base/errors.py +6 -0
  20. ccxt/base/exchange.py +2 -2
  21. ccxt/binance.py +4 -2
  22. ccxt/bitfinex.py +2 -2
  23. ccxt/bitmex.py +2 -0
  24. ccxt/bybit.py +16 -14
  25. ccxt/cryptocom.py +113 -3
  26. ccxt/hashkey.py +4062 -0
  27. ccxt/hyperliquid.py +80 -62
  28. ccxt/indodax.py +29 -8
  29. ccxt/kraken.py +28 -1
  30. ccxt/krakenfutures.py +10 -9
  31. ccxt/kucoinfutures.py +5 -0
  32. ccxt/mexc.py +2 -2
  33. ccxt/pro/__init__.py +3 -1
  34. ccxt/pro/ascendex.py +41 -5
  35. ccxt/pro/binance.py +1 -1
  36. ccxt/pro/bingx.py +13 -12
  37. ccxt/pro/bitget.py +104 -4
  38. ccxt/pro/hashkey.py +783 -0
  39. ccxt/pro/hyperliquid.py +118 -1
  40. ccxt/pro/mexc.py +13 -7
  41. ccxt/pro/okx.py +21 -3
  42. ccxt/pro/woo.py +1 -0
  43. ccxt/pro/woofipro.py +1 -0
  44. ccxt/pro/xt.py +1 -0
  45. ccxt/test/tests_async.py +13 -30
  46. ccxt/test/tests_sync.py +13 -30
  47. {ccxt-4.3.84.dist-info → ccxt-4.3.86.dist-info}/METADATA +8 -6
  48. {ccxt-4.3.84.dist-info → ccxt-4.3.86.dist-info}/RECORD +51 -47
  49. {ccxt-4.3.84.dist-info → ccxt-4.3.86.dist-info}/LICENSE.txt +0 -0
  50. {ccxt-4.3.84.dist-info → ccxt-4.3.86.dist-info}/WHEEL +0 -0
  51. {ccxt-4.3.84.dist-info → ccxt-4.3.86.dist-info}/top_level.txt +0 -0
@@ -1067,24 +1067,9 @@ class hyperliquid(Exchange, ImplicitAPI):
1067
1067
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1068
1068
  """
1069
1069
  await self.load_markets()
1070
- market = self.market(symbol)
1071
- vaultAddress = self.safe_string(params, 'vaultAddress')
1072
- params = self.omit(params, 'vaultAddress')
1073
- symbol = market['symbol']
1074
- order = {
1075
- 'symbol': symbol,
1076
- 'type': type,
1077
- 'side': side,
1078
- 'amount': amount,
1079
- 'price': price,
1080
- 'params': params,
1081
- }
1082
- globalParams: dict = {}
1083
- if vaultAddress is not None:
1084
- globalParams['vaultAddress'] = vaultAddress
1085
- response = await self.create_orders([order], globalParams)
1086
- first = self.safe_dict(response, 0)
1087
- return first
1070
+ order, globalParams = self.parse_create_order_args(symbol, type, side, amount, price, params)
1071
+ orders = await self.create_orders([order], globalParams)
1072
+ return orders[0]
1088
1073
 
1089
1074
  async def create_orders(self, orders: List[OrderRequest], params={}):
1090
1075
  """
@@ -1093,8 +1078,39 @@ class hyperliquid(Exchange, ImplicitAPI):
1093
1078
  :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
1094
1079
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1095
1080
  """
1096
- self.check_required_credentials()
1097
1081
  await self.load_markets()
1082
+ request = self.create_orders_request(orders, params)
1083
+ response = await self.privatePostExchange(request)
1084
+ #
1085
+ # {
1086
+ # "status": "ok",
1087
+ # "response": {
1088
+ # "type": "order",
1089
+ # "data": {
1090
+ # "statuses": [
1091
+ # {
1092
+ # "resting": {
1093
+ # "oid": 5063830287
1094
+ # }
1095
+ # }
1096
+ # ]
1097
+ # }
1098
+ # }
1099
+ # }
1100
+ #
1101
+ responseObj = self.safe_dict(response, 'response', {})
1102
+ data = self.safe_dict(responseObj, 'data', {})
1103
+ statuses = self.safe_list(data, 'statuses', [])
1104
+ return self.parse_orders(statuses, None)
1105
+
1106
+ def create_orders_request(self, orders, params={}) -> dict:
1107
+ """
1108
+ create a list of trade orders
1109
+ :see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
1110
+ :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
1111
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1112
+ """
1113
+ self.check_required_credentials()
1098
1114
  defaultSlippage = self.safe_string(self.options, 'defaultSlippage')
1099
1115
  defaultSlippage = self.safe_string(params, 'slippage', defaultSlippage)
1100
1116
  hasClientOrderId = False
@@ -1197,28 +1213,7 @@ class hyperliquid(Exchange, ImplicitAPI):
1197
1213
  if vaultAddress is not None:
1198
1214
  params = self.omit(params, 'vaultAddress')
1199
1215
  request['vaultAddress'] = vaultAddress
1200
- response = await self.privatePostExchange(request)
1201
- #
1202
- # {
1203
- # "status": "ok",
1204
- # "response": {
1205
- # "type": "order",
1206
- # "data": {
1207
- # "statuses": [
1208
- # {
1209
- # "resting": {
1210
- # "oid": 5063830287
1211
- # }
1212
- # }
1213
- # ]
1214
- # }
1215
- # }
1216
- # }
1217
- #
1218
- responseObj = self.safe_dict(response, 'response', {})
1219
- data = self.safe_dict(responseObj, 'data', {})
1220
- statuses = self.safe_list(data, 'statuses', [])
1221
- return self.parse_orders(statuses, None)
1216
+ return request
1222
1217
 
1223
1218
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
1224
1219
  """
@@ -1417,30 +1412,10 @@ class hyperliquid(Exchange, ImplicitAPI):
1417
1412
  #
1418
1413
  return response
1419
1414
 
1420
- async def edit_order(self, id: str, symbol: str, type: str, side: str, amount: Num = None, price: Num = None, params={}):
1421
- """
1422
- edit a trade order
1423
- :see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
1424
- :see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
1425
- :param str id: cancel order id
1426
- :param str symbol: unified symbol of the market to create an order in
1427
- :param str type: 'market' or 'limit'
1428
- :param str side: 'buy' or 'sell'
1429
- :param float amount: how much of currency you want to trade in units of base currency
1430
- :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1431
- :param dict [params]: extra parameters specific to the exchange API endpoint
1432
- :param str [params.timeInForce]: 'Gtc', 'Ioc', 'Alo'
1433
- :param bool [params.postOnly]: True or False whether the order is post-only
1434
- :param bool [params.reduceOnly]: True or False whether the order is reduce-only
1435
- :param float [params.triggerPrice]: The price at which a trigger order is triggered at
1436
- :param str [params.clientOrderId]: client order id,(optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
1437
- :param str [params.vaultAddress]: the vault address for order
1438
- :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1439
- """
1415
+ def edit_order_request(self, id: str, symbol: str, type: str, side: str, amount: Num = None, price: Num = None, params={}):
1440
1416
  self.check_required_credentials()
1441
1417
  if id is None:
1442
1418
  raise ArgumentsRequired(self.id + ' editOrder() requires an id argument')
1443
- await self.load_markets()
1444
1419
  market = self.market(symbol)
1445
1420
  type = type.upper()
1446
1421
  isMarket = (type == 'MARKET')
@@ -1517,6 +1492,31 @@ class hyperliquid(Exchange, ImplicitAPI):
1517
1492
  if vaultAddress is not None:
1518
1493
  params = self.omit(params, 'vaultAddress')
1519
1494
  request['vaultAddress'] = vaultAddress
1495
+ return request
1496
+
1497
+ async def edit_order(self, id: str, symbol: str, type: str, side: str, amount: Num = None, price: Num = None, params={}):
1498
+ """
1499
+ edit a trade order
1500
+ :see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
1501
+ :see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
1502
+ :param str id: cancel order id
1503
+ :param str symbol: unified symbol of the market to create an order in
1504
+ :param str type: 'market' or 'limit'
1505
+ :param str side: 'buy' or 'sell'
1506
+ :param float amount: how much of currency you want to trade in units of base currency
1507
+ :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1508
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1509
+ :param str [params.timeInForce]: 'Gtc', 'Ioc', 'Alo'
1510
+ :param bool [params.postOnly]: True or False whether the order is post-only
1511
+ :param bool [params.reduceOnly]: True or False whether the order is reduce-only
1512
+ :param float [params.triggerPrice]: The price at which a trigger order is triggered at
1513
+ :param str [params.clientOrderId]: client order id,(optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
1514
+ :param str [params.vaultAddress]: the vault address for order
1515
+ :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1516
+ """
1517
+ await self.load_markets()
1518
+ market = self.market(symbol)
1519
+ request = self.edit_order_request(id, symbol, type, side, amount, price, params)
1520
1520
  response = await self.privatePostExchange(request)
1521
1521
  #
1522
1522
  # {
@@ -2605,3 +2605,21 @@ class hyperliquid(Exchange, ImplicitAPI):
2605
2605
  }
2606
2606
  body = self.json(params)
2607
2607
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
2608
+
2609
+ def parse_create_order_args(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
2610
+ market = self.market(symbol)
2611
+ vaultAddress = self.safe_string(params, 'vaultAddress')
2612
+ params = self.omit(params, 'vaultAddress')
2613
+ symbol = market['symbol']
2614
+ order = {
2615
+ 'symbol': symbol,
2616
+ 'type': type,
2617
+ 'side': side,
2618
+ 'amount': amount,
2619
+ 'price': price,
2620
+ 'params': params,
2621
+ }
2622
+ globalParams = {}
2623
+ if vaultAddress is not None:
2624
+ globalParams['vaultAddress'] = vaultAddress
2625
+ return [order, globalParams]
@@ -17,6 +17,7 @@ from ccxt.base.errors import InsufficientFunds
17
17
  from ccxt.base.errors import InvalidOrder
18
18
  from ccxt.base.errors import OrderNotFound
19
19
  from ccxt.base.decimal_to_precision import TICK_SIZE
20
+ from ccxt.base.precise import Precise
20
21
 
21
22
 
22
23
  class indodax(Exchange, ImplicitAPI):
@@ -801,8 +802,6 @@ class indodax(Exchange, ImplicitAPI):
801
802
  :param dict [params]: extra parameters specific to the exchange API endpoint
802
803
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
803
804
  """
804
- if type != 'limit':
805
- raise ExchangeError(self.id + ' createOrder() allows limit orders only')
806
805
  await self.load_markets()
807
806
  market = self.market(symbol)
808
807
  request: dict = {
@@ -810,12 +809,34 @@ class indodax(Exchange, ImplicitAPI):
810
809
  'type': side,
811
810
  'price': price,
812
811
  }
813
- currency = market['baseId']
814
- if side == 'buy':
815
- request[market['quoteId']] = amount * price
816
- else:
817
- request[market['baseId']] = amount
818
- request[currency] = amount
812
+ priceIsRequired = False
813
+ quantityIsRequired = False
814
+ if type == 'market':
815
+ if side == 'buy':
816
+ quoteAmount = None
817
+ cost = self.safe_number(params, 'cost')
818
+ params = self.omit(params, 'cost')
819
+ if cost is not None:
820
+ quoteAmount = self.cost_to_precision(symbol, cost)
821
+ else:
822
+ if price is None:
823
+ raise InvalidOrder(self.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend(amount * price).')
824
+ amountString = self.number_to_string(amount)
825
+ priceString = self.number_to_string(price)
826
+ costRequest = Precise.string_mul(amountString, priceString)
827
+ quoteAmount = self.cost_to_precision(symbol, costRequest)
828
+ request[market['quoteId']] = quoteAmount
829
+ else:
830
+ quantityIsRequired = True
831
+ elif type == 'limit':
832
+ priceIsRequired = True
833
+ quantityIsRequired = True
834
+ if priceIsRequired:
835
+ if price is None:
836
+ raise InvalidOrder(self.id + ' createOrder() requires a price argument for a ' + type + ' order')
837
+ request['price'] = price
838
+ if quantityIsRequired:
839
+ request[market['baseId']] = self.amount_to_precision(symbol, amount)
819
840
  result = await self.privatePostTrade(self.extend(request, params))
820
841
  data = self.safe_value(result, 'return', {})
821
842
  id = self.safe_string(data, 'order_id')
@@ -1181,6 +1181,26 @@ class kraken(Exchange, ImplicitAPI):
1181
1181
  # "misc": ''
1182
1182
  # }
1183
1183
  #
1184
+ # fetchMyTrades
1185
+ #
1186
+ # {
1187
+ # "ordertxid": "OSJVN7-A2AE-63WZV",
1188
+ # "postxid": "TBP7O6-PNXI-CONU",
1189
+ # "pair": "XXBTZUSD",
1190
+ # "time": 1710429248.3052235,
1191
+ # "type": "sell",
1192
+ # "ordertype": "liquidation market",
1193
+ # "price": "72026.50000",
1194
+ # "cost": "7.20265",
1195
+ # "fee": "0.01873",
1196
+ # "vol": "0.00010000",
1197
+ # "margin": "1.44053",
1198
+ # "leverage": "5",
1199
+ # "misc": "closing",
1200
+ # "trade_id": 68230622,
1201
+ # "maker": False
1202
+ # }
1203
+ #
1184
1204
  timestamp = None
1185
1205
  side = None
1186
1206
  type = None
@@ -1227,6 +1247,10 @@ class kraken(Exchange, ImplicitAPI):
1227
1247
  if market is not None:
1228
1248
  symbol = market['symbol']
1229
1249
  cost = self.safe_string(trade, 'cost')
1250
+ maker = self.safe_bool(trade, 'maker')
1251
+ takerOrMaker = None
1252
+ if maker is not None:
1253
+ takerOrMaker = 'maker' if maker else 'taker'
1230
1254
  return self.safe_trade({
1231
1255
  'id': id,
1232
1256
  'order': orderId,
@@ -1236,7 +1260,7 @@ class kraken(Exchange, ImplicitAPI):
1236
1260
  'symbol': symbol,
1237
1261
  'type': type,
1238
1262
  'side': side,
1239
- 'takerOrMaker': None,
1263
+ 'takerOrMaker': takerOrMaker,
1240
1264
  'price': price,
1241
1265
  'amount': amount,
1242
1266
  'cost': cost,
@@ -2001,7 +2025,10 @@ class kraken(Exchange, ImplicitAPI):
2001
2025
  # "fee": "0.000026",
2002
2026
  # "vol": "16.00000000",
2003
2027
  # "margin": "0.000000",
2028
+ # "leverage": "5",
2004
2029
  # "misc": ""
2030
+ # "trade_id": 68230622,
2031
+ # "maker": False
2005
2032
  # },
2006
2033
  # ...
2007
2034
  # },
@@ -1678,16 +1678,17 @@ class krakenfutures(Exchange, ImplicitAPI):
1678
1678
  executions.append(item)
1679
1679
  # Final order(after placement / editing / execution / canceling)
1680
1680
  orderTrigger = self.safe_value(item, 'orderTrigger')
1681
- details = self.safe_value_2(item, 'new', 'order', orderTrigger)
1682
- if details is not None:
1683
- isPrior = False
1684
- fixed = True
1685
- elif not fixed:
1686
- orderPriorExecution = self.safe_value(item, 'orderPriorExecution')
1687
- details = self.safe_value_2(item, 'orderPriorExecution', 'orderPriorEdit')
1688
- price = self.safe_string(orderPriorExecution, 'limitPrice')
1681
+ if details is None:
1682
+ details = self.safe_value_2(item, 'new', 'order', orderTrigger)
1689
1683
  if details is not None:
1690
- isPrior = True
1684
+ isPrior = False
1685
+ fixed = True
1686
+ elif not fixed:
1687
+ orderPriorExecution = self.safe_value(item, 'orderPriorExecution')
1688
+ details = self.safe_value_2(item, 'orderPriorExecution', 'orderPriorEdit')
1689
+ price = self.safe_string(orderPriorExecution, 'limitPrice')
1690
+ if details is not None:
1691
+ isPrior = True
1691
1692
  trades = self.parse_trades(executions)
1692
1693
  statusId = self.safe_string(order, 'status')
1693
1694
  if details is None:
@@ -137,6 +137,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
137
137
  'contracts/{symbol}': 1,
138
138
  'contracts/risk-limit/{symbol}': 1,
139
139
  'ticker': 1,
140
+ 'allTickers': 1,
140
141
  'level2/snapshot': 1.33,
141
142
  'level2/depth{limit}': 1,
142
143
  'level2/message/query': 1,
@@ -180,6 +181,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
180
181
  'trade-statistics': 1,
181
182
  'trade-fees': 1,
182
183
  'history-positions': 1,
184
+ 'getMaxOpenSize': 1,
183
185
  },
184
186
  'post': {
185
187
  'withdrawals': 1,
@@ -325,6 +327,9 @@ class kucoinfutures(kucoin, ImplicitAPI):
325
327
  # endpoint versions
326
328
  'versions': {
327
329
  'futuresPrivate': {
330
+ 'GET': {
331
+ 'getMaxOpenSize': 'v2',
332
+ },
328
333
  'POST': {
329
334
  'transfer-out': 'v2',
330
335
  },
@@ -1158,7 +1158,7 @@ class mexc(Exchange, ImplicitAPI):
1158
1158
  # "symbols": [
1159
1159
  # {
1160
1160
  # "symbol": "OGNUSDT",
1161
- # "status": "ENABLED",
1161
+ # "status": "1",
1162
1162
  # "baseAsset": "OGN",
1163
1163
  # "baseAssetPrecision": "2",
1164
1164
  # "quoteAsset": "USDT",
@@ -1203,7 +1203,7 @@ class mexc(Exchange, ImplicitAPI):
1203
1203
  status = self.safe_string(market, 'status')
1204
1204
  isSpotTradingAllowed = self.safe_value(market, 'isSpotTradingAllowed')
1205
1205
  active = False
1206
- if (status == 'ENABLED') and (isSpotTradingAllowed):
1206
+ if (status == '1') and (isSpotTradingAllowed):
1207
1207
  active = True
1208
1208
  isMarginTradingAllowed = self.safe_value(market, 'isMarginTradingAllowed')
1209
1209
  makerCommission = self.safe_number(market, 'makerCommission')
ccxt/base/errors.py CHANGED
@@ -16,6 +16,7 @@ error_hierarchy = {
16
16
  'MarginModeAlreadySet': {},
17
17
  },
18
18
  'MarketClosed': {},
19
+ 'ManualInteractionNeeded': {},
19
20
  },
20
21
  'InsufficientFunds': {},
21
22
  'InvalidAddress': {
@@ -106,6 +107,10 @@ class MarketClosed(OperationRejected):
106
107
  pass
107
108
 
108
109
 
110
+ class ManualInteractionNeeded(OperationRejected):
111
+ pass
112
+
113
+
109
114
  class InsufficientFunds(ExchangeError):
110
115
  pass
111
116
 
@@ -221,6 +226,7 @@ __all__ = [
221
226
  'NoChange',
222
227
  'MarginModeAlreadySet',
223
228
  'MarketClosed',
229
+ 'ManualInteractionNeeded',
224
230
  'InsufficientFunds',
225
231
  'InvalidAddress',
226
232
  'AddressPending',
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.84'
7
+ __version__ = '4.3.86'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -5927,7 +5927,7 @@ class Exchange(object):
5927
5927
  response = None
5928
5928
  if method == 'fetchAccounts':
5929
5929
  response = getattr(self, method)(params)
5930
- elif method == 'getLeverageTiersPaginated':
5930
+ elif method == 'getLeverageTiersPaginated' or method == 'fetchPositions':
5931
5931
  response = getattr(self, method)(symbol, params)
5932
5932
  else:
5933
5933
  response = getattr(self, method)(symbol, since, maxEntriesPerRequest, params)
ccxt/binance.py CHANGED
@@ -3760,12 +3760,14 @@ class binance(Exchange, ImplicitAPI):
3760
3760
  marketId = self.safe_string(ticker, 'symbol')
3761
3761
  symbol = self.safe_symbol(marketId, market, None, marketType)
3762
3762
  last = self.safe_string(ticker, 'lastPrice')
3763
+ wAvg = self.safe_string(ticker, 'weightedAvgPrice')
3763
3764
  isCoinm = ('baseVolume' in ticker)
3764
3765
  baseVolume = None
3765
3766
  quoteVolume = None
3766
3767
  if isCoinm:
3767
3768
  baseVolume = self.safe_string(ticker, 'baseVolume')
3768
- quoteVolume = self.safe_string(ticker, 'volume')
3769
+ # 'volume' field in inverse markets is not quoteVolume, but traded amount(per contracts)
3770
+ quoteVolume = Precise.string_mul(baseVolume, wAvg)
3769
3771
  else:
3770
3772
  baseVolume = self.safe_string(ticker, 'volume')
3771
3773
  quoteVolume = self.safe_string_2(ticker, 'quoteVolume', 'amount')
@@ -3779,7 +3781,7 @@ class binance(Exchange, ImplicitAPI):
3779
3781
  'bidVolume': self.safe_string(ticker, 'bidQty'),
3780
3782
  'ask': self.safe_string(ticker, 'askPrice'),
3781
3783
  'askVolume': self.safe_string(ticker, 'askQty'),
3782
- 'vwap': self.safe_string(ticker, 'weightedAvgPrice'),
3784
+ 'vwap': wAvg,
3783
3785
  'open': self.safe_string_2(ticker, 'openPrice', 'open'),
3784
3786
  'close': last,
3785
3787
  'last': last,
ccxt/bitfinex.py CHANGED
@@ -832,7 +832,7 @@ class bitfinex(Exchange, ImplicitAPI):
832
832
  def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
833
833
  """
834
834
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
835
- :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
835
+ :param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
836
836
  :param dict [params]: extra parameters specific to the exchange API endpoint
837
837
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
838
838
  """
@@ -841,7 +841,7 @@ class bitfinex(Exchange, ImplicitAPI):
841
841
  response = self.publicGetTickers(params)
842
842
  result: dict = {}
843
843
  for i in range(0, len(response)):
844
- ticker = self.parse_ticker({'result': response[i]})
844
+ ticker = self.parse_ticker(response[i])
845
845
  symbol = ticker['symbol']
846
846
  result[symbol] = ticker
847
847
  return self.filter_by_array_tickers(result, 'symbol', symbols)
ccxt/bitmex.py CHANGED
@@ -2307,6 +2307,8 @@ class bitmex(Exchange, ImplicitAPI):
2307
2307
  # 'otpToken': '123456', # requires if two-factor auth(OTP) is enabled
2308
2308
  # 'fee': 0.001, # bitcoin network fee
2309
2309
  }
2310
+ if self.twofa is not None:
2311
+ request['otpToken'] = self.totp(self.twofa)
2310
2312
  response = self.privatePostUserRequestWithdrawal(self.extend(request, params))
2311
2313
  #
2312
2314
  # {
ccxt/bybit.py CHANGED
@@ -15,6 +15,7 @@ from ccxt.base.errors import ArgumentsRequired
15
15
  from ccxt.base.errors import BadRequest
16
16
  from ccxt.base.errors import NoChange
17
17
  from ccxt.base.errors import MarginModeAlreadySet
18
+ from ccxt.base.errors import ManualInteractionNeeded
18
19
  from ccxt.base.errors import InsufficientFunds
19
20
  from ccxt.base.errors import InvalidOrder
20
21
  from ccxt.base.errors import OrderNotFound
@@ -767,8 +768,11 @@ class bybit(Exchange, ImplicitAPI):
767
768
  '140069': PermissionDenied, # Do not allow OTC lending users to trade
768
769
  '140070': InvalidOrder, # ETP symbols are not allowed to be traded
769
770
  '170001': ExchangeError, # Internal error.
770
- '170007': RequestTimeout, # Timeout waiting for response from backend server.
771
771
  '170005': InvalidOrder, # Too many new orders; current limit is %s orders per %s.
772
+ '170007': RequestTimeout, # Timeout waiting for response from backend server.
773
+ '170010': InvalidOrder, # Purchase failed: Exceed the maximum position limit of leveraged tokens, the current available limit is %s USDT
774
+ '170011': InvalidOrder, # "Purchase failed: Exceed the maximum position limit of innovation tokens,
775
+ '170019': InvalidOrder, # the current available limit is replaceKey0 USDT"
772
776
  '170031': ExchangeError, # The feature has been suspended
773
777
  '170032': ExchangeError, # Network error. Please try again later
774
778
  '170033': InsufficientFunds, # margin Insufficient account balance
@@ -781,6 +785,7 @@ class bybit(Exchange, ImplicitAPI):
781
785
  '170116': InvalidOrder, # Invalid orderType.
782
786
  '170117': InvalidOrder, # Invalid side.
783
787
  '170121': InvalidOrder, # Invalid symbol.
788
+ '170124': InvalidOrder, # Order amount too large.
784
789
  '170130': BadRequest, # Data sent for paramter '%s' is not valid.
785
790
  '170131': InsufficientFunds, # Balance insufficient
786
791
  '170132': InvalidOrder, # Order price too high.
@@ -791,7 +796,6 @@ class bybit(Exchange, ImplicitAPI):
791
796
  '170137': InvalidOrder, # Order volume decimal too long
792
797
  '170139': InvalidOrder, # Order has been filled.
793
798
  '170140': InvalidOrder, # Transaction amount lower than the minimum.
794
- '170124': InvalidOrder, # Order amount too large.
795
799
  '170141': InvalidOrder, # Duplicate clientOrderId
796
800
  '170142': InvalidOrder, # Order has been canceled
797
801
  '170143': InvalidOrder, # Cannot be found on order book
@@ -816,6 +820,15 @@ class bybit(Exchange, ImplicitAPI):
816
820
  '170198': InvalidOrder, # Your order quantity to sell is too large. The filled price may deviate significantly from the market price. Please try again
817
821
  '170199': InvalidOrder, # Your order quantity to buy is too large. The filled price may deviate significantly from the nav. Please try again.
818
822
  '170200': InvalidOrder, # Your order quantity to sell is too large. The filled price may deviate significantly from the nav. Please try again.
823
+ '170201': PermissionDenied, # Your account has been restricted for trades. If you have any questions, please email us at support@bybit.com
824
+ '170202': InvalidOrder, # Invalid orderFilter parameter.
825
+ '170203': InvalidOrder, # Please enter the TP/SL price.
826
+ '170204': InvalidOrder, # trigger price cannot be higher than 110% price.
827
+ '170206': InvalidOrder, # trigger price cannot be lower than 90% of qty.
828
+ '170210': InvalidOrder, # New order rejected.
829
+ '170213': OrderNotFound, # Order does not exist.
830
+ '170217': InvalidOrder, # Only LIMIT-MAKER order is supported for the current pair.
831
+ '170218': InvalidOrder, # The LIMIT-MAKER order is rejected due to invalid price.
819
832
  '170221': BadRequest, # This coin does not exist.
820
833
  '170222': RateLimitExceeded, # Too many hasattr(self, requests) time frame.
821
834
  '170223': InsufficientFunds, # Your Spot Account with Institutional Lending triggers an alert or liquidation.
@@ -825,18 +838,7 @@ class bybit(Exchange, ImplicitAPI):
825
838
  '170228': InvalidOrder, # The purchase amount of each order exceeds the estimated maximum purchase amount.
826
839
  '170229': InvalidOrder, # The sell quantity per order exceeds the estimated maximum sell quantity.
827
840
  '170234': ExchangeError, # System Error
828
- '170210': InvalidOrder, # New order rejected.
829
- '170213': OrderNotFound, # Order does not exist.
830
- '170217': InvalidOrder, # Only LIMIT-MAKER order is supported for the current pair.
831
- '170218': InvalidOrder, # The LIMIT-MAKER order is rejected due to invalid price.
832
- '170010': InvalidOrder, # Purchase failed: Exceed the maximum position limit of leveraged tokens, the current available limit is %s USDT
833
- '170011': InvalidOrder, # "Purchase failed: Exceed the maximum position limit of innovation tokens,
834
- '170019': InvalidOrder, # the current available limit is replaceKey0 USDT"
835
- '170201': PermissionDenied, # Your account has been restricted for trades. If you have any questions, please email us at support@bybit.com
836
- '170202': InvalidOrder, # Invalid orderFilter parameter.
837
- '170203': InvalidOrder, # Please enter the TP/SL price.
838
- '170204': InvalidOrder, # trigger price cannot be higher than 110% price.
839
- '170206': InvalidOrder, # trigger price cannot be lower than 90% of qty.
841
+ '170241': ManualInteractionNeeded, # To proceed with trading, users must read through and confirm that they fully understand the project's risk disclosure document.
840
842
  '175000': InvalidOrder, # The serialNum is already in use.
841
843
  '175001': InvalidOrder, # Daily purchase limit has been exceeded. Please try again later.
842
844
  '175002': InvalidOrder, # There's a large number of purchase orders. Please try again later.