ccxt 4.3.85__py2.py3-none-any.whl → 4.3.87__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 (49) hide show
  1. ccxt/__init__.py +4 -1
  2. ccxt/abstract/hashkey.py +67 -0
  3. ccxt/async_support/__init__.py +4 -1
  4. ccxt/async_support/base/exchange.py +2 -2
  5. ccxt/async_support/binance.py +4 -2
  6. ccxt/async_support/bingx.py +5 -1
  7. ccxt/async_support/bitfinex.py +2 -2
  8. ccxt/async_support/hashkey.py +4061 -0
  9. ccxt/async_support/hyperliquid.py +80 -62
  10. ccxt/async_support/indodax.py +29 -8
  11. ccxt/async_support/kraken.py +32 -5
  12. ccxt/async_support/krakenfutures.py +10 -9
  13. ccxt/async_support/upbit.py +1 -1
  14. ccxt/base/errors.py +7 -1
  15. ccxt/base/exchange.py +2 -2
  16. ccxt/binance.py +4 -2
  17. ccxt/bingx.py +5 -1
  18. ccxt/bitfinex.py +2 -2
  19. ccxt/hashkey.py +4061 -0
  20. ccxt/hyperliquid.py +80 -62
  21. ccxt/indodax.py +29 -8
  22. ccxt/kraken.py +32 -5
  23. ccxt/krakenfutures.py +10 -9
  24. ccxt/pro/__init__.py +3 -1
  25. ccxt/pro/ascendex.py +41 -5
  26. ccxt/pro/bingx.py +13 -12
  27. ccxt/pro/bitget.py +143 -16
  28. ccxt/pro/hashkey.py +783 -0
  29. ccxt/pro/hyperliquid.py +118 -1
  30. ccxt/pro/mexc.py +13 -7
  31. ccxt/pro/p2b.py +30 -7
  32. ccxt/pro/poloniex.py +32 -3
  33. ccxt/pro/poloniexfutures.py +1 -0
  34. ccxt/pro/probit.py +2 -0
  35. ccxt/pro/upbit.py +44 -3
  36. ccxt/pro/vertex.py +1 -0
  37. ccxt/pro/wazirx.py +3 -0
  38. ccxt/pro/whitebit.py +9 -0
  39. ccxt/pro/woo.py +1 -0
  40. ccxt/pro/woofipro.py +1 -0
  41. ccxt/pro/xt.py +1 -0
  42. ccxt/test/tests_async.py +31 -31
  43. ccxt/test/tests_sync.py +31 -31
  44. ccxt/upbit.py +1 -1
  45. {ccxt-4.3.85.dist-info → ccxt-4.3.87.dist-info}/METADATA +9 -6
  46. {ccxt-4.3.85.dist-info → ccxt-4.3.87.dist-info}/RECORD +49 -45
  47. {ccxt-4.3.85.dist-info → ccxt-4.3.87.dist-info}/LICENSE.txt +0 -0
  48. {ccxt-4.3.85.dist-info → ccxt-4.3.87.dist-info}/WHEEL +0 -0
  49. {ccxt-4.3.85.dist-info → ccxt-4.3.87.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')
@@ -1086,6 +1086,7 @@ class kraken(Exchange, ImplicitAPI):
1086
1086
  :param int [limit]: max number of ledger entrys to return, default is None
1087
1087
  :param dict [params]: extra parameters specific to the exchange API endpoint
1088
1088
  :param int [params.until]: timestamp in ms of the latest ledger entry
1089
+ :param int [params.end]: timestamp in seconds of the latest ledger entry
1089
1090
  :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
1090
1091
  """
1091
1092
  # https://www.kraken.com/features/api#get-ledgers-info
@@ -1097,7 +1098,11 @@ class kraken(Exchange, ImplicitAPI):
1097
1098
  request['asset'] = currency['id']
1098
1099
  if since is not None:
1099
1100
  request['start'] = self.parse_to_int(since / 1000)
1100
- request, params = self.handle_until_option('end', request, params)
1101
+ until = self.safe_string_n(params, ['until', 'till'])
1102
+ if until is not None:
1103
+ params = self.omit(params, ['until', 'till'])
1104
+ untilDivided = Precise.string_div(until, '1000')
1105
+ request['end'] = self.parse_to_int(Precise.string_add(untilDivided, '1'))
1101
1106
  response = await self.privatePostLedgers(self.extend(request, params))
1102
1107
  # { error: [],
1103
1108
  # "result": {ledger: {'LPUAIB-TS774-UKHP7X': { refid: "A2B4HBV-L4MDIE-JU4N3N",
@@ -1995,6 +2000,8 @@ class kraken(Exchange, ImplicitAPI):
1995
2000
  :param int [since]: the earliest time in ms to fetch trades for
1996
2001
  :param int [limit]: the maximum number of trades structures to retrieve
1997
2002
  :param dict [params]: extra parameters specific to the exchange API endpoint
2003
+ :param int [params.until]: timestamp in ms of the latest trade entry
2004
+ :param int [params.end]: timestamp in seconds of the latest trade entry
1998
2005
  :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
1999
2006
  """
2000
2007
  await self.load_markets()
@@ -2007,6 +2014,11 @@ class kraken(Exchange, ImplicitAPI):
2007
2014
  }
2008
2015
  if since is not None:
2009
2016
  request['start'] = self.parse_to_int(since / 1000)
2017
+ until = self.safe_string_n(params, ['until', 'till'])
2018
+ if until is not None:
2019
+ params = self.omit(params, ['until', 'till'])
2020
+ untilDivided = Precise.string_div(until, '1000')
2021
+ request['end'] = self.parse_to_int(Precise.string_add(untilDivided, '1'))
2010
2022
  response = await self.privatePostTradesHistory(self.extend(request, params))
2011
2023
  #
2012
2024
  # {
@@ -2391,6 +2403,8 @@ class kraken(Exchange, ImplicitAPI):
2391
2403
  :param int [since]: the earliest time in ms to fetch deposits for
2392
2404
  :param int [limit]: the maximum number of deposits structures to retrieve
2393
2405
  :param dict [params]: extra parameters specific to the exchange API endpoint
2406
+ :param int [params.until]: timestamp in ms of the latest transaction entry
2407
+ :param int [params.end]: timestamp in seconds of the latest transaction entry
2394
2408
  :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
2395
2409
  """
2396
2410
  # https://www.kraken.com/en-us/help/api#deposit-status
@@ -2400,7 +2414,13 @@ class kraken(Exchange, ImplicitAPI):
2400
2414
  currency = self.currency(code)
2401
2415
  request['asset'] = currency['id']
2402
2416
  if since is not None:
2403
- request['start'] = since
2417
+ sinceString = self.number_to_string(since)
2418
+ request['start'] = Precise.string_div(sinceString, '1000')
2419
+ until = self.safe_string_n(params, ['until', 'till'])
2420
+ if until is not None:
2421
+ params = self.omit(params, ['until', 'till'])
2422
+ untilDivided = Precise.string_div(until, '1000')
2423
+ request['end'] = Precise.string_add(untilDivided, '1')
2404
2424
  response = await self.privatePostDepositStatus(self.extend(request, params))
2405
2425
  #
2406
2426
  # { error: [],
@@ -2446,8 +2466,9 @@ class kraken(Exchange, ImplicitAPI):
2446
2466
  :param int [since]: the earliest time in ms to fetch withdrawals for
2447
2467
  :param int [limit]: the maximum number of withdrawals structures to retrieve
2448
2468
  :param dict [params]: extra parameters specific to the exchange API endpoint
2449
- :param dict [params.end]: End timestamp, withdrawals created strictly after will be not be included in the response
2450
- :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times
2469
+ :param int [params.until]: timestamp in ms of the latest transaction entry
2470
+ :param int [params.end]: timestamp in seconds of the latest transaction entry
2471
+ :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times
2451
2472
  :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
2452
2473
  """
2453
2474
  await self.load_markets()
@@ -2461,7 +2482,13 @@ class kraken(Exchange, ImplicitAPI):
2461
2482
  currency = self.currency(code)
2462
2483
  request['asset'] = currency['id']
2463
2484
  if since is not None:
2464
- request['since'] = str(since)
2485
+ sinceString = self.number_to_string(since)
2486
+ request['start'] = Precise.string_div(sinceString, '1000')
2487
+ until = self.safe_string_n(params, ['until', 'till'])
2488
+ if until is not None:
2489
+ params = self.omit(params, ['until', 'till'])
2490
+ untilDivided = Precise.string_div(until, '1000')
2491
+ request['end'] = Precise.string_add(untilDivided, '1')
2465
2492
  response = await self.privatePostWithdrawStatus(self.extend(request, params))
2466
2493
  #
2467
2494
  # with no pagination
@@ -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:
@@ -1891,7 +1891,7 @@ class upbit(Exchange, ImplicitAPI):
1891
1891
  body = self.json(params)
1892
1892
  headers['Content-Type'] = 'application/json'
1893
1893
  if hasQuery:
1894
- auth = self.urlencode(query)
1894
+ auth = self.rawencode(query)
1895
1895
  if auth is not None:
1896
1896
  hash = self.hash(self.encode(auth), 'sha512')
1897
1897
  request['query_hash'] = hash
ccxt/base/errors.py CHANGED
@@ -51,6 +51,7 @@ error_hierarchy = {
51
51
  },
52
52
  'CancelPending': {},
53
53
  },
54
+ 'UnsubscribeError': {},
54
55
  },
55
56
  }
56
57
 
@@ -211,6 +212,10 @@ class CancelPending(OperationFailed):
211
212
  pass
212
213
 
213
214
 
215
+ class UnsubscribeError(BaseError):
216
+ pass
217
+
218
+
214
219
  __all__ = [
215
220
  'error_hierarchy',
216
221
  'BaseError',
@@ -251,5 +256,6 @@ __all__ = [
251
256
  'RequestTimeout',
252
257
  'BadResponse',
253
258
  'NullResponse',
254
- 'CancelPending'
259
+ 'CancelPending',
260
+ 'UnsubscribeError'
255
261
  ]
ccxt/base/exchange.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.85'
7
+ __version__ = '4.3.87'
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/bingx.py CHANGED
@@ -748,7 +748,11 @@ class bingx(Exchange, ImplicitAPI):
748
748
  symbol += ':' + settle
749
749
  fees = self.safe_dict(self.fees, type, {})
750
750
  contractSize = self.parse_number('1') if (swap) else None
751
- isActive = self.safe_string(market, 'status') == '1'
751
+ isActive = False
752
+ if (self.safe_string(market, 'apiStateOpen') == 'true') and (self.safe_string(market, 'apiStateClose') == 'true'):
753
+ isActive = True # swap active
754
+ elif self.safe_bool(market, 'apiStateSell') and self.safe_bool(market, 'apiStateBuy'):
755
+ isActive = True # spot active
752
756
  isInverse = None if (spot) else checkIsInverse
753
757
  isLinear = None if (spot) else checkIsLinear
754
758
  timeOnline = self.safe_integer(market, 'timeOnline')
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)