ccxt 4.3.20__py2.py3-none-any.whl → 4.3.22__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/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 +1 -1
- ccxt/async_support/binance.py +8 -2
- ccxt/async_support/bingx.py +1 -1
- ccxt/async_support/bitget.py +1 -1
- ccxt/async_support/bitmex.py +1 -0
- ccxt/async_support/coinex.py +140 -178
- 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 +35 -5
- ccxt/base/exchange.py +2 -2
- ccxt/binance.py +8 -2
- ccxt/bingx.py +1 -1
- ccxt/bitget.py +1 -1
- ccxt/bitmex.py +1 -0
- ccxt/coinex.py +140 -178
- 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 +35 -5
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/kucoinfutures.py +89 -1
- ccxt/pro/woo.py +46 -22
- {ccxt-4.3.20.dist-info → ccxt-4.3.22.dist-info}/METADATA +4 -4
- {ccxt-4.3.20.dist-info → ccxt-4.3.22.dist-info}/RECORD +45 -45
- {ccxt-4.3.20.dist-info → ccxt-4.3.22.dist-info}/WHEEL +0 -0
- {ccxt-4.3.20.dist-info → ccxt-4.3.22.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,
|
@@ -3987,160 +3987,127 @@ class coinex(Exchange, ImplicitAPI):
|
|
3987
3987
|
def modify_margin_helper(self, symbol: str, amount, addOrReduce, params={}):
|
3988
3988
|
self.load_markets()
|
3989
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)
|
3990
3994
|
request = {
|
3991
3995
|
'market': market['id'],
|
3992
|
-
'
|
3993
|
-
'
|
3996
|
+
'market_type': 'FUTURES',
|
3997
|
+
'amount': requestAmount,
|
3994
3998
|
}
|
3995
|
-
response = self.
|
3999
|
+
response = self.v2PrivatePostFuturesAdjustPositionMargin(self.extend(request, params))
|
3996
4000
|
#
|
3997
4001
|
# {
|
3998
4002
|
# "code": 0,
|
3999
4003
|
# "data": {
|
4000
|
-
# "
|
4001
|
-
# "
|
4002
|
-
# "
|
4003
|
-
# "
|
4004
|
-
# "
|
4005
|
-
# "
|
4006
|
-
# "
|
4007
|
-
# "
|
4008
|
-
# "create_time": 1651202571.320778,
|
4009
|
-
# "deal_all": "19.72000000000000000000",
|
4010
|
-
# "deal_asset_fee": "0.00000000000000000000",
|
4011
|
-
# "fee_asset": "",
|
4012
|
-
# "finish_type": 1,
|
4013
|
-
# "first_price": "39441.12",
|
4014
|
-
# "insurance": "0.00000000000000000000",
|
4015
|
-
# "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,
|
4016
4012
|
# "leverage": "3",
|
4017
|
-
# "
|
4018
|
-
# "
|
4019
|
-
# "
|
4020
|
-
# "
|
4021
|
-
# "
|
4022
|
-
# "liq_profit": "0.00000000000000000000",
|
4023
|
-
# "liq_time": 0,
|
4024
|
-
# "mainten_margin": "0.005",
|
4025
|
-
# "mainten_margin_amount": "0.09860280000000000000",
|
4026
|
-
# "maker_fee": "0.00000000000000000000",
|
4027
|
-
# "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",
|
4028
4018
|
# "market": "BTCUSDT",
|
4029
|
-
# "
|
4030
|
-
# "
|
4031
|
-
# "
|
4032
|
-
# "
|
4033
|
-
# "
|
4034
|
-
# "
|
4035
|
-
# "
|
4036
|
-
# "
|
4037
|
-
# "
|
4038
|
-
# "
|
4039
|
-
# "
|
4040
|
-
# "
|
4041
|
-
# "
|
4042
|
-
# "
|
4043
|
-
# "
|
4044
|
-
# "taker_fee": "0.00000000000000000000",
|
4045
|
-
# "total": 3464,
|
4046
|
-
# "type": 1,
|
4047
|
-
# "update_time": 1651202638.911212,
|
4048
|
-
# "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
|
4049
4034
|
# },
|
4050
|
-
# "message":"OK"
|
4035
|
+
# "message": "OK"
|
4051
4036
|
# }
|
4052
4037
|
#
|
4053
4038
|
data = self.safe_dict(response, 'data')
|
4054
|
-
status = self.
|
4039
|
+
status = self.safe_string_lower(response, 'message')
|
4040
|
+
type = 'reduce' if (addOrReduce == 'reduce') else 'add'
|
4055
4041
|
return self.extend(self.parse_margin_modification(data, market), {
|
4042
|
+
'type': type,
|
4056
4043
|
'amount': self.parse_number(amount),
|
4057
4044
|
'status': status,
|
4058
4045
|
})
|
4059
4046
|
|
4060
|
-
def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
|
4047
|
+
def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
|
4061
4048
|
#
|
4062
4049
|
# addMargin/reduceMargin
|
4063
4050
|
#
|
4064
|
-
#
|
4065
|
-
#
|
4066
|
-
#
|
4067
|
-
#
|
4068
|
-
#
|
4069
|
-
#
|
4070
|
-
#
|
4071
|
-
#
|
4072
|
-
#
|
4073
|
-
#
|
4074
|
-
#
|
4075
|
-
#
|
4076
|
-
#
|
4077
|
-
#
|
4078
|
-
#
|
4079
|
-
#
|
4080
|
-
#
|
4081
|
-
#
|
4082
|
-
#
|
4083
|
-
#
|
4084
|
-
#
|
4085
|
-
#
|
4086
|
-
#
|
4087
|
-
#
|
4088
|
-
#
|
4089
|
-
#
|
4090
|
-
#
|
4091
|
-
#
|
4092
|
-
#
|
4093
|
-
#
|
4094
|
-
#
|
4095
|
-
#
|
4096
|
-
# "open_price": "39441.12000000000000000000",
|
4097
|
-
# "open_val": "19.72056000000000000000",
|
4098
|
-
# "open_val_max": "19.72056000000000000000",
|
4099
|
-
# "position_id": 65171206,
|
4100
|
-
# "profit_clearing": "-0.00986028000000000000",
|
4101
|
-
# "profit_real": "-0.00986028000000000000",
|
4102
|
-
# "profit_unreal": "0.00",
|
4103
|
-
# "side": 2,
|
4104
|
-
# "stop_loss_price": "0.00000000000000000000",
|
4105
|
-
# "stop_loss_type": 0,
|
4106
|
-
# "sy s": 0,
|
4107
|
-
# "take_profit_price": "0.00000000000000000000",
|
4108
|
-
# "take_profit_type": 0,
|
4109
|
-
# "taker_fee": "0.00000000000000000000",
|
4110
|
-
# "total": 3464,
|
4111
|
-
# "type": 1,
|
4112
|
-
# "update_time": 1651202638.911212,
|
4113
|
-
# "user_id": 3620173
|
4114
|
-
# }
|
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
|
+
# }
|
4115
4083
|
#
|
4116
4084
|
# fetchMarginAdjustmentHistory
|
4117
4085
|
#
|
4118
|
-
#
|
4119
|
-
#
|
4120
|
-
#
|
4121
|
-
#
|
4122
|
-
#
|
4123
|
-
#
|
4124
|
-
#
|
4125
|
-
#
|
4126
|
-
#
|
4127
|
-
#
|
4128
|
-
#
|
4129
|
-
#
|
4130
|
-
#
|
4131
|
-
#
|
4132
|
-
# }
|
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
|
+
# }
|
4133
4100
|
#
|
4134
4101
|
marketId = self.safe_string(data, 'market')
|
4135
|
-
|
4136
|
-
|
4102
|
+
timestamp = self.safe_integer_2(data, 'updated_at', 'created_at')
|
4103
|
+
change = self.safe_string(data, 'margin_change')
|
4137
4104
|
return {
|
4138
4105
|
'info': data,
|
4139
4106
|
'symbol': self.safe_symbol(marketId, market, None, 'swap'),
|
4140
|
-
'type':
|
4107
|
+
'type': None,
|
4141
4108
|
'marginMode': 'isolated',
|
4142
|
-
'amount': self.
|
4143
|
-
'total': self.safe_number(data, '
|
4109
|
+
'amount': self.parse_number(Precise.string_abs(change)),
|
4110
|
+
'total': self.safe_number(data, 'margin_avbl'),
|
4144
4111
|
'code': market['quote'],
|
4145
4112
|
'status': None,
|
4146
4113
|
'timestamp': timestamp,
|
@@ -4150,24 +4117,24 @@ class coinex(Exchange, ImplicitAPI):
|
|
4150
4117
|
def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
4151
4118
|
"""
|
4152
4119
|
add margin
|
4153
|
-
:see: https://
|
4120
|
+
:see: https://docs.coinex.com/api/v2/futures/position/http/adjust-position-margin
|
4154
4121
|
:param str symbol: unified market symbol
|
4155
4122
|
:param float amount: amount of margin to add
|
4156
4123
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4157
4124
|
:returns dict: a `margin structure <https://docs.ccxt.com/#/?id=add-margin-structure>`
|
4158
4125
|
"""
|
4159
|
-
return self.modify_margin_helper(symbol, amount,
|
4126
|
+
return self.modify_margin_helper(symbol, amount, 'add', params)
|
4160
4127
|
|
4161
4128
|
def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
4162
4129
|
"""
|
4163
4130
|
remove margin from a position
|
4164
|
-
:see: https://
|
4131
|
+
:see: https://docs.coinex.com/api/v2/futures/position/http/adjust-position-margin
|
4165
4132
|
:param str symbol: unified market symbol
|
4166
4133
|
:param float amount: the amount of margin to remove
|
4167
4134
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4168
4135
|
:returns dict: a `margin structure <https://docs.ccxt.com/#/?id=reduce-margin-structure>`
|
4169
4136
|
"""
|
4170
|
-
return self.modify_margin_helper(symbol, amount,
|
4137
|
+
return self.modify_margin_helper(symbol, amount, 'reduce', params)
|
4171
4138
|
|
4172
4139
|
def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
4173
4140
|
"""
|
@@ -5582,7 +5549,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
5582
5549
|
code = self.safe_string(response, 'code')
|
5583
5550
|
data = self.safe_value(response, 'data')
|
5584
5551
|
message = self.safe_string(response, 'message')
|
5585
|
-
if (code != '0') or ((message != 'Success') and (message != 'Succeeded') and (message != '
|
5552
|
+
if (code != '0') or ((message != 'Success') and (message != 'Succeeded') and (message.lower() != 'ok') and not data):
|
5586
5553
|
feedback = self.id + ' ' + message
|
5587
5554
|
self.throw_broadly_matched_exception(self.exceptions['broad'], message, feedback)
|
5588
5555
|
self.throw_exactly_matched_exception(self.exceptions['exact'], code, feedback)
|
@@ -5592,65 +5559,60 @@ class coinex(Exchange, ImplicitAPI):
|
|
5592
5559
|
def fetch_margin_adjustment_history(self, symbol: Str = None, type: Str = None, since: Num = None, limit: Num = None, params={}) -> List[MarginModification]:
|
5593
5560
|
"""
|
5594
5561
|
fetches the history of margin added or reduced from contract isolated positions
|
5595
|
-
:see: https://
|
5596
|
-
:param str
|
5562
|
+
:see: https://docs.coinex.com/api/v2/futures/position/http/list-position-margin-history
|
5563
|
+
:param str symbol: unified market symbol
|
5597
5564
|
:param str [type]: not used by coinex fetchMarginAdjustmentHistory
|
5598
5565
|
:param int [since]: timestamp in ms of the earliest change to fetch
|
5599
|
-
: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
|
5600
5567
|
:param dict params: extra parameters specific to the exchange api endpoint
|
5601
5568
|
:param int [params.until]: timestamp in ms of the latest change to fetch
|
5602
|
-
|
5603
|
-
* EXCHANGE SPECIFIC PARAMETERS
|
5604
|
-
:param int [params.offset]: offset
|
5569
|
+
:param int [params.positionId]: the id of the position that you want to retrieve margin adjustment history for
|
5605
5570
|
:returns dict[]: a list of `margin structures <https://docs.ccxt.com/#/?id=margin-loan-structure>`
|
5606
5571
|
"""
|
5607
5572
|
self.load_markets()
|
5608
|
-
|
5609
|
-
|
5610
|
-
|
5611
|
-
|
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)
|
5612
5580
|
request = {
|
5613
|
-
'market': '',
|
5614
|
-
'
|
5615
|
-
'
|
5616
|
-
'limit': limit,
|
5581
|
+
'market': market['id'],
|
5582
|
+
'market_type': 'FUTURES',
|
5583
|
+
'position_id': positionId,
|
5617
5584
|
}
|
5618
|
-
|
5619
|
-
market = self.market(symbol)
|
5620
|
-
request['market'] = market['id']
|
5585
|
+
request, params = self.handle_until_option('end_time', request, params)
|
5621
5586
|
if since is not None:
|
5622
5587
|
request['start_time'] = since
|
5623
|
-
if
|
5624
|
-
request['
|
5625
|
-
response = self.
|
5588
|
+
if limit is not None:
|
5589
|
+
request['limit'] = limit
|
5590
|
+
response = self.v2PrivateGetFuturesPositionMarginHistory(self.extend(request, params))
|
5626
5591
|
#
|
5627
|
-
#
|
5628
|
-
#
|
5629
|
-
#
|
5630
|
-
#
|
5631
|
-
#
|
5632
|
-
#
|
5633
|
-
#
|
5634
|
-
#
|
5635
|
-
#
|
5636
|
-
#
|
5637
|
-
#
|
5638
|
-
#
|
5639
|
-
#
|
5640
|
-
#
|
5641
|
-
#
|
5642
|
-
#
|
5643
|
-
#
|
5644
|
-
#
|
5645
|
-
#
|
5646
|
-
#
|
5647
|
-
#
|
5648
|
-
#
|
5649
|
-
#
|
5650
|
-
# message: 'OK'
|
5651
|
-
# }
|
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
|
+
# }
|
5652
5615
|
#
|
5653
|
-
data = self.
|
5654
|
-
|
5655
|
-
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')
|
5656
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
|
#
|
ccxt/phemex.py
CHANGED
@@ -1658,6 +1658,26 @@ class phemex(Exchange, ImplicitAPI):
|
|
1658
1658
|
# "execId": "8718cae",
|
1659
1659
|
# "execStatus": 6
|
1660
1660
|
# }
|
1661
|
+
# spot with fees paid using PT token
|
1662
|
+
# "createdAt": "1714990724076",
|
1663
|
+
# "symbol": "BTCUSDT",
|
1664
|
+
# "currency": "USDT",
|
1665
|
+
# "action": "1",
|
1666
|
+
# "tradeType": "1",
|
1667
|
+
# "execQtyRq": "0.003",
|
1668
|
+
# "execPriceRp": "64935",
|
1669
|
+
# "side": "2",
|
1670
|
+
# "orderQtyRq": "0.003",
|
1671
|
+
# "priceRp": "51600",
|
1672
|
+
# "execValueRv": "194.805",
|
1673
|
+
# "feeRateRr": "0.000495",
|
1674
|
+
# "execFeeRv": "0",
|
1675
|
+
# "ordType": "3",
|
1676
|
+
# "execId": "XXXXXX",
|
1677
|
+
# "execStatus": "7",
|
1678
|
+
# "posSide": "1",
|
1679
|
+
# "ptFeeRv": "0.110012249248",
|
1680
|
+
# "ptPriceRp": "0.876524893"
|
1661
1681
|
#
|
1662
1682
|
priceString: Str
|
1663
1683
|
amountString: Str
|
@@ -1706,10 +1726,16 @@ class phemex(Exchange, ImplicitAPI):
|
|
1706
1726
|
priceString = self.safe_string(trade, 'execPriceRp')
|
1707
1727
|
amountString = self.safe_string(trade, 'execQtyRq')
|
1708
1728
|
costString = self.safe_string(trade, 'execValueRv')
|
1709
|
-
feeCostString = self.safe_string(trade, 'execFeeRv')
|
1729
|
+
feeCostString = self.omit_zero(self.safe_string(trade, 'execFeeRv'))
|
1710
1730
|
feeRateString = self.safe_string(trade, 'feeRateRr')
|
1711
|
-
|
1712
|
-
|
1731
|
+
if feeCostString is not None:
|
1732
|
+
currencyId = self.safe_string(trade, 'currency')
|
1733
|
+
feeCurrencyCode = self.safe_currency_code(currencyId)
|
1734
|
+
else:
|
1735
|
+
ptFeeRv = self.omit_zero(self.safe_string(trade, 'ptFeeRv'))
|
1736
|
+
if ptFeeRv is not None:
|
1737
|
+
feeCostString = ptFeeRv
|
1738
|
+
feeCurrencyCode = 'PT'
|
1713
1739
|
else:
|
1714
1740
|
side = self.safe_string_lower(trade, 'side')
|
1715
1741
|
type = self.parse_order_type(self.safe_string(trade, 'ordType'))
|
@@ -1720,7 +1746,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
1720
1746
|
amountString = self.from_ev(self.safe_string(trade, 'execBaseQtyEv'), market)
|
1721
1747
|
amountString = self.safe_string(trade, 'execQty', amountString)
|
1722
1748
|
costString = self.from_er(self.safe_string_2(trade, 'execQuoteQtyEv', 'execValueEv'), market)
|
1723
|
-
feeCostString = self.from_er(self.safe_string(trade, 'execFeeEv'), market)
|
1749
|
+
feeCostString = self.from_er(self.omit_zero(self.safe_string(trade, 'execFeeEv')), market)
|
1724
1750
|
if feeCostString is not None:
|
1725
1751
|
feeRateString = self.from_er(self.safe_string(trade, 'feeRateEr'), market)
|
1726
1752
|
if market['spot']:
|
@@ -1730,6 +1756,10 @@ class phemex(Exchange, ImplicitAPI):
|
|
1730
1756
|
if info is not None:
|
1731
1757
|
settlementCurrencyId = self.safe_string(info, 'settlementCurrency')
|
1732
1758
|
feeCurrencyCode = self.safe_currency_code(settlementCurrencyId)
|
1759
|
+
else:
|
1760
|
+
feeCostString = self.safe_string(trade, 'ptFeeRv')
|
1761
|
+
if feeCostString is not None:
|
1762
|
+
feeCurrencyCode = 'PT'
|
1733
1763
|
fee = {
|
1734
1764
|
'cost': feeCostString,
|
1735
1765
|
'rate': feeRateString,
|
@@ -3790,7 +3820,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
3790
3820
|
}
|
3791
3821
|
return self.safe_string(statuses, status, status)
|
3792
3822
|
|
3793
|
-
def parse_margin_modification(self, data, market: Market = None) -> MarginModification:
|
3823
|
+
def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
|
3794
3824
|
#
|
3795
3825
|
# {
|
3796
3826
|
# "code": 0,
|