Relax dry-run leverage test-case to simplify future updates

This commit is contained in:
Matthias 2022-05-21 16:23:29 +02:00
parent 97abcf4b32
commit 681ef13174
2 changed files with 155 additions and 106 deletions

View File

@ -3058,37 +3058,43 @@ def leverage_tiers():
'mmr': 0.01,
'lev': 50,
'maintAmt': 0.0
}, {
},
{
'min': 50000,
'max': 150000,
'mmr': 0.025,
'lev': 20,
'maintAmt': 750.0
}, {
},
{
'min': 150000,
'max': 250000,
'mmr': 0.05,
'lev': 10,
'maintAmt': 4500.0
}, {
},
{
'min': 250000,
'max': 500000,
'mmr': 0.1,
'lev': 5,
'maintAmt': 17000.0
}, {
},
{
'min': 500000,
'max': 1000000,
'mmr': 0.125,
'lev': 4,
'maintAmt': 29500.0
}, {
},
{
'min': 1000000,
'max': 2000000,
'mmr': 0.25,
'lev': 2,
'maintAmt': 154500.0
}, {
},
{
'min': 2000000,
'max': 30000000,
'mmr': 0.5,
@ -3103,31 +3109,36 @@ def leverage_tiers():
'mmr': 0.012,
'lev': 50,
'maintAmt': 0.0
}, {
},
{
'min': 5000,
'max': 25000,
'mmr': 0.025,
'lev': 20,
'maintAmt': 65.0
}, {
},
{
'min': 25000,
'max': 100000,
'mmr': 0.05,
'lev': 10,
'maintAmt': 690.0
}, {
},
{
'min': 100000,
'max': 250000,
'mmr': 0.1,
'lev': 5,
'maintAmt': 5690.0
}, {
},
{
'min': 250000,
'max': 1000000,
'mmr': 0.125,
'lev': 2,
'maintAmt': 11940.0
}, {
},
{
'min': 1000000,
'max': 100000000,
'mmr': 0.5,
@ -3142,43 +3153,50 @@ def leverage_tiers():
'mmr': 0.01,
'lev': 50,
'maintAmt': 0.0
}, {
},
{
'min': 50000,
'max': 250000,
'mmr': 0.02,
'lev': 25,
'maintAmt': 500.0
}, {
},
{
'min': 250000,
'max': 1000000,
'mmr': 0.05,
'lev': 10,
'maintAmt': 8000.0
}, {
},
{
'min': 1000000,
'max': 2000000,
'mmr': 0.1,
'lev': 5,
'maintAmt': 58000.0
}, {
},
{
'min': 2000000,
'max': 5000000,
'mmr': 0.125,
'lev': 4,
'maintAmt': 108000.0
}, {
},
{
'min': 5000000,
'max': 10000000,
'mmr': 0.1665,
'lev': 3,
'maintAmt': 315500.0
}, {
},
{
'min': 10000000,
'max': 20000000,
'mmr': 0.25,
'lev': 2,
'maintAmt': 1150500.0
}, {
},
{
"min": 20000000,
"max": 50000000,
"mmr": 0.5,
@ -3193,31 +3211,36 @@ def leverage_tiers():
"mmr": 0.025,
"lev": 20,
"maintAmt": 0.0
}, {
},
{
"min": 100000,
"max": 500000,
"mmr": 0.05,
"lev": 10,
"maintAmt": 2500.0
}, {
},
{
"min": 500000,
"max": 1000000,
"mmr": 0.1,
"lev": 5,
"maintAmt": 27500.0
}, {
},
{
"min": 1000000,
"max": 2000000,
"mmr": 0.15,
"lev": 3,
"maintAmt": 77500.0
}, {
},
{
"min": 2000000,
"max": 5000000,
"mmr": 0.25,
"lev": 2,
"maintAmt": 277500.0
}, {
},
{
"min": 5000000,
"max": 30000000,
"mmr": 0.5,
@ -3232,31 +3255,36 @@ def leverage_tiers():
"mmr": 0.025,
"lev": 20,
"maintAmt": 0.0
}, {
},
{
"min": 100000, # stake = 10000.0
"max": 500000, # max_stake = 50000.0
"mmr": 0.05,
"lev": 10,
"maintAmt": 2500.0
}, {
},
{
"min": 500000, # stake = 100000.0
"max": 1000000, # max_stake = 200000.0
"mmr": 0.1,
"lev": 5,
"maintAmt": 27500.0
}, {
},
{
"min": 1000000, # stake = 333333.3333333333
"max": 2000000, # max_stake = 666666.6666666666
"mmr": 0.15,
"lev": 3,
"maintAmt": 77500.0
}, {
},
{
"min": 2000000, # stake = 1000000.0
"max": 5000000, # max_stake = 2500000.0
"mmr": 0.25,
"lev": 2,
"maintAmt": 277500.0
}, {
},
{
"min": 5000000, # stake = 5000000.0
"max": 30000000, # max_stake = 30000000.0
"mmr": 0.5,
@ -3271,49 +3299,57 @@ def leverage_tiers():
"mmr": 0.0065,
"lev": 75,
"maintAmt": 0.0
}, {
},
{
"min": 10000, # stake = 200.0
"max": 50000, # max_stake = 1000.0
"mmr": 0.01,
"lev": 50,
"maintAmt": 35.0
}, {
},
{
"min": 50000, # stake = 2000.0
"max": 250000, # max_stake = 10000.0
"mmr": 0.02,
"lev": 25,
"maintAmt": 535.0
}, {
},
{
"min": 250000, # stake = 25000.0
"max": 1000000, # max_stake = 100000.0
"mmr": 0.05,
"lev": 10,
"maintAmt": 8035.0
}, {
},
{
"min": 1000000, # stake = 200000.0
"max": 2000000, # max_stake = 400000.0
"mmr": 0.1,
"lev": 5,
"maintAmt": 58035.0
}, {
},
{
"min": 2000000, # stake = 500000.0
"max": 5000000, # max_stake = 1250000.0
"mmr": 0.125,
"lev": 4,
"maintAmt": 108035.0
}, {
},
{
"min": 5000000, # stake = 1666666.6666666667
"max": 10000000, # max_stake = 3333333.3333333335
"mmr": 0.15,
"lev": 3,
"maintAmt": 233035.0
}, {
},
{
"min": 10000000, # stake = 5000000.0
"max": 20000000, # max_stake = 10000000.0
"mmr": 0.25,
"lev": 2,
"maintAmt": 1233035.0
}, {
},
{
"min": 20000000, # stake = 20000000.0
"max": 50000000, # max_stake = 50000000.0
"mmr": 0.5,
@ -3323,66 +3359,75 @@ def leverage_tiers():
],
'BTC/USDT': [
{
'min': 0.0,
'max': 50000.0,
'mmr': 0.004,
'lev': 125.0,
'maintAmt': 0.0
}, {
'min': 50000.0,
'max': 250000.0,
'mmr': 0.005,
'lev': 100.0,
'maintAmt': 50.0
}, {
'min': 250000.0,
'max': 1000000.0,
'mmr': 0.01,
'lev': 50.0,
'maintAmt': 1300.0
}, {
'min': 1000000.0,
'max': 10000000.0,
'mmr': 0.025,
'lev': 20.0,
'maintAmt': 16300.0
}, {
'min': 10000000.0,
'max': 20000000.0,
'mmr': 0.05,
'lev': 10.0,
'maintAmt': 266300.0
}, {
'min': 20000000.0,
'max': 50000000.0,
'mmr': 0.1,
'lev': 5.0,
'maintAmt': 1266300.0
}, {
'min': 50000000.0,
'max': 100000000.0,
'mmr': 0.125,
'lev': 4.0,
'maintAmt': 2516300.0
}, {
'min': 100000000.0,
'max': 200000000.0,
'mmr': 0.15,
'lev': 3.0,
'maintAmt': 5016300.0
}, {
'min': 200000000.0,
'max': 300000000.0,
'mmr': 0.25,
'lev': 2.0,
'maintAmt': 25016300.0
}, {
'min': 300000000.0,
'max': 9.223372036854776e+18,
'mmr': 0.5,
'lev': 1.0,
'maintAmt': 100016300.0
}
"min": 0, # stake = 0.0
"max": 50000, # max_stake = 400.0
"mmr": 0.004,
"lev": 125,
"maintAmt": 0.0
},
{
"min": 50000, # stake = 500.0
"max": 250000, # max_stake = 2500.0
"mmr": 0.005,
"lev": 100,
"maintAmt": 50.0
},
{
"min": 250000, # stake = 5000.0
"max": 1000000, # max_stake = 20000.0
"mmr": 0.01,
"lev": 50,
"maintAmt": 1300.0
},
{
"min": 1000000, # stake = 50000.0
"max": 7500000, # max_stake = 375000.0
"mmr": 0.025,
"lev": 20,
"maintAmt": 16300.0
},
{
"min": 7500000, # stake = 750000.0
"max": 40000000, # max_stake = 4000000.0
"mmr": 0.05,
"lev": 10,
"maintAmt": 203800.0
},
{
"min": 40000000, # stake = 8000000.0
"max": 100000000, # max_stake = 20000000.0
"mmr": 0.1,
"lev": 5,
"maintAmt": 2203800.0
},
{
"min": 100000000, # stake = 25000000.0
"max": 200000000, # max_stake = 50000000.0
"mmr": 0.125,
"lev": 4,
"maintAmt": 4703800.0
},
{
"min": 200000000, # stake = 66666666.666666664
"max": 400000000, # max_stake = 133333333.33333333
"mmr": 0.15,
"lev": 3,
"maintAmt": 9703800.0
},
{
"min": 400000000, # stake = 200000000.0
"max": 600000000, # max_stake = 300000000.0
"mmr": 0.25,
"lev": 2,
"maintAmt": 4.97038E7
},
{
"min": 600000000, # stake = 600000000.0
"max": 1000000000, # max_stake = 1000000000.0
"mmr": 0.5,
"lev": 1,
"maintAmt": 1.997038E8
},
],
"ZEC/USDT": [
{
@ -3391,37 +3436,43 @@ def leverage_tiers():
'mmr': 0.01,
'lev': 50,
'maintAmt': 0.0
}, {
},
{
'min': 50000,
'max': 150000,
'mmr': 0.025,
'lev': 20,
'maintAmt': 750.0
}, {
},
{
'min': 150000,
'max': 250000,
'mmr': 0.05,
'lev': 10,
'maintAmt': 4500.0
}, {
},
{
'min': 250000,
'max': 500000,
'mmr': 0.1,
'lev': 5,
'maintAmt': 17000.0
}, {
},
{
'min': 500000,
'max': 1000000,
'mmr': 0.125,
'lev': 4,
'maintAmt': 29500.0
}, {
},
{
'min': 1000000,
'max': 2000000,
'mmr': 0.25,
'lev': 2,
'maintAmt': 154500.0
}, {
},
{
'min': 2000000,
'max': 30000000,
'mmr': 0.5,

View File

@ -490,11 +490,9 @@ def test_fill_leverage_tiers_binance_dryrun(default_conf, mocker, leverage_tiers
default_conf['margin_mode'] = MarginMode.ISOLATED
exchange = get_patched_exchange(mocker, default_conf, api_mock, id="binance")
exchange.fill_leverage_tiers()
leverage_tiers = leverage_tiers
assert len(exchange._leverage_tiers.keys()) > 100
for key, value in leverage_tiers.items():
assert exchange._leverage_tiers[key] == value
assert isinstance(exchange._leverage_tiers[key], list)
def test__set_leverage_binance(mocker, default_conf):