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/coinex.py
CHANGED
@@ -307,7 +307,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
307
307
|
'v2': {
|
308
308
|
'public': {
|
309
309
|
'get': {
|
310
|
-
'maintain
|
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://
|
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
|
-
|
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
|
-
#
|
3939
|
-
#
|
3940
|
-
#
|
3941
|
-
#
|
3942
|
-
#
|
3943
|
-
#
|
3944
|
-
#
|
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.
|
3952
|
-
return self.parse_leverage_tiers(data, symbols,
|
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,
|
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
|
3958
|
-
|
3959
|
-
|
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':
|
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(
|
3966
|
-
'maxLeverage': self.safe_integer(
|
3967
|
-
'info':
|
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
|
-
'
|
3978
|
-
'
|
3996
|
+
'market_type': 'FUTURES',
|
3997
|
+
'amount': requestAmount,
|
3979
3998
|
}
|
3980
|
-
response = self.
|
3999
|
+
response = self.v2PrivatePostFuturesAdjustPositionMargin(self.extend(request, params))
|
3981
4000
|
#
|
3982
4001
|
# {
|
3983
4002
|
# "code": 0,
|
3984
4003
|
# "data": {
|
3985
|
-
# "
|
3986
|
-
# "
|
3987
|
-
# "
|
3988
|
-
# "
|
3989
|
-
# "
|
3990
|
-
# "
|
3991
|
-
# "
|
3992
|
-
# "
|
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
|
-
# "
|
4003
|
-
# "
|
4004
|
-
# "
|
4005
|
-
# "
|
4006
|
-
# "
|
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
|
-
# "
|
4015
|
-
# "
|
4016
|
-
# "
|
4017
|
-
# "
|
4018
|
-
# "
|
4019
|
-
# "
|
4020
|
-
# "
|
4021
|
-
# "
|
4022
|
-
# "
|
4023
|
-
# "
|
4024
|
-
# "
|
4025
|
-
# "
|
4026
|
-
# "
|
4027
|
-
# "
|
4028
|
-
# "
|
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.
|
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
|
-
#
|
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
|
-
# "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
|
-
#
|
4105
|
-
#
|
4106
|
-
#
|
4107
|
-
#
|
4108
|
-
#
|
4109
|
-
#
|
4110
|
-
#
|
4111
|
-
#
|
4112
|
-
#
|
4113
|
-
#
|
4114
|
-
#
|
4115
|
-
#
|
4116
|
-
#
|
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
|
-
|
4121
|
-
|
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':
|
4107
|
+
'type': None,
|
4126
4108
|
'marginMode': 'isolated',
|
4127
|
-
'amount': self.
|
4128
|
-
'total': self.safe_number(data, '
|
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://
|
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,
|
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://
|
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,
|
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://
|
5581
|
-
:param str
|
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
|
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
|
-
|
5594
|
-
|
5595
|
-
|
5596
|
-
|
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
|
-
'
|
5600
|
-
'
|
5601
|
-
'limit': limit,
|
5581
|
+
'market': market['id'],
|
5582
|
+
'market_type': 'FUTURES',
|
5583
|
+
'position_id': positionId,
|
5602
5584
|
}
|
5603
|
-
|
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
|
5609
|
-
request['
|
5610
|
-
response = self.
|
5588
|
+
if limit is not None:
|
5589
|
+
request['limit'] = limit
|
5590
|
+
response = self.v2PrivateGetFuturesPositionMarginHistory(self.extend(request, params))
|
5611
5591
|
#
|
5612
|
-
#
|
5613
|
-
#
|
5614
|
-
#
|
5615
|
-
#
|
5616
|
-
#
|
5617
|
-
#
|
5618
|
-
#
|
5619
|
-
#
|
5620
|
-
#
|
5621
|
-
#
|
5622
|
-
#
|
5623
|
-
#
|
5624
|
-
#
|
5625
|
-
#
|
5626
|
-
#
|
5627
|
-
#
|
5628
|
-
#
|
5629
|
-
#
|
5630
|
-
#
|
5631
|
-
#
|
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.
|
5639
|
-
|
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':
|
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
|
#
|