moved get_maintenance_ratio_and_amt to base.exchange. Wrote get_leverage_tiers. Added mmr_key to exchange._ft_has
This commit is contained in:
@@ -210,28 +210,34 @@ def test_get_max_leverage_binance(default_conf, mocker, pair, stake_amount, max_
|
||||
def test_fill_leverage_brackets_binance(default_conf, mocker):
|
||||
api_mock = MagicMock()
|
||||
api_mock.load_leverage_brackets = MagicMock(return_value={
|
||||
'ADA/BUSD': [[0.0, 0.025],
|
||||
[100000.0, 0.05],
|
||||
[500000.0, 0.1],
|
||||
[1000000.0, 0.15],
|
||||
[2000000.0, 0.25],
|
||||
[5000000.0, 0.5]],
|
||||
'BTC/USDT': [[0.0, 0.004],
|
||||
[50000.0, 0.005],
|
||||
[250000.0, 0.01],
|
||||
[1000000.0, 0.025],
|
||||
[5000000.0, 0.05],
|
||||
[20000000.0, 0.1],
|
||||
[50000000.0, 0.125],
|
||||
[100000000.0, 0.15],
|
||||
[200000000.0, 0.25],
|
||||
[300000000.0, 0.5]],
|
||||
"ZEC/USDT": [[0.0, 0.01],
|
||||
[5000.0, 0.025],
|
||||
[25000.0, 0.05],
|
||||
[100000.0, 0.1],
|
||||
[250000.0, 0.125],
|
||||
[1000000.0, 0.5]],
|
||||
'ADA/BUSD': [
|
||||
[0.0, 0.025],
|
||||
[100000.0, 0.05],
|
||||
[500000.0, 0.1],
|
||||
[1000000.0, 0.15],
|
||||
[2000000.0, 0.25],
|
||||
[5000000.0, 0.5],
|
||||
],
|
||||
'BTC/USDT': [
|
||||
[0.0, 0.004],
|
||||
[50000.0, 0.005],
|
||||
[250000.0, 0.01],
|
||||
[1000000.0, 0.025],
|
||||
[5000000.0, 0.05],
|
||||
[20000000.0, 0.1],
|
||||
[50000000.0, 0.125],
|
||||
[100000000.0, 0.15],
|
||||
[200000000.0, 0.25],
|
||||
[300000000.0, 0.5],
|
||||
],
|
||||
"ZEC/USDT": [
|
||||
[0.0, 0.01],
|
||||
[5000.0, 0.025],
|
||||
[25000.0, 0.05],
|
||||
[100000.0, 0.1],
|
||||
[250000.0, 0.125],
|
||||
[1000000.0, 0.5],
|
||||
],
|
||||
|
||||
})
|
||||
default_conf['dry_run'] = False
|
||||
@@ -241,28 +247,34 @@ def test_fill_leverage_brackets_binance(default_conf, mocker):
|
||||
exchange.fill_leverage_brackets()
|
||||
|
||||
assert exchange._leverage_brackets == {
|
||||
'ADA/BUSD': [[0.0, 0.025, 0.0],
|
||||
[100000.0, 0.05, 2500.0],
|
||||
[500000.0, 0.1, 27500.0],
|
||||
[1000000.0, 0.15, 77499.99999999999],
|
||||
[2000000.0, 0.25, 277500.0],
|
||||
[5000000.0, 0.5, 1527500.0]],
|
||||
'BTC/USDT': [[0.0, 0.004, 0.0],
|
||||
[50000.0, 0.005, 50.0],
|
||||
[250000.0, 0.01, 1300.0],
|
||||
[1000000.0, 0.025, 16300.000000000002],
|
||||
[5000000.0, 0.05, 141300.0],
|
||||
[20000000.0, 0.1, 1141300.0],
|
||||
[50000000.0, 0.125, 2391300.0],
|
||||
[100000000.0, 0.15, 4891300.0],
|
||||
[200000000.0, 0.25, 24891300.0],
|
||||
[300000000.0, 0.5, 99891300.0]],
|
||||
"ZEC/USDT": [[0.0, 0.01, 0.0],
|
||||
[5000.0, 0.025, 75.0],
|
||||
[25000.0, 0.05, 700.0],
|
||||
[100000.0, 0.1, 5700.0],
|
||||
[250000.0, 0.125, 11949.999999999998],
|
||||
[1000000.0, 0.5, 386950.0]]
|
||||
'ADA/BUSD': [
|
||||
(0.0, 0.025, 0.0),
|
||||
(100000.0, 0.05, 2500.0),
|
||||
(500000.0, 0.1, 27500.0),
|
||||
(1000000.0, 0.15, 77499.99999999999),
|
||||
(2000000.0, 0.25, 277500.0),
|
||||
(5000000.0, 0.5, 1527500.0),
|
||||
],
|
||||
'BTC/USDT': [
|
||||
(0.0, 0.004, 0.0),
|
||||
(50000.0, 0.005, 50.0),
|
||||
(250000.0, 0.01, 1300.0),
|
||||
(1000000.0, 0.025, 16300.000000000002),
|
||||
(5000000.0, 0.05, 141300.0),
|
||||
(20000000.0, 0.1, 1141300.0),
|
||||
(50000000.0, 0.125, 2391300.0),
|
||||
(100000000.0, 0.15, 4891300.0),
|
||||
(200000000.0, 0.25, 24891300.0),
|
||||
(300000000.0, 0.5, 99891300.0),
|
||||
],
|
||||
"ZEC/USDT": [
|
||||
(0.0, 0.01, 0.0),
|
||||
(5000.0, 0.025, 75.0),
|
||||
(25000.0, 0.05, 700.0),
|
||||
(100000.0, 0.1, 5700.0),
|
||||
(250000.0, 0.125, 11949.999999999998),
|
||||
(1000000.0, 0.5, 386950.0),
|
||||
]
|
||||
}
|
||||
|
||||
api_mock = MagicMock()
|
||||
@@ -288,37 +300,37 @@ def test_fill_leverage_brackets_binance_dryrun(default_conf, mocker):
|
||||
|
||||
leverage_brackets = {
|
||||
"1000SHIB/USDT": [
|
||||
[0.0, 0.01, 0.0],
|
||||
[5000.0, 0.025, 75.0],
|
||||
[25000.0, 0.05, 700.0],
|
||||
[100000.0, 0.1, 5700.0],
|
||||
[250000.0, 0.125, 11949.999999999998],
|
||||
[1000000.0, 0.5, 386950.0],
|
||||
(0.0, 0.01, 0.0),
|
||||
(5000.0, 0.025, 75.0),
|
||||
(25000.0, 0.05, 700.0),
|
||||
(100000.0, 0.1, 5700.0),
|
||||
(250000.0, 0.125, 11949.999999999998),
|
||||
(1000000.0, 0.5, 386950.0),
|
||||
],
|
||||
"1INCH/USDT": [
|
||||
[0.0, 0.012, 0.0],
|
||||
[5000.0, 0.025, 65.0],
|
||||
[25000.0, 0.05, 690.0],
|
||||
[100000.0, 0.1, 5690.0],
|
||||
[250000.0, 0.125, 11939.999999999998],
|
||||
[1000000.0, 0.5, 386940.0],
|
||||
(0.0, 0.012, 0.0),
|
||||
(5000.0, 0.025, 65.0),
|
||||
(25000.0, 0.05, 690.0),
|
||||
(100000.0, 0.1, 5690.0),
|
||||
(250000.0, 0.125, 11939.999999999998),
|
||||
(1000000.0, 0.5, 386940.0),
|
||||
],
|
||||
"AAVE/USDT": [
|
||||
[0.0, 0.01, 0.0],
|
||||
[50000.0, 0.02, 500.0],
|
||||
[250000.0, 0.05, 8000.000000000001],
|
||||
[1000000.0, 0.1, 58000.0],
|
||||
[2000000.0, 0.125, 107999.99999999999],
|
||||
[5000000.0, 0.1665, 315500.00000000006],
|
||||
[10000000.0, 0.25, 1150500.0],
|
||||
(0.0, 0.01, 0.0),
|
||||
(50000.0, 0.02, 500.0),
|
||||
(250000.0, 0.05, 8000.000000000001),
|
||||
(1000000.0, 0.1, 58000.0),
|
||||
(2000000.0, 0.125, 107999.99999999999),
|
||||
(5000000.0, 0.1665, 315500.00000000006),
|
||||
(10000000.0, 0.25, 1150500.0),
|
||||
],
|
||||
"ADA/BUSD": [
|
||||
[0.0, 0.025, 0.0],
|
||||
[100000.0, 0.05, 2500.0],
|
||||
[500000.0, 0.1, 27500.0],
|
||||
[1000000.0, 0.15, 77499.99999999999],
|
||||
[2000000.0, 0.25, 277500.0],
|
||||
[5000000.0, 0.5, 1527500.0],
|
||||
(0.0, 0.025, 0.0),
|
||||
(100000.0, 0.05, 2500.0),
|
||||
(500000.0, 0.1, 27500.0),
|
||||
(1000000.0, 0.15, 77499.99999999999),
|
||||
(2000000.0, 0.25, 277500.0),
|
||||
(5000000.0, 0.5, 1527500.0),
|
||||
]
|
||||
}
|
||||
|
||||
|
@@ -37,6 +37,7 @@ def test_validate_order_types_gateio(default_conf, mocker):
|
||||
])
|
||||
def test_get_maintenance_ratio_and_amt_gateio(default_conf, mocker, pair, mm_ratio):
|
||||
api_mock = MagicMock()
|
||||
type(api_mock).has = PropertyMock(return_value={'fetchLeverageTiers': False})
|
||||
exchange = get_patched_exchange(mocker, default_conf, api_mock, id="gateio")
|
||||
mocker.patch(
|
||||
'freqtrade.exchange.Exchange.markets',
|
||||
|
Reference in New Issue
Block a user