Update leverage tier terminology to be clear and aligned with ccxt
This commit is contained in:
parent
53d46a0385
commit
753d1b2aad
@ -2316,10 +2316,10 @@ class Exchange:
|
||||
def parse_leverage_tier(self, tier) -> Dict:
|
||||
info = tier.get('info', {})
|
||||
return {
|
||||
'min': tier['minNotional'],
|
||||
'max': tier['maxNotional'],
|
||||
'mmr': tier['maintenanceMarginRate'],
|
||||
'lev': tier['maxLeverage'],
|
||||
'minNotional': tier['minNotional'],
|
||||
'maxNotional': tier['maxNotional'],
|
||||
'maintenanceMarginRate': tier['maintenanceMarginRate'],
|
||||
'maxLeverage': tier['maxLeverage'],
|
||||
'maintAmt': float(info['cum']) if 'cum' in info else None,
|
||||
}
|
||||
|
||||
@ -2348,18 +2348,18 @@ class Exchange:
|
||||
pair_tiers = self._leverage_tiers[pair]
|
||||
|
||||
if stake_amount == 0:
|
||||
return self._leverage_tiers[pair][0]['lev'] # Max lev for lowest amount
|
||||
return self._leverage_tiers[pair][0]['maxLeverage'] # Max lev for lowest amount
|
||||
|
||||
for tier_index in range(len(pair_tiers)):
|
||||
|
||||
tier = pair_tiers[tier_index]
|
||||
lev = tier['lev']
|
||||
lev = tier['maxLeverage']
|
||||
|
||||
if tier_index < len(pair_tiers) - 1:
|
||||
next_tier = pair_tiers[tier_index + 1]
|
||||
next_floor = next_tier['min'] / next_tier['lev']
|
||||
next_floor = next_tier['minNotional'] / next_tier['maxLeverage']
|
||||
if next_floor > stake_amount: # Next tier min too high for stake amount
|
||||
return min((tier['max'] / stake_amount), lev)
|
||||
return min((tier['maxNotional'] / stake_amount), lev)
|
||||
#
|
||||
# With the two leverage tiers below,
|
||||
# - a stake amount of 150 would mean a max leverage of (10000 / 150) = 66.66
|
||||
@ -2380,10 +2380,11 @@ class Exchange:
|
||||
#
|
||||
|
||||
else: # if on the last tier
|
||||
if stake_amount > tier['max']: # If stake is > than max tradeable amount
|
||||
if stake_amount > tier['maxNotional']:
|
||||
# If stake is > than max tradeable amount
|
||||
raise InvalidOrderException(f'Amount {stake_amount} too high for {pair}')
|
||||
else:
|
||||
return tier['lev']
|
||||
return tier['maxLeverage']
|
||||
|
||||
raise OperationalException(
|
||||
'Looped through all tiers without finding a max leverage. Should never be reached'
|
||||
@ -2749,8 +2750,8 @@ class Exchange:
|
||||
pair_tiers = self._leverage_tiers[pair]
|
||||
|
||||
for tier in reversed(pair_tiers):
|
||||
if nominal_value >= tier['min']:
|
||||
return (tier['mmr'], tier['maintAmt'])
|
||||
if nominal_value >= tier['minNotional']:
|
||||
return (tier['maintenanceMarginRate'], tier['maintAmt'])
|
||||
|
||||
raise OperationalException("nominal value can not be lower than 0")
|
||||
# The lowest notional_floor for any pair in fetch_leverage_tiers is always 0 because it
|
||||
|
@ -146,4 +146,4 @@ class Okx(Exchange):
|
||||
return float('inf')
|
||||
|
||||
pair_tiers = self._leverage_tiers[pair]
|
||||
return pair_tiers[-1]['max'] / leverage
|
||||
return pair_tiers[-1]['maxNotional'] / leverage
|
||||
|
@ -3085,416 +3085,416 @@ def leverage_tiers():
|
||||
return {
|
||||
"1000SHIB/USDT": [
|
||||
{
|
||||
'min': 0,
|
||||
'max': 50000,
|
||||
'mmr': 0.01,
|
||||
'lev': 50,
|
||||
'minNotional': 0,
|
||||
'maxNotional': 50000,
|
||||
'maintenanceMarginRate': 0.01,
|
||||
'maxLeverage': 50,
|
||||
'maintAmt': 0.0
|
||||
},
|
||||
{
|
||||
'min': 50000,
|
||||
'max': 150000,
|
||||
'mmr': 0.025,
|
||||
'lev': 20,
|
||||
'minNotional': 50000,
|
||||
'maxNotional': 150000,
|
||||
'maintenanceMarginRate': 0.025,
|
||||
'maxLeverage': 20,
|
||||
'maintAmt': 750.0
|
||||
},
|
||||
{
|
||||
'min': 150000,
|
||||
'max': 250000,
|
||||
'mmr': 0.05,
|
||||
'lev': 10,
|
||||
'minNotional': 150000,
|
||||
'maxNotional': 250000,
|
||||
'maintenanceMarginRate': 0.05,
|
||||
'maxLeverage': 10,
|
||||
'maintAmt': 4500.0
|
||||
},
|
||||
{
|
||||
'min': 250000,
|
||||
'max': 500000,
|
||||
'mmr': 0.1,
|
||||
'lev': 5,
|
||||
'minNotional': 250000,
|
||||
'maxNotional': 500000,
|
||||
'maintenanceMarginRate': 0.1,
|
||||
'maxLeverage': 5,
|
||||
'maintAmt': 17000.0
|
||||
},
|
||||
{
|
||||
'min': 500000,
|
||||
'max': 1000000,
|
||||
'mmr': 0.125,
|
||||
'lev': 4,
|
||||
'minNotional': 500000,
|
||||
'maxNotional': 1000000,
|
||||
'maintenanceMarginRate': 0.125,
|
||||
'maxLeverage': 4,
|
||||
'maintAmt': 29500.0
|
||||
},
|
||||
{
|
||||
'min': 1000000,
|
||||
'max': 2000000,
|
||||
'mmr': 0.25,
|
||||
'lev': 2,
|
||||
'minNotional': 1000000,
|
||||
'maxNotional': 2000000,
|
||||
'maintenanceMarginRate': 0.25,
|
||||
'maxLeverage': 2,
|
||||
'maintAmt': 154500.0
|
||||
},
|
||||
{
|
||||
'min': 2000000,
|
||||
'max': 30000000,
|
||||
'mmr': 0.5,
|
||||
'lev': 1,
|
||||
'minNotional': 2000000,
|
||||
'maxNotional': 30000000,
|
||||
'maintenanceMarginRate': 0.5,
|
||||
'maxLeverage': 1,
|
||||
'maintAmt': 654500.0
|
||||
},
|
||||
],
|
||||
"1INCH/USDT": [
|
||||
{
|
||||
'min': 0,
|
||||
'max': 5000,
|
||||
'mmr': 0.012,
|
||||
'lev': 50,
|
||||
'minNotional': 0,
|
||||
'maxNotional': 5000,
|
||||
'maintenanceMarginRate': 0.012,
|
||||
'maxLeverage': 50,
|
||||
'maintAmt': 0.0
|
||||
},
|
||||
{
|
||||
'min': 5000,
|
||||
'max': 25000,
|
||||
'mmr': 0.025,
|
||||
'lev': 20,
|
||||
'minNotional': 5000,
|
||||
'maxNotional': 25000,
|
||||
'maintenanceMarginRate': 0.025,
|
||||
'maxLeverage': 20,
|
||||
'maintAmt': 65.0
|
||||
},
|
||||
{
|
||||
'min': 25000,
|
||||
'max': 100000,
|
||||
'mmr': 0.05,
|
||||
'lev': 10,
|
||||
'minNotional': 25000,
|
||||
'maxNotional': 100000,
|
||||
'maintenanceMarginRate': 0.05,
|
||||
'maxLeverage': 10,
|
||||
'maintAmt': 690.0
|
||||
},
|
||||
{
|
||||
'min': 100000,
|
||||
'max': 250000,
|
||||
'mmr': 0.1,
|
||||
'lev': 5,
|
||||
'minNotional': 100000,
|
||||
'maxNotional': 250000,
|
||||
'maintenanceMarginRate': 0.1,
|
||||
'maxLeverage': 5,
|
||||
'maintAmt': 5690.0
|
||||
},
|
||||
{
|
||||
'min': 250000,
|
||||
'max': 1000000,
|
||||
'mmr': 0.125,
|
||||
'lev': 2,
|
||||
'minNotional': 250000,
|
||||
'maxNotional': 1000000,
|
||||
'maintenanceMarginRate': 0.125,
|
||||
'maxLeverage': 2,
|
||||
'maintAmt': 11940.0
|
||||
},
|
||||
{
|
||||
'min': 1000000,
|
||||
'max': 100000000,
|
||||
'mmr': 0.5,
|
||||
'lev': 1,
|
||||
'minNotional': 1000000,
|
||||
'maxNotional': 100000000,
|
||||
'maintenanceMarginRate': 0.5,
|
||||
'maxLeverage': 1,
|
||||
'maintAmt': 386940.0
|
||||
},
|
||||
],
|
||||
"AAVE/USDT": [
|
||||
{
|
||||
'min': 0,
|
||||
'max': 5000,
|
||||
'mmr': 0.01,
|
||||
'lev': 50,
|
||||
'minNotional': 0,
|
||||
'maxNotional': 5000,
|
||||
'maintenanceMarginRate': 0.01,
|
||||
'maxLeverage': 50,
|
||||
'maintAmt': 0.0
|
||||
},
|
||||
{
|
||||
'min': 5000,
|
||||
'max': 25000,
|
||||
'mmr': 0.02,
|
||||
'lev': 25,
|
||||
'minNotional': 5000,
|
||||
'maxNotional': 25000,
|
||||
'maintenanceMarginRate': 0.02,
|
||||
'maxLeverage': 25,
|
||||
'maintAmt': 75.0
|
||||
},
|
||||
{
|
||||
'min': 25000,
|
||||
'max': 100000,
|
||||
'mmr': 0.05,
|
||||
'lev': 10,
|
||||
'minNotional': 25000,
|
||||
'maxNotional': 100000,
|
||||
'maintenanceMarginRate': 0.05,
|
||||
'maxLeverage': 10,
|
||||
'maintAmt': 700.0
|
||||
},
|
||||
{
|
||||
'min': 100000,
|
||||
'max': 250000,
|
||||
'mmr': 0.1,
|
||||
'lev': 5,
|
||||
'minNotional': 100000,
|
||||
'maxNotional': 250000,
|
||||
'maintenanceMarginRate': 0.1,
|
||||
'maxLeverage': 5,
|
||||
'maintAmt': 5700.0
|
||||
},
|
||||
{
|
||||
'min': 250000,
|
||||
'max': 1000000,
|
||||
'mmr': 0.125,
|
||||
'lev': 2,
|
||||
'minNotional': 250000,
|
||||
'maxNotional': 1000000,
|
||||
'maintenanceMarginRate': 0.125,
|
||||
'maxLeverage': 2,
|
||||
'maintAmt': 11950.0
|
||||
},
|
||||
{
|
||||
'min': 10000000,
|
||||
'max': 50000000,
|
||||
'mmr': 0.5,
|
||||
'lev': 1,
|
||||
'minNotional': 10000000,
|
||||
'maxNotional': 50000000,
|
||||
'maintenanceMarginRate': 0.5,
|
||||
'maxLeverage': 1,
|
||||
'maintAmt': 386950.0
|
||||
},
|
||||
],
|
||||
"ADA/BUSD": [
|
||||
{
|
||||
"min": 0,
|
||||
"max": 100000,
|
||||
"mmr": 0.025,
|
||||
"lev": 20,
|
||||
"minNotional": 0,
|
||||
"maxNotional": 100000,
|
||||
"maintenanceMarginRate": 0.025,
|
||||
"maxLeverage": 20,
|
||||
"maintAmt": 0.0
|
||||
},
|
||||
{
|
||||
"min": 100000,
|
||||
"max": 500000,
|
||||
"mmr": 0.05,
|
||||
"lev": 10,
|
||||
"minNotional": 100000,
|
||||
"maxNotional": 500000,
|
||||
"maintenanceMarginRate": 0.05,
|
||||
"maxLeverage": 10,
|
||||
"maintAmt": 2500.0
|
||||
},
|
||||
{
|
||||
"min": 500000,
|
||||
"max": 1000000,
|
||||
"mmr": 0.1,
|
||||
"lev": 5,
|
||||
"minNotional": 500000,
|
||||
"maxNotional": 1000000,
|
||||
"maintenanceMarginRate": 0.1,
|
||||
"maxLeverage": 5,
|
||||
"maintAmt": 27500.0
|
||||
},
|
||||
{
|
||||
"min": 1000000,
|
||||
"max": 2000000,
|
||||
"mmr": 0.15,
|
||||
"lev": 3,
|
||||
"minNotional": 1000000,
|
||||
"maxNotional": 2000000,
|
||||
"maintenanceMarginRate": 0.15,
|
||||
"maxLeverage": 3,
|
||||
"maintAmt": 77500.0
|
||||
},
|
||||
{
|
||||
"min": 2000000,
|
||||
"max": 5000000,
|
||||
"mmr": 0.25,
|
||||
"lev": 2,
|
||||
"minNotional": 2000000,
|
||||
"maxNotional": 5000000,
|
||||
"maintenanceMarginRate": 0.25,
|
||||
"maxLeverage": 2,
|
||||
"maintAmt": 277500.0
|
||||
},
|
||||
{
|
||||
"min": 5000000,
|
||||
"max": 30000000,
|
||||
"mmr": 0.5,
|
||||
"lev": 1,
|
||||
"minNotional": 5000000,
|
||||
"maxNotional": 30000000,
|
||||
"maintenanceMarginRate": 0.5,
|
||||
"maxLeverage": 1,
|
||||
"maintAmt": 1527500.0
|
||||
},
|
||||
],
|
||||
'BNB/BUSD': [
|
||||
{
|
||||
"min": 0, # stake(before leverage) = 0
|
||||
"max": 100000, # max stake(before leverage) = 5000
|
||||
"mmr": 0.025,
|
||||
"lev": 20,
|
||||
"minNotional": 0, # stake(before leverage) = 0
|
||||
"maxNotional": 100000, # max stake(before leverage) = 5000
|
||||
"maintenanceMarginRate": 0.025,
|
||||
"maxLeverage": 20,
|
||||
"maintAmt": 0.0
|
||||
},
|
||||
{
|
||||
"min": 100000, # stake = 10000.0
|
||||
"max": 500000, # max_stake = 50000.0
|
||||
"mmr": 0.05,
|
||||
"lev": 10,
|
||||
"minNotional": 100000, # stake = 10000.0
|
||||
"maxNotional": 500000, # max_stake = 50000.0
|
||||
"maintenanceMarginRate": 0.05,
|
||||
"maxLeverage": 10,
|
||||
"maintAmt": 2500.0
|
||||
},
|
||||
{
|
||||
"min": 500000, # stake = 100000.0
|
||||
"max": 1000000, # max_stake = 200000.0
|
||||
"mmr": 0.1,
|
||||
"lev": 5,
|
||||
"minNotional": 500000, # stake = 100000.0
|
||||
"maxNotional": 1000000, # max_stake = 200000.0
|
||||
"maintenanceMarginRate": 0.1,
|
||||
"maxLeverage": 5,
|
||||
"maintAmt": 27500.0
|
||||
},
|
||||
{
|
||||
"min": 1000000, # stake = 333333.3333333333
|
||||
"max": 2000000, # max_stake = 666666.6666666666
|
||||
"mmr": 0.15,
|
||||
"lev": 3,
|
||||
"minNotional": 1000000, # stake = 333333.3333333333
|
||||
"maxNotional": 2000000, # max_stake = 666666.6666666666
|
||||
"maintenanceMarginRate": 0.15,
|
||||
"maxLeverage": 3,
|
||||
"maintAmt": 77500.0
|
||||
},
|
||||
{
|
||||
"min": 2000000, # stake = 1000000.0
|
||||
"max": 5000000, # max_stake = 2500000.0
|
||||
"mmr": 0.25,
|
||||
"lev": 2,
|
||||
"minNotional": 2000000, # stake = 1000000.0
|
||||
"maxNotional": 5000000, # max_stake = 2500000.0
|
||||
"maintenanceMarginRate": 0.25,
|
||||
"maxLeverage": 2,
|
||||
"maintAmt": 277500.0
|
||||
},
|
||||
{
|
||||
"min": 5000000, # stake = 5000000.0
|
||||
"max": 30000000, # max_stake = 30000000.0
|
||||
"mmr": 0.5,
|
||||
"lev": 1,
|
||||
"minNotional": 5000000, # stake = 5000000.0
|
||||
"maxNotional": 30000000, # max_stake = 30000000.0
|
||||
"maintenanceMarginRate": 0.5,
|
||||
"maxLeverage": 1,
|
||||
"maintAmt": 1527500.0
|
||||
}
|
||||
],
|
||||
'BNB/USDT': [
|
||||
{
|
||||
"min": 0, # stake = 0.0
|
||||
"max": 10000, # max_stake = 133.33333333333334
|
||||
"mmr": 0.0065,
|
||||
"lev": 75,
|
||||
"minNotional": 0, # stake = 0.0
|
||||
"maxNotional": 10000, # max_stake = 133.33333333333334
|
||||
"maintenanceMarginRate": 0.0065,
|
||||
"maxLeverage": 75,
|
||||
"maintAmt": 0.0
|
||||
},
|
||||
{
|
||||
"min": 10000, # stake = 200.0
|
||||
"max": 50000, # max_stake = 1000.0
|
||||
"mmr": 0.01,
|
||||
"lev": 50,
|
||||
"minNotional": 10000, # stake = 200.0
|
||||
"maxNotional": 50000, # max_stake = 1000.0
|
||||
"maintenanceMarginRate": 0.01,
|
||||
"maxLeverage": 50,
|
||||
"maintAmt": 35.0
|
||||
},
|
||||
{
|
||||
"min": 50000, # stake = 2000.0
|
||||
"max": 250000, # max_stake = 10000.0
|
||||
"mmr": 0.02,
|
||||
"lev": 25,
|
||||
"minNotional": 50000, # stake = 2000.0
|
||||
"maxNotional": 250000, # max_stake = 10000.0
|
||||
"maintenanceMarginRate": 0.02,
|
||||
"maxLeverage": 25,
|
||||
"maintAmt": 535.0
|
||||
},
|
||||
{
|
||||
"min": 250000, # stake = 25000.0
|
||||
"max": 1000000, # max_stake = 100000.0
|
||||
"mmr": 0.05,
|
||||
"lev": 10,
|
||||
"minNotional": 250000, # stake = 25000.0
|
||||
"maxNotional": 1000000, # max_stake = 100000.0
|
||||
"maintenanceMarginRate": 0.05,
|
||||
"maxLeverage": 10,
|
||||
"maintAmt": 8035.0
|
||||
},
|
||||
{
|
||||
"min": 1000000, # stake = 200000.0
|
||||
"max": 2000000, # max_stake = 400000.0
|
||||
"mmr": 0.1,
|
||||
"lev": 5,
|
||||
"minNotional": 1000000, # stake = 200000.0
|
||||
"maxNotional": 2000000, # max_stake = 400000.0
|
||||
"maintenanceMarginRate": 0.1,
|
||||
"maxLeverage": 5,
|
||||
"maintAmt": 58035.0
|
||||
},
|
||||
{
|
||||
"min": 2000000, # stake = 500000.0
|
||||
"max": 5000000, # max_stake = 1250000.0
|
||||
"mmr": 0.125,
|
||||
"lev": 4,
|
||||
"minNotional": 2000000, # stake = 500000.0
|
||||
"maxNotional": 5000000, # max_stake = 1250000.0
|
||||
"maintenanceMarginRate": 0.125,
|
||||
"maxLeverage": 4,
|
||||
"maintAmt": 108035.0
|
||||
},
|
||||
{
|
||||
"min": 5000000, # stake = 1666666.6666666667
|
||||
"max": 10000000, # max_stake = 3333333.3333333335
|
||||
"mmr": 0.15,
|
||||
"lev": 3,
|
||||
"minNotional": 5000000, # stake = 1666666.6666666667
|
||||
"maxNotional": 10000000, # max_stake = 3333333.3333333335
|
||||
"maintenanceMarginRate": 0.15,
|
||||
"maxLeverage": 3,
|
||||
"maintAmt": 233035.0
|
||||
},
|
||||
{
|
||||
"min": 10000000, # stake = 5000000.0
|
||||
"max": 20000000, # max_stake = 10000000.0
|
||||
"mmr": 0.25,
|
||||
"lev": 2,
|
||||
"minNotional": 10000000, # stake = 5000000.0
|
||||
"maxNotional": 20000000, # max_stake = 10000000.0
|
||||
"maintenanceMarginRate": 0.25,
|
||||
"maxLeverage": 2,
|
||||
"maintAmt": 1233035.0
|
||||
},
|
||||
{
|
||||
"min": 20000000, # stake = 20000000.0
|
||||
"max": 50000000, # max_stake = 50000000.0
|
||||
"mmr": 0.5,
|
||||
"lev": 1,
|
||||
"minNotional": 20000000, # stake = 20000000.0
|
||||
"maxNotional": 50000000, # max_stake = 50000000.0
|
||||
"maintenanceMarginRate": 0.5,
|
||||
"maxLeverage": 1,
|
||||
"maintAmt": 6233035.0
|
||||
},
|
||||
],
|
||||
'BTC/USDT': [
|
||||
{
|
||||
"min": 0, # stake = 0.0
|
||||
"max": 50000, # max_stake = 400.0
|
||||
"mmr": 0.004,
|
||||
"lev": 125,
|
||||
"minNotional": 0, # stake = 0.0
|
||||
"maxNotional": 50000, # max_stake = 400.0
|
||||
"maintenanceMarginRate": 0.004,
|
||||
"maxLeverage": 125,
|
||||
"maintAmt": 0.0
|
||||
},
|
||||
{
|
||||
"min": 50000, # stake = 500.0
|
||||
"max": 250000, # max_stake = 2500.0
|
||||
"mmr": 0.005,
|
||||
"lev": 100,
|
||||
"minNotional": 50000, # stake = 500.0
|
||||
"maxNotional": 250000, # max_stake = 2500.0
|
||||
"maintenanceMarginRate": 0.005,
|
||||
"maxLeverage": 100,
|
||||
"maintAmt": 50.0
|
||||
},
|
||||
{
|
||||
"min": 250000, # stake = 5000.0
|
||||
"max": 1000000, # max_stake = 20000.0
|
||||
"mmr": 0.01,
|
||||
"lev": 50,
|
||||
"minNotional": 250000, # stake = 5000.0
|
||||
"maxNotional": 1000000, # max_stake = 20000.0
|
||||
"maintenanceMarginRate": 0.01,
|
||||
"maxLeverage": 50,
|
||||
"maintAmt": 1300.0
|
||||
},
|
||||
{
|
||||
"min": 1000000, # stake = 50000.0
|
||||
"max": 7500000, # max_stake = 375000.0
|
||||
"mmr": 0.025,
|
||||
"lev": 20,
|
||||
"minNotional": 1000000, # stake = 50000.0
|
||||
"maxNotional": 7500000, # max_stake = 375000.0
|
||||
"maintenanceMarginRate": 0.025,
|
||||
"maxLeverage": 20,
|
||||
"maintAmt": 16300.0
|
||||
},
|
||||
{
|
||||
"min": 7500000, # stake = 750000.0
|
||||
"max": 40000000, # max_stake = 4000000.0
|
||||
"mmr": 0.05,
|
||||
"lev": 10,
|
||||
"minNotional": 7500000, # stake = 750000.0
|
||||
"maxNotional": 40000000, # max_stake = 4000000.0
|
||||
"maintenanceMarginRate": 0.05,
|
||||
"maxLeverage": 10,
|
||||
"maintAmt": 203800.0
|
||||
},
|
||||
{
|
||||
"min": 40000000, # stake = 8000000.0
|
||||
"max": 100000000, # max_stake = 20000000.0
|
||||
"mmr": 0.1,
|
||||
"lev": 5,
|
||||
"minNotional": 40000000, # stake = 8000000.0
|
||||
"maxNotional": 100000000, # max_stake = 20000000.0
|
||||
"maintenanceMarginRate": 0.1,
|
||||
"maxLeverage": 5,
|
||||
"maintAmt": 2203800.0
|
||||
},
|
||||
{
|
||||
"min": 100000000, # stake = 25000000.0
|
||||
"max": 200000000, # max_stake = 50000000.0
|
||||
"mmr": 0.125,
|
||||
"lev": 4,
|
||||
"minNotional": 100000000, # stake = 25000000.0
|
||||
"maxNotional": 200000000, # max_stake = 50000000.0
|
||||
"maintenanceMarginRate": 0.125,
|
||||
"maxLeverage": 4,
|
||||
"maintAmt": 4703800.0
|
||||
},
|
||||
{
|
||||
"min": 200000000, # stake = 66666666.666666664
|
||||
"max": 400000000, # max_stake = 133333333.33333333
|
||||
"mmr": 0.15,
|
||||
"lev": 3,
|
||||
"minNotional": 200000000, # stake = 66666666.666666664
|
||||
"maxNotional": 400000000, # max_stake = 133333333.33333333
|
||||
"maintenanceMarginRate": 0.15,
|
||||
"maxLeverage": 3,
|
||||
"maintAmt": 9703800.0
|
||||
},
|
||||
{
|
||||
"min": 400000000, # stake = 200000000.0
|
||||
"max": 600000000, # max_stake = 300000000.0
|
||||
"mmr": 0.25,
|
||||
"lev": 2,
|
||||
"minNotional": 400000000, # stake = 200000000.0
|
||||
"maxNotional": 600000000, # max_stake = 300000000.0
|
||||
"maintenanceMarginRate": 0.25,
|
||||
"maxLeverage": 2,
|
||||
"maintAmt": 4.97038E7
|
||||
},
|
||||
{
|
||||
"min": 600000000, # stake = 600000000.0
|
||||
"max": 1000000000, # max_stake = 1000000000.0
|
||||
"mmr": 0.5,
|
||||
"lev": 1,
|
||||
"minNotional": 600000000, # stake = 600000000.0
|
||||
"maxNotional": 1000000000, # max_stake = 1000000000.0
|
||||
"maintenanceMarginRate": 0.5,
|
||||
"maxLeverage": 1,
|
||||
"maintAmt": 1.997038E8
|
||||
},
|
||||
],
|
||||
"ZEC/USDT": [
|
||||
{
|
||||
'min': 0,
|
||||
'max': 50000,
|
||||
'mmr': 0.01,
|
||||
'lev': 50,
|
||||
'minNotional': 0,
|
||||
'maxNotional': 50000,
|
||||
'maintenanceMarginRate': 0.01,
|
||||
'maxLeverage': 50,
|
||||
'maintAmt': 0.0
|
||||
},
|
||||
{
|
||||
'min': 50000,
|
||||
'max': 150000,
|
||||
'mmr': 0.025,
|
||||
'lev': 20,
|
||||
'minNotional': 50000,
|
||||
'maxNotional': 150000,
|
||||
'maintenanceMarginRate': 0.025,
|
||||
'maxLeverage': 20,
|
||||
'maintAmt': 750.0
|
||||
},
|
||||
{
|
||||
'min': 150000,
|
||||
'max': 250000,
|
||||
'mmr': 0.05,
|
||||
'lev': 10,
|
||||
'minNotional': 150000,
|
||||
'maxNotional': 250000,
|
||||
'maintenanceMarginRate': 0.05,
|
||||
'maxLeverage': 10,
|
||||
'maintAmt': 4500.0
|
||||
},
|
||||
{
|
||||
'min': 250000,
|
||||
'max': 500000,
|
||||
'mmr': 0.1,
|
||||
'lev': 5,
|
||||
'minNotional': 250000,
|
||||
'maxNotional': 500000,
|
||||
'maintenanceMarginRate': 0.1,
|
||||
'maxLeverage': 5,
|
||||
'maintAmt': 17000.0
|
||||
},
|
||||
{
|
||||
'min': 500000,
|
||||
'max': 1000000,
|
||||
'mmr': 0.125,
|
||||
'lev': 4,
|
||||
'minNotional': 500000,
|
||||
'maxNotional': 1000000,
|
||||
'maintenanceMarginRate': 0.125,
|
||||
'maxLeverage': 4,
|
||||
'maintAmt': 29500.0
|
||||
},
|
||||
{
|
||||
'min': 1000000,
|
||||
'max': 2000000,
|
||||
'mmr': 0.25,
|
||||
'lev': 2,
|
||||
'minNotional': 1000000,
|
||||
'maxNotional': 2000000,
|
||||
'maintenanceMarginRate': 0.25,
|
||||
'maxLeverage': 2,
|
||||
'maintAmt': 154500.0
|
||||
},
|
||||
{
|
||||
'min': 2000000,
|
||||
'max': 30000000,
|
||||
'mmr': 0.5,
|
||||
'lev': 1,
|
||||
'minNotional': 2000000,
|
||||
'maxNotional': 30000000,
|
||||
'maintenanceMarginRate': 0.5,
|
||||
'maxLeverage': 1,
|
||||
'maintAmt': 654500.0
|
||||
},
|
||||
]
|
||||
|
@ -376,96 +376,96 @@ def test_fill_leverage_tiers_binance(default_conf, mocker):
|
||||
assert exchange._leverage_tiers == {
|
||||
'ADA/BUSD': [
|
||||
{
|
||||
"min": 0,
|
||||
"max": 100000,
|
||||
"mmr": 0.025,
|
||||
"lev": 20,
|
||||
"minNotional": 0,
|
||||
"maxNotional": 100000,
|
||||
"maintenanceMarginRate": 0.025,
|
||||
"maxLeverage": 20,
|
||||
"maintAmt": 0.0
|
||||
},
|
||||
{
|
||||
"min": 100000,
|
||||
"max": 500000,
|
||||
"mmr": 0.05,
|
||||
"lev": 10,
|
||||
"minNotional": 100000,
|
||||
"maxNotional": 500000,
|
||||
"maintenanceMarginRate": 0.05,
|
||||
"maxLeverage": 10,
|
||||
"maintAmt": 2500.0
|
||||
},
|
||||
{
|
||||
"min": 500000,
|
||||
"max": 1000000,
|
||||
"mmr": 0.1,
|
||||
"lev": 5,
|
||||
"minNotional": 500000,
|
||||
"maxNotional": 1000000,
|
||||
"maintenanceMarginRate": 0.1,
|
||||
"maxLeverage": 5,
|
||||
"maintAmt": 27500.0
|
||||
},
|
||||
{
|
||||
"min": 1000000,
|
||||
"max": 2000000,
|
||||
"mmr": 0.15,
|
||||
"lev": 3,
|
||||
"minNotional": 1000000,
|
||||
"maxNotional": 2000000,
|
||||
"maintenanceMarginRate": 0.15,
|
||||
"maxLeverage": 3,
|
||||
"maintAmt": 77500.0
|
||||
},
|
||||
{
|
||||
"min": 2000000,
|
||||
"max": 5000000,
|
||||
"mmr": 0.25,
|
||||
"lev": 2,
|
||||
"minNotional": 2000000,
|
||||
"maxNotional": 5000000,
|
||||
"maintenanceMarginRate": 0.25,
|
||||
"maxLeverage": 2,
|
||||
"maintAmt": 277500.0
|
||||
},
|
||||
{
|
||||
"min": 5000000,
|
||||
"max": 30000000,
|
||||
"mmr": 0.5,
|
||||
"lev": 1,
|
||||
"minNotional": 5000000,
|
||||
"maxNotional": 30000000,
|
||||
"maintenanceMarginRate": 0.5,
|
||||
"maxLeverage": 1,
|
||||
"maintAmt": 1527500.0
|
||||
}
|
||||
],
|
||||
"ZEC/USDT": [
|
||||
{
|
||||
'min': 0,
|
||||
'max': 50000,
|
||||
'mmr': 0.01,
|
||||
'lev': 50,
|
||||
'minNotional': 0,
|
||||
'maxNotional': 50000,
|
||||
'maintenanceMarginRate': 0.01,
|
||||
'maxLeverage': 50,
|
||||
'maintAmt': 0.0
|
||||
},
|
||||
{
|
||||
'min': 50000,
|
||||
'max': 150000,
|
||||
'mmr': 0.025,
|
||||
'lev': 20,
|
||||
'minNotional': 50000,
|
||||
'maxNotional': 150000,
|
||||
'maintenanceMarginRate': 0.025,
|
||||
'maxLeverage': 20,
|
||||
'maintAmt': 750.0
|
||||
},
|
||||
{
|
||||
'min': 150000,
|
||||
'max': 250000,
|
||||
'mmr': 0.05,
|
||||
'lev': 10,
|
||||
'minNotional': 150000,
|
||||
'maxNotional': 250000,
|
||||
'maintenanceMarginRate': 0.05,
|
||||
'maxLeverage': 10,
|
||||
'maintAmt': 4500.0
|
||||
},
|
||||
{
|
||||
'min': 250000,
|
||||
'max': 500000,
|
||||
'mmr': 0.1,
|
||||
'lev': 5,
|
||||
'minNotional': 250000,
|
||||
'maxNotional': 500000,
|
||||
'maintenanceMarginRate': 0.1,
|
||||
'maxLeverage': 5,
|
||||
'maintAmt': 17000.0
|
||||
},
|
||||
{
|
||||
'min': 500000,
|
||||
'max': 1000000,
|
||||
'mmr': 0.125,
|
||||
'lev': 4,
|
||||
'minNotional': 500000,
|
||||
'maxNotional': 1000000,
|
||||
'maintenanceMarginRate': 0.125,
|
||||
'maxLeverage': 4,
|
||||
'maintAmt': 29500.0
|
||||
},
|
||||
{
|
||||
'min': 1000000,
|
||||
'max': 2000000,
|
||||
'mmr': 0.25,
|
||||
'lev': 2,
|
||||
'minNotional': 1000000,
|
||||
'maxNotional': 2000000,
|
||||
'maintenanceMarginRate': 0.25,
|
||||
'maxLeverage': 2,
|
||||
'maintAmt': 154500.0
|
||||
},
|
||||
{
|
||||
'min': 2000000,
|
||||
'max': 30000000,
|
||||
'mmr': 0.5,
|
||||
'lev': 1,
|
||||
'minNotional': 2000000,
|
||||
'maxNotional': 30000000,
|
||||
'maintenanceMarginRate': 0.5,
|
||||
'maxLeverage': 1,
|
||||
'maintAmt': 654500.0
|
||||
},
|
||||
]
|
||||
|
@ -4826,10 +4826,10 @@ def test_parse_leverage_tier(mocker, default_conf):
|
||||
}
|
||||
|
||||
assert exchange.parse_leverage_tier(tier) == {
|
||||
"min": 0,
|
||||
"max": 100000,
|
||||
"mmr": 0.025,
|
||||
"lev": 20,
|
||||
"minNotional": 0,
|
||||
"maxNotional": 100000,
|
||||
"maintenanceMarginRate": 0.025,
|
||||
"maxLeverage": 20,
|
||||
"maintAmt": 0.0,
|
||||
}
|
||||
|
||||
@ -4855,10 +4855,10 @@ def test_parse_leverage_tier(mocker, default_conf):
|
||||
}
|
||||
|
||||
assert exchange.parse_leverage_tier(tier2) == {
|
||||
'min': 0,
|
||||
'max': 2000,
|
||||
'mmr': 0.01,
|
||||
'lev': 75,
|
||||
'minNotional': 0,
|
||||
'maxNotional': 2000,
|
||||
'maintenanceMarginRate': 0.01,
|
||||
'maxLeverage': 75,
|
||||
"maintAmt": None,
|
||||
}
|
||||
|
||||
|
@ -414,47 +414,47 @@ def test_load_leverage_tiers_okx(default_conf, mocker, markets, tmpdir, caplog,
|
||||
assert exchange._leverage_tiers == {
|
||||
'ADA/USDT:USDT': [
|
||||
{
|
||||
'min': 0,
|
||||
'max': 500,
|
||||
'mmr': 0.02,
|
||||
'lev': 75,
|
||||
'minNotional': 0,
|
||||
'maxNotional': 500,
|
||||
'maintenanceMarginRate': 0.02,
|
||||
'maxLeverage': 75,
|
||||
'maintAmt': None
|
||||
},
|
||||
{
|
||||
'min': 501,
|
||||
'max': 1000,
|
||||
'mmr': 0.025,
|
||||
'lev': 50,
|
||||
'minNotional': 501,
|
||||
'maxNotional': 1000,
|
||||
'maintenanceMarginRate': 0.025,
|
||||
'maxLeverage': 50,
|
||||
'maintAmt': None
|
||||
},
|
||||
{
|
||||
'min': 1001,
|
||||
'max': 2000,
|
||||
'mmr': 0.03,
|
||||
'lev': 20,
|
||||
'minNotional': 1001,
|
||||
'maxNotional': 2000,
|
||||
'maintenanceMarginRate': 0.03,
|
||||
'maxLeverage': 20,
|
||||
'maintAmt': None
|
||||
},
|
||||
],
|
||||
'ETH/USDT:USDT': [
|
||||
{
|
||||
'min': 0,
|
||||
'max': 2000,
|
||||
'mmr': 0.01,
|
||||
'lev': 75,
|
||||
'minNotional': 0,
|
||||
'maxNotional': 2000,
|
||||
'maintenanceMarginRate': 0.01,
|
||||
'maxLeverage': 75,
|
||||
'maintAmt': None
|
||||
},
|
||||
{
|
||||
'min': 2001,
|
||||
'max': 4000,
|
||||
'mmr': 0.015,
|
||||
'lev': 50,
|
||||
'minNotional': 2001,
|
||||
'maxNotional': 4000,
|
||||
'maintenanceMarginRate': 0.015,
|
||||
'maxLeverage': 50,
|
||||
'maintAmt': None
|
||||
},
|
||||
{
|
||||
'min': 4001,
|
||||
'max': 8000,
|
||||
'mmr': 0.02,
|
||||
'lev': 20,
|
||||
'minNotional': 4001,
|
||||
'maxNotional': 8000,
|
||||
'maintenanceMarginRate': 0.02,
|
||||
'maxLeverage': 20,
|
||||
'maintAmt': None
|
||||
},
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user