ccxt 4.3.19__py2.py3-none-any.whl → 4.3.21__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.

Files changed (49) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/binance.py +1 -0
  3. ccxt/abstract/binancecoinm.py +1 -0
  4. ccxt/abstract/binanceus.py +1 -0
  5. ccxt/abstract/binanceusdm.py +1 -0
  6. ccxt/abstract/bitget.py +3 -0
  7. ccxt/abstract/coinex.py +1 -1
  8. ccxt/abstract/okx.py +3 -0
  9. ccxt/ascendex.py +1 -1
  10. ccxt/async_support/__init__.py +1 -1
  11. ccxt/async_support/ascendex.py +1 -1
  12. ccxt/async_support/base/exchange.py +3 -1
  13. ccxt/async_support/binance.py +8 -2
  14. ccxt/async_support/bingx.py +1 -1
  15. ccxt/async_support/bitget.py +4 -1
  16. ccxt/async_support/bitmex.py +1 -0
  17. ccxt/async_support/bybit.py +35 -9
  18. ccxt/async_support/coinex.py +177 -200
  19. ccxt/async_support/delta.py +1 -1
  20. ccxt/async_support/digifinex.py +1 -1
  21. ccxt/async_support/exmo.py +1 -1
  22. ccxt/async_support/gate.py +1 -1
  23. ccxt/async_support/hitbtc.py +1 -1
  24. ccxt/async_support/hyperliquid.py +25 -3
  25. ccxt/async_support/okx.py +4 -1
  26. ccxt/async_support/phemex.py +15 -7
  27. ccxt/base/exchange.py +4 -2
  28. ccxt/binance.py +8 -2
  29. ccxt/bingx.py +1 -1
  30. ccxt/bitget.py +4 -1
  31. ccxt/bitmex.py +1 -0
  32. ccxt/bybit.py +35 -9
  33. ccxt/coinex.py +177 -200
  34. ccxt/delta.py +1 -1
  35. ccxt/digifinex.py +1 -1
  36. ccxt/exmo.py +1 -1
  37. ccxt/gate.py +1 -1
  38. ccxt/hitbtc.py +1 -1
  39. ccxt/hyperliquid.py +25 -3
  40. ccxt/okx.py +4 -1
  41. ccxt/phemex.py +15 -7
  42. ccxt/pro/__init__.py +1 -1
  43. ccxt/pro/htx.py +12 -6
  44. ccxt/pro/kucoinfutures.py +89 -1
  45. ccxt/pro/woo.py +46 -22
  46. {ccxt-4.3.19.dist-info → ccxt-4.3.21.dist-info}/METADATA +4 -4
  47. {ccxt-4.3.19.dist-info → ccxt-4.3.21.dist-info}/RECORD +49 -49
  48. {ccxt-4.3.19.dist-info → ccxt-4.3.21.dist-info}/WHEEL +0 -0
  49. {ccxt-4.3.19.dist-info → ccxt-4.3.21.dist-info}/top_level.txt +0 -0
ccxt/coinex.py CHANGED
@@ -307,7 +307,7 @@ class coinex(Exchange, ImplicitAPI):
307
307
  'v2': {
308
308
  'public': {
309
309
  'get': {
310
- 'maintain-info': 1,
310
+ 'maintain/info': 1,
311
311
  'ping': 1,
312
312
  'time': 1,
313
313
  'spot/market': 1,
@@ -3924,47 +3924,62 @@ class coinex(Exchange, ImplicitAPI):
3924
3924
  def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
3925
3925
  """
3926
3926
  retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
3927
- :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http007_market_limit
3927
+ :see: https://docs.coinex.com/api/v2/futures/market/http/list-market-position-level
3928
3928
  :param str[]|None symbols: list of unified market symbols
3929
3929
  :param dict [params]: extra parameters specific to the exchange API endpoint
3930
3930
  :returns dict: a dictionary of `leverage tiers structures <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`, indexed by market symbols
3931
3931
  """
3932
3932
  self.load_markets()
3933
- response = self.v1PerpetualPublicGetMarketLimitConfig(params)
3933
+ request = {}
3934
+ if symbols is not None:
3935
+ marketIds = self.market_ids(symbols)
3936
+ request['market'] = ','.join(marketIds)
3937
+ response = self.v2PublicGetFuturesPositionLevel(self.extend(request, params))
3934
3938
  #
3935
3939
  # {
3936
3940
  # "code": 0,
3937
- # "data": {
3938
- # "BTCUSD": [
3939
- # ["500001", "100", "0.005"],
3940
- # ["1000001", "50", "0.01"],
3941
- # ["2000001", "30", "0.015"],
3942
- # ["5000001", "20", "0.02"],
3943
- # ["10000001", "15", "0.025"],
3944
- # ["20000001", "10", "0.03"]
3945
- # ],
3946
- # ...
3947
- # },
3941
+ # "data": [
3942
+ # {
3943
+ # "level": [
3944
+ # {
3945
+ # "amount": "20001",
3946
+ # "leverage": "20",
3947
+ # "maintenance_margin_rate": "0.02",
3948
+ # "min_initial_margin_rate": "0.05"
3949
+ # },
3950
+ # {
3951
+ # "amount": "50001",
3952
+ # "leverage": "10",
3953
+ # "maintenance_margin_rate": "0.04",
3954
+ # "min_initial_margin_rate": "0.1"
3955
+ # },
3956
+ # ],
3957
+ # "market": "MINAUSDT"
3958
+ # },
3959
+ # ],
3948
3960
  # "message": "OK"
3949
3961
  # }
3950
3962
  #
3951
- data = self.safe_value(response, 'data', {})
3952
- return self.parse_leverage_tiers(data, symbols, None)
3963
+ data = self.safe_list(response, 'data', [])
3964
+ return self.parse_leverage_tiers(data, symbols, 'market')
3953
3965
 
3954
- def parse_market_leverage_tiers(self, item, market: Market = None):
3966
+ def parse_market_leverage_tiers(self, info, market: Market = None):
3955
3967
  tiers = []
3968
+ brackets = self.safe_list(info, 'level', [])
3956
3969
  minNotional = 0
3957
- for j in range(0, len(item)):
3958
- bracket = item[j]
3959
- maxNotional = self.safe_number(bracket, 0)
3970
+ for i in range(0, len(brackets)):
3971
+ tier = brackets[i]
3972
+ marketId = self.safe_string(info, 'market')
3973
+ market = self.safe_market(marketId, market, None, 'swap')
3974
+ maxNotional = self.safe_number(tier, 'amount')
3960
3975
  tiers.append({
3961
- 'tier': j + 1,
3976
+ 'tier': self.sum(i, 1),
3962
3977
  'currency': market['base'] if market['linear'] else market['quote'],
3963
3978
  'minNotional': minNotional,
3964
3979
  'maxNotional': maxNotional,
3965
- 'maintenanceMarginRate': self.safe_number(bracket, 2),
3966
- 'maxLeverage': self.safe_integer(bracket, 1),
3967
- 'info': bracket,
3980
+ 'maintenanceMarginRate': self.safe_number(tier, 'maintenance_margin_rate'),
3981
+ 'maxLeverage': self.safe_integer(tier, 'leverage'),
3982
+ 'info': tier,
3968
3983
  })
3969
3984
  minNotional = maxNotional
3970
3985
  return tiers
@@ -3972,160 +3987,127 @@ class coinex(Exchange, ImplicitAPI):
3972
3987
  def modify_margin_helper(self, symbol: str, amount, addOrReduce, params={}):
3973
3988
  self.load_markets()
3974
3989
  market = self.market(symbol)
3990
+ rawAmount = self.amount_to_precision(symbol, amount)
3991
+ requestAmount = rawAmount
3992
+ if addOrReduce == 'reduce':
3993
+ requestAmount = Precise.string_neg(rawAmount)
3975
3994
  request = {
3976
3995
  'market': market['id'],
3977
- 'amount': self.amount_to_precision(symbol, amount),
3978
- 'type': addOrReduce,
3996
+ 'market_type': 'FUTURES',
3997
+ 'amount': requestAmount,
3979
3998
  }
3980
- response = self.v1PerpetualPrivatePostPositionAdjustMargin(self.extend(request, params))
3999
+ response = self.v2PrivatePostFuturesAdjustPositionMargin(self.extend(request, params))
3981
4000
  #
3982
4001
  # {
3983
4002
  # "code": 0,
3984
4003
  # "data": {
3985
- # "adl_sort": 1,
3986
- # "adl_sort_val": "0.00004320",
3987
- # "amount": "0.0005",
3988
- # "amount_max": "0.0005",
3989
- # "amount_max_margin": "6.57352000000000000000",
3990
- # "bkr_price": "16294.08000000000000011090",
3991
- # "bkr_price_imply": "0.00000000000000000000",
3992
- # "close_left": "0.0005",
3993
- # "create_time": 1651202571.320778,
3994
- # "deal_all": "19.72000000000000000000",
3995
- # "deal_asset_fee": "0.00000000000000000000",
3996
- # "fee_asset": "",
3997
- # "finish_type": 1,
3998
- # "first_price": "39441.12",
3999
- # "insurance": "0.00000000000000000000",
4000
- # "latest_price": "39441.12",
4004
+ # "adl_level": 1,
4005
+ # "ath_margin_size": "2.034928",
4006
+ # "ath_position_amount": "0.0001",
4007
+ # "avg_entry_price": "61047.84",
4008
+ # "bkr_price": "30698.5600000000000004142",
4009
+ # "close_avbl": "0.0001",
4010
+ # "cml_position_value": "6.104784",
4011
+ # "created_at": 1715488472908,
4001
4012
  # "leverage": "3",
4002
- # "liq_amount": "0.00000000000000000000",
4003
- # "liq_order_price": "0",
4004
- # "liq_order_time": 0,
4005
- # "liq_price": "16491.28560000000000011090",
4006
- # "liq_price_imply": "0.00000000000000000000",
4007
- # "liq_profit": "0.00000000000000000000",
4008
- # "liq_time": 0,
4009
- # "mainten_margin": "0.005",
4010
- # "mainten_margin_amount": "0.09860280000000000000",
4011
- # "maker_fee": "0.00000000000000000000",
4012
- # "margin_amount": "11.57352000000000000000",
4013
+ # "liq_price": "30852.82412060301507579316",
4014
+ # "maintenance_margin_rate": "0.005",
4015
+ # "maintenance_margin_value": "0.03051465",
4016
+ # "margin_avbl": "3.034928",
4017
+ # "margin_mode": "isolated",
4013
4018
  # "market": "BTCUSDT",
4014
- # "open_margin": "0.58687582908396110455",
4015
- # "open_margin_imply": "0.00000000000000000000",
4016
- # "open_price": "39441.12000000000000000000",
4017
- # "open_val": "19.72056000000000000000",
4018
- # "open_val_max": "19.72056000000000000000",
4019
- # "position_id": 65171206,
4020
- # "profit_clearing": "-0.00986028000000000000",
4021
- # "profit_real": "-0.00986028000000000000",
4022
- # "profit_unreal": "0.00",
4023
- # "side": 2,
4024
- # "stop_loss_price": "0.00000000000000000000",
4025
- # "stop_loss_type": 0,
4026
- # "s ys": 0,
4027
- # "take_profit_price": "0.00000000000000000000",
4028
- # "take_profit_type": 0,
4029
- # "taker_fee": "0.00000000000000000000",
4030
- # "total": 3464,
4031
- # "type": 1,
4032
- # "update_time": 1651202638.911212,
4033
- # "user_id": 3620173
4019
+ # "market_type": "FUTURES",
4020
+ # "max_position_value": "6.104784",
4021
+ # "open_interest": "0.0001",
4022
+ # "position_id": 306458800,
4023
+ # "position_margin_rate": "0.49713929272518077625",
4024
+ # "realized_pnl": "-0.003052392",
4025
+ # "settle_price": "61047.84",
4026
+ # "settle_value": "6.104784",
4027
+ # "side": "long",
4028
+ # "stop_loss_price": "0",
4029
+ # "stop_loss_type": "",
4030
+ # "take_profit_price": "0",
4031
+ # "take_profit_type": "",
4032
+ # "unrealized_pnl": "0",
4033
+ # "updated_at": 1715488805563
4034
4034
  # },
4035
- # "message":"OK"
4035
+ # "message": "OK"
4036
4036
  # }
4037
4037
  #
4038
4038
  data = self.safe_dict(response, 'data')
4039
- status = self.safe_string(response, 'message')
4039
+ status = self.safe_string_lower(response, 'message')
4040
+ type = 'reduce' if (addOrReduce == 'reduce') else 'add'
4040
4041
  return self.extend(self.parse_margin_modification(data, market), {
4042
+ 'type': type,
4041
4043
  'amount': self.parse_number(amount),
4042
4044
  'status': status,
4043
4045
  })
4044
4046
 
4045
- def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
4047
+ def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
4046
4048
  #
4047
4049
  # addMargin/reduceMargin
4048
4050
  #
4049
- # {
4050
- # "adl_sort": 1,
4051
- # "adl_sort_val": "0.00004320",
4052
- # "amount": "0.0005",
4053
- # "amount_max": "0.0005",
4054
- # "amount_max_margin": "6.57352000000000000000",
4055
- # "bkr_price": "16294.08000000000000011090",
4056
- # "bkr_price_imply": "0.00000000000000000000",
4057
- # "close_left": "0.0005",
4058
- # "create_time": 1651202571.320778,
4059
- # "deal_all": "19.72000000000000000000",
4060
- # "deal_asset_fee": "0.00000000000000000000",
4061
- # "fee_asset": "",
4062
- # "finish_type": 1,
4063
- # "first_price": "39441.12",
4064
- # "insurance": "0.00000000000000000000",
4065
- # "latest_price": "39441.12",
4066
- # "leverage": "3",
4067
- # "liq_amount": "0.00000000000000000000",
4068
- # "liq_order_price": "0",
4069
- # "liq_order_time": 0,
4070
- # "liq_price": "16491.28560000000000011090",
4071
- # "liq_price_imply": "0.00000000000000000000",
4072
- # "liq_profit": "0.00000000000000000000",
4073
- # "liq_time": 0,
4074
- # "mainten_margin": "0.005",
4075
- # "mainten_margin_amount": "0.09860280000000000000",
4076
- # "maker_fee": "0.00000000000000000000",
4077
- # "margin_amount": "11.57352000000000000000",
4078
- # "market": "BTCUSDT",
4079
- # "open_margin": "0.58687582908396110455",
4080
- # "open_margin_imply": "0.00000000000000000000",
4081
- # "open_price": "39441.12000000000000000000",
4082
- # "open_val": "19.72056000000000000000",
4083
- # "open_val_max": "19.72056000000000000000",
4084
- # "position_id": 65171206,
4085
- # "profit_clearing": "-0.00986028000000000000",
4086
- # "profit_real": "-0.00986028000000000000",
4087
- # "profit_unreal": "0.00",
4088
- # "side": 2,
4089
- # "stop_loss_price": "0.00000000000000000000",
4090
- # "stop_loss_type": 0,
4091
- # "sy s": 0,
4092
- # "take_profit_price": "0.00000000000000000000",
4093
- # "take_profit_type": 0,
4094
- # "taker_fee": "0.00000000000000000000",
4095
- # "total": 3464,
4096
- # "type": 1,
4097
- # "update_time": 1651202638.911212,
4098
- # "user_id": 3620173
4099
- # }
4051
+ # {
4052
+ # "adl_level": 1,
4053
+ # "ath_margin_size": "2.034928",
4054
+ # "ath_position_amount": "0.0001",
4055
+ # "avg_entry_price": "61047.84",
4056
+ # "bkr_price": "30698.5600000000000004142",
4057
+ # "close_avbl": "0.0001",
4058
+ # "cml_position_value": "6.104784",
4059
+ # "created_at": 1715488472908,
4060
+ # "leverage": "3",
4061
+ # "liq_price": "30852.82412060301507579316",
4062
+ # "maintenance_margin_rate": "0.005",
4063
+ # "maintenance_margin_value": "0.03051465",
4064
+ # "margin_avbl": "3.034928",
4065
+ # "margin_mode": "isolated",
4066
+ # "market": "BTCUSDT",
4067
+ # "market_type": "FUTURES",
4068
+ # "max_position_value": "6.104784",
4069
+ # "open_interest": "0.0001",
4070
+ # "position_id": 306458800,
4071
+ # "position_margin_rate": "0.49713929272518077625",
4072
+ # "realized_pnl": "-0.003052392",
4073
+ # "settle_price": "61047.84",
4074
+ # "settle_value": "6.104784",
4075
+ # "side": "long",
4076
+ # "stop_loss_price": "0",
4077
+ # "stop_loss_type": "",
4078
+ # "take_profit_price": "0",
4079
+ # "take_profit_type": "",
4080
+ # "unrealized_pnl": "0",
4081
+ # "updated_at": 1715488805563
4082
+ # }
4100
4083
  #
4101
4084
  # fetchMarginAdjustmentHistory
4102
4085
  #
4103
- # {
4104
- # bkr_price: '0',
4105
- # leverage: '3',
4106
- # liq_price: '0',
4107
- # margin_amount: '5.33236666666666666666',
4108
- # margin_change: '3',
4109
- # market: 'XRPUSDT',
4110
- # position_amount: '11',
4111
- # position_id: '297155652',
4112
- # position_type: '2',
4113
- # settle_price: '0.6361',
4114
- # time: '1711050906.382891',
4115
- # type: '1',
4116
- # user_id: '3685860'
4117
- # }
4086
+ # {
4087
+ # "bkr_pirce": "24698.56000000000000005224",
4088
+ # "created_at": 1715489978697,
4089
+ # "leverage": "3",
4090
+ # "liq_price": "24822.67336683417085432386",
4091
+ # "margin_avbl": "3.634928",
4092
+ # "margin_change": "-1.5",
4093
+ # "margin_mode": "isolated",
4094
+ # "market": "BTCUSDT",
4095
+ # "market_type": "FUTURES",
4096
+ # "open_interest": "0.0001",
4097
+ # "position_id": 306458800,
4098
+ # "settle_price": "61047.84"
4099
+ # }
4118
4100
  #
4119
4101
  marketId = self.safe_string(data, 'market')
4120
- type = self.safe_string(data, 'type')
4121
- timestamp = self.safe_integer_product_2(data, 'time', 'update_time', 1000)
4102
+ timestamp = self.safe_integer_2(data, 'updated_at', 'created_at')
4103
+ change = self.safe_string(data, 'margin_change')
4122
4104
  return {
4123
4105
  'info': data,
4124
4106
  'symbol': self.safe_symbol(marketId, market, None, 'swap'),
4125
- 'type': 'add' if (type == '1') else 'reduce',
4107
+ 'type': None,
4126
4108
  'marginMode': 'isolated',
4127
- 'amount': self.safe_number(data, 'margin_change'),
4128
- 'total': self.safe_number(data, 'position_amount'),
4109
+ 'amount': self.parse_number(Precise.string_abs(change)),
4110
+ 'total': self.safe_number(data, 'margin_avbl'),
4129
4111
  'code': market['quote'],
4130
4112
  'status': None,
4131
4113
  'timestamp': timestamp,
@@ -4135,24 +4117,24 @@ class coinex(Exchange, ImplicitAPI):
4135
4117
  def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
4136
4118
  """
4137
4119
  add margin
4138
- :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
4120
+ :see: https://docs.coinex.com/api/v2/futures/position/http/adjust-position-margin
4139
4121
  :param str symbol: unified market symbol
4140
4122
  :param float amount: amount of margin to add
4141
4123
  :param dict [params]: extra parameters specific to the exchange API endpoint
4142
4124
  :returns dict: a `margin structure <https://docs.ccxt.com/#/?id=add-margin-structure>`
4143
4125
  """
4144
- return self.modify_margin_helper(symbol, amount, 1, params)
4126
+ return self.modify_margin_helper(symbol, amount, 'add', params)
4145
4127
 
4146
4128
  def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
4147
4129
  """
4148
4130
  remove margin from a position
4149
- :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
4131
+ :see: https://docs.coinex.com/api/v2/futures/position/http/adjust-position-margin
4150
4132
  :param str symbol: unified market symbol
4151
4133
  :param float amount: the amount of margin to remove
4152
4134
  :param dict [params]: extra parameters specific to the exchange API endpoint
4153
4135
  :returns dict: a `margin structure <https://docs.ccxt.com/#/?id=reduce-margin-structure>`
4154
4136
  """
4155
- return self.modify_margin_helper(symbol, amount, 2, params)
4137
+ return self.modify_margin_helper(symbol, amount, 'reduce', params)
4156
4138
 
4157
4139
  def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
4158
4140
  """
@@ -5577,65 +5559,60 @@ class coinex(Exchange, ImplicitAPI):
5577
5559
  def fetch_margin_adjustment_history(self, symbol: Str = None, type: Str = None, since: Num = None, limit: Num = None, params={}) -> List[MarginModification]:
5578
5560
  """
5579
5561
  fetches the history of margin added or reduced from contract isolated positions
5580
- :see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http046_position_margin_history
5581
- :param str [symbol]: unified market symbol
5562
+ :see: https://docs.coinex.com/api/v2/futures/position/http/list-position-margin-history
5563
+ :param str symbol: unified market symbol
5582
5564
  :param str [type]: not used by coinex fetchMarginAdjustmentHistory
5583
5565
  :param int [since]: timestamp in ms of the earliest change to fetch
5584
- :param int [limit]: the maximum amount of changes to fetch, default=100, max=100
5566
+ :param int [limit]: the maximum amount of changes to fetch, default is 10
5585
5567
  :param dict params: extra parameters specific to the exchange api endpoint
5586
5568
  :param int [params.until]: timestamp in ms of the latest change to fetch
5587
- *
5588
- * EXCHANGE SPECIFIC PARAMETERS
5589
- :param int [params.offset]: offset
5569
+ :param int [params.positionId]: the id of the position that you want to retrieve margin adjustment history for
5590
5570
  :returns dict[]: a list of `margin structures <https://docs.ccxt.com/#/?id=margin-loan-structure>`
5591
5571
  """
5592
5572
  self.load_markets()
5593
- until = self.safe_integer(params, 'until')
5594
- params = self.omit(params, 'until')
5595
- if limit is None:
5596
- limit = 100
5573
+ if symbol is None:
5574
+ raise ArgumentsRequired(self.id + ' fetchMarginAdjustmentHistory() requires a symbol argument')
5575
+ positionId = self.safe_integer_2(params, 'positionId', 'position_id')
5576
+ params = self.omit(params, 'positionId')
5577
+ if positionId is None:
5578
+ raise ArgumentsRequired(self.id + ' fetchMarginAdjustmentHistory() requires a positionId parameter')
5579
+ market = self.market(symbol)
5597
5580
  request = {
5598
- 'market': '',
5599
- 'position_id': 0,
5600
- 'offset': 0,
5601
- 'limit': limit,
5581
+ 'market': market['id'],
5582
+ 'market_type': 'FUTURES',
5583
+ 'position_id': positionId,
5602
5584
  }
5603
- if symbol is not None:
5604
- market = self.market(symbol)
5605
- request['market'] = market['id']
5585
+ request, params = self.handle_until_option('end_time', request, params)
5606
5586
  if since is not None:
5607
5587
  request['start_time'] = since
5608
- if until is not None:
5609
- request['end_time'] = until
5610
- response = self.v1PerpetualPrivateGetPositionMarginHistory(self.extend(request, params))
5588
+ if limit is not None:
5589
+ request['limit'] = limit
5590
+ response = self.v2PrivateGetFuturesPositionMarginHistory(self.extend(request, params))
5611
5591
  #
5612
- # {
5613
- # code: '0',
5614
- # data: {
5615
- # limit: '100',
5616
- # offset: '0',
5617
- # records: [
5618
- # {
5619
- # bkr_price: '0',
5620
- # leverage: '3',
5621
- # liq_price: '0',
5622
- # margin_amount: '5.33236666666666666666',
5623
- # margin_change: '3',
5624
- # market: 'XRPUSDT',
5625
- # position_amount: '11',
5626
- # position_id: '297155652',
5627
- # position_type: '2',
5628
- # settle_price: '0.6361',
5629
- # time: '1711050906.382891',
5630
- # type: '1',
5631
- # user_id: '3685860'
5632
- # }
5633
- # ]
5634
- # },
5635
- # message: 'OK'
5636
- # }
5592
+ # {
5593
+ # "code": 0,
5594
+ # "data": [
5595
+ # {
5596
+ # "bkr_pirce": "24698.56000000000000005224",
5597
+ # "created_at": 1715489978697,
5598
+ # "leverage": "3",
5599
+ # "liq_price": "24822.67336683417085432386",
5600
+ # "margin_avbl": "3.634928",
5601
+ # "margin_change": "-1.5",
5602
+ # "margin_mode": "isolated",
5603
+ # "market": "BTCUSDT",
5604
+ # "market_type": "FUTURES",
5605
+ # "open_interest": "0.0001",
5606
+ # "position_id": 306458800,
5607
+ # "settle_price": "61047.84"
5608
+ # },
5609
+ # ],
5610
+ # "message": "OK",
5611
+ # "pagination": {
5612
+ # "has_next": True
5613
+ # }
5614
+ # }
5637
5615
  #
5638
- data = self.safe_dict(response, 'data', {})
5639
- records = self.safe_list(data, 'records', [])
5640
- modifications = self.parse_margin_modifications(records, None, 'market', 'swap')
5616
+ data = self.safe_list(response, 'data', [])
5617
+ modifications = self.parse_margin_modifications(data, None, 'market', 'swap')
5641
5618
  return self.filter_by_symbol_since_limit(modifications, symbol, since, limit)
ccxt/delta.py CHANGED
@@ -2539,7 +2539,7 @@ class delta(Exchange, ImplicitAPI):
2539
2539
  result = self.safe_dict(response, 'result', {})
2540
2540
  return self.parse_margin_modification(result, market)
2541
2541
 
2542
- def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
2542
+ def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
2543
2543
  #
2544
2544
  # {
2545
2545
  # "auto_topup": False,
ccxt/digifinex.py CHANGED
@@ -3791,7 +3791,7 @@ class digifinex(Exchange, ImplicitAPI):
3791
3791
  'status': status,
3792
3792
  })
3793
3793
 
3794
- def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
3794
+ def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
3795
3795
  #
3796
3796
  # {
3797
3797
  # "instrument_id": "BTCUSDTPERP",
ccxt/exmo.py CHANGED
@@ -270,7 +270,7 @@ class exmo(Exchange, ImplicitAPI):
270
270
  margin['amount'] = amount
271
271
  return margin
272
272
 
273
- def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
273
+ def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
274
274
  #
275
275
  # {}
276
276
  #
ccxt/gate.py CHANGED
@@ -5678,7 +5678,7 @@ class gate(Exchange, ImplicitAPI):
5678
5678
  raise NotSupported(self.id + ' modifyMarginHelper() not support self market type')
5679
5679
  return self.parse_margin_modification(response, market)
5680
5680
 
5681
- def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
5681
+ def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
5682
5682
  #
5683
5683
  # {
5684
5684
  # "value": "11.9257",
ccxt/hitbtc.py CHANGED
@@ -3057,7 +3057,7 @@ class hitbtc(Exchange, ImplicitAPI):
3057
3057
  'type': type,
3058
3058
  })
3059
3059
 
3060
- def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
3060
+ def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
3061
3061
  #
3062
3062
  # addMargin/reduceMargin
3063
3063
  #
ccxt/hyperliquid.py CHANGED
@@ -1544,14 +1544,17 @@ class hyperliquid(Exchange, ImplicitAPI):
1544
1544
  :param int [limit]: the maximum number of open orders structures to retrieve
1545
1545
  :param dict [params]: extra parameters specific to the exchange API endpoint
1546
1546
  :param str [params.user]: user address, will default to self.walletAddress if not provided
1547
+ :param str [params.method]: 'openOrders' or 'frontendOpenOrders' default is 'frontendOpenOrders'
1547
1548
  :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1548
1549
  """
1549
1550
  userAddress = None
1550
1551
  userAddress, params = self.handle_public_address('fetchOpenOrders', params)
1552
+ method = None
1553
+ method, params = self.handle_option_and_params(params, 'fetchOpenOrders', 'method', 'frontendOpenOrders')
1551
1554
  self.load_markets()
1552
1555
  market = self.safe_market(symbol)
1553
1556
  request = {
1554
- 'type': 'openOrders',
1557
+ 'type': method,
1555
1558
  'user': userAddress,
1556
1559
  }
1557
1560
  response = self.publicPostInfo(self.extend(request, params))
@@ -1725,6 +1728,25 @@ class hyperliquid(Exchange, ImplicitAPI):
1725
1728
  # "oid":6195281425
1726
1729
  # }
1727
1730
  # }
1731
+ # frontendOrder
1732
+ # {
1733
+ # "children": [],
1734
+ # "cloid": null,
1735
+ # "coin": "BLUR",
1736
+ # "isPositionTpsl": False,
1737
+ # "isTrigger": True,
1738
+ # "limitPx": "0.5",
1739
+ # "oid": 8670487141,
1740
+ # "orderType": "Stop Limit",
1741
+ # "origSz": "20.0",
1742
+ # "reduceOnly": False,
1743
+ # "side": "B",
1744
+ # "sz": "20.0",
1745
+ # "tif": null,
1746
+ # "timestamp": 1715523663687,
1747
+ # "triggerCondition": "Price above 0.6",
1748
+ # "triggerPx": "0.6"
1749
+ # }
1728
1750
  #
1729
1751
  entry = self.safe_dict_n(order, ['order', 'resting', 'filled'])
1730
1752
  if entry is None:
@@ -1755,7 +1777,7 @@ class hyperliquid(Exchange, ImplicitAPI):
1755
1777
  'lastTradeTimestamp': None,
1756
1778
  'lastUpdateTimestamp': None,
1757
1779
  'symbol': symbol,
1758
- 'type': self.safe_string_lower(entry, 'orderType'),
1780
+ 'type': self.parse_order_type(self.safe_string_lower(entry, 'orderType')),
1759
1781
  'timeInForce': self.safe_string_upper(entry, 'tif'),
1760
1782
  'postOnly': None,
1761
1783
  'reduceOnly': self.safe_bool(entry, 'reduceOnly'),
@@ -2190,7 +2212,7 @@ class hyperliquid(Exchange, ImplicitAPI):
2190
2212
  'code': self.safe_string(response, 'status'),
2191
2213
  })
2192
2214
 
2193
- def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
2215
+ def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
2194
2216
  #
2195
2217
  # {
2196
2218
  # 'type': 'default'
ccxt/okx.py CHANGED
@@ -269,6 +269,9 @@ class okx(Exchange, ImplicitAPI):
269
269
  'sprd/books': 1 / 2,
270
270
  'sprd/ticker': 1,
271
271
  'sprd/public-trades': 1 / 5,
272
+ 'market/sprd-ticker': 2,
273
+ 'market/sprd-candles': 2,
274
+ 'market/sprd-history-candles': 2,
272
275
  'tradingBot/grid/ai-param': 1,
273
276
  'tradingBot/grid/min-investment': 1,
274
277
  'tradingBot/public/rsi-back-testing': 1,
@@ -6235,7 +6238,7 @@ class okx(Exchange, ImplicitAPI):
6235
6238
  'status': 'ok' if (errorCode == '0') else 'failed',
6236
6239
  })
6237
6240
 
6238
- def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
6241
+ def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
6239
6242
  #
6240
6243
  # addMargin/reduceMargin
6241
6244
  #