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