test_fill_leverage_brackets_kraken and test_get_max_leverage_binance now pass but test_fill_leverage_brackets_ftx does not if called after test_get_max_leverage_binance

This commit is contained in:
Sam Germain
2021-09-05 22:27:14 -06:00
parent 9e73d02663
commit 93da13212c
8 changed files with 103 additions and 310 deletions

View File

@@ -274,229 +274,11 @@ def test_get_max_leverage_kraken(default_conf, mocker, pair, nominal_value, max_
def test_fill_leverage_brackets_kraken(default_conf, mocker):
api_mock = MagicMock()
api_mock.load_markets = MagicMock(return_value={
"ADA/BTC": {'active': True,
'altname': 'ADAXBT',
'base': 'ADA',
'baseId': 'ADA',
'darkpool': False,
'id': 'ADAXBT',
'info': {'aclass_base': 'currency',
'aclass_quote': 'currency',
'altname': 'ADAXBT',
'base': 'ADA',
'fee_volume_currency': 'ZUSD',
'fees': [['0', '0.26'],
['50000', '0.24'],
['100000', '0.22'],
['250000', '0.2'],
['500000', '0.18'],
['1000000', '0.16'],
['2500000', '0.14'],
['5000000', '0.12'],
['10000000', '0.1']],
'fees_maker': [['0', '0.16'],
['50000', '0.14'],
['100000', '0.12'],
['250000', '0.1'],
['500000', '0.08'],
['1000000', '0.06'],
['2500000', '0.04'],
['5000000', '0.02'],
['10000000', '0']],
'leverage_buy': ['2', '3'],
'leverage_sell': ['2', '3'],
'lot': 'unit',
'lot_decimals': '8',
'lot_multiplier': '1',
'margin_call': '80',
'margin_stop': '40',
'ordermin': '5',
'pair_decimals': '8',
'quote': 'XXBT',
'wsname': 'ADA/XBT'},
'limits': {'amount': {'max': 100000000.0, 'min': 5.0},
'cost': {'max': None, 'min': 0},
'price': {'max': None, 'min': 1e-08}},
'maker': 0.0016,
'percentage': True,
'precision': {'amount': 8, 'price': 8},
'quote': 'BTC',
'quoteId': 'XXBT',
'symbol': 'ADA/BTC',
'taker': 0.0026,
'tierBased': True,
'tiers': {'maker': [[0, 0.0016],
[50000, 0.0014],
[100000, 0.0012],
[250000, 0.001],
[500000, 0.0008],
[1000000, 0.0006],
[2500000, 0.0004],
[5000000, 0.0002],
[10000000, 0.0]],
'taker': [[0, 0.0026],
[50000, 0.0024],
[100000, 0.0022],
[250000, 0.002],
[500000, 0.0018],
[1000000, 0.0016],
[2500000, 0.0014],
[5000000, 0.0012],
[10000000, 0.0001]]}},
"BTC/EUR": {'active': True,
'altname': 'XBTEUR',
'base': 'BTC',
'baseId': 'XXBT',
'darkpool': False,
'id': 'XXBTZEUR',
'info': {'aclass_base': 'currency',
'aclass_quote': 'currency',
'altname': 'XBTEUR',
'base': 'XXBT',
'fee_volume_currency': 'ZUSD',
'fees': [['0', '0.26'],
['50000', '0.24'],
['100000', '0.22'],
['250000', '0.2'],
['500000', '0.18'],
['1000000', '0.16'],
['2500000', '0.14'],
['5000000', '0.12'],
['10000000', '0.1']],
'fees_maker': [['0', '0.16'],
['50000', '0.14'],
['100000', '0.12'],
['250000', '0.1'],
['500000', '0.08'],
['1000000', '0.06'],
['2500000', '0.04'],
['5000000', '0.02'],
['10000000', '0']],
'leverage_buy': ['2', '3', '4', '5'],
'leverage_sell': ['2', '3', '4', '5'],
'lot': 'unit',
'lot_decimals': '8',
'lot_multiplier': '1',
'margin_call': '80',
'margin_stop': '40',
'ordermin': '0.0001',
'pair_decimals': '1',
'quote': 'ZEUR',
'wsname': 'XBT/EUR'},
'limits': {'amount': {'max': 100000000.0, 'min': 0.0001},
'cost': {'max': None, 'min': 0},
'price': {'max': None, 'min': 0.1}},
'maker': 0.0016,
'percentage': True,
'precision': {'amount': 8, 'price': 1},
'quote': 'EUR',
'quoteId': 'ZEUR',
'symbol': 'BTC/EUR',
'taker': 0.0026,
'tierBased': True,
'tiers': {'maker': [[0, 0.0016],
[50000, 0.0014],
[100000, 0.0012],
[250000, 0.001],
[500000, 0.0008],
[1000000, 0.0006],
[2500000, 0.0004],
[5000000, 0.0002],
[10000000, 0.0]],
'taker': [[0, 0.0026],
[50000, 0.0024],
[100000, 0.0022],
[250000, 0.002],
[500000, 0.0018],
[1000000, 0.0016],
[2500000, 0.0014],
[5000000, 0.0012],
[10000000, 0.0001]]}},
"ZEC/USD": {'active': True,
'altname': 'ZECUSD',
'base': 'ZEC',
'baseId': 'XZEC',
'darkpool': False,
'id': 'XZECZUSD',
'info': {'aclass_base': 'currency',
'aclass_quote': 'currency',
'altname': 'ZECUSD',
'base': 'XZEC',
'fee_volume_currency': 'ZUSD',
'fees': [['0', '0.26'],
['50000', '0.24'],
['100000', '0.22'],
['250000', '0.2'],
['500000', '0.18'],
['1000000', '0.16'],
['2500000', '0.14'],
['5000000', '0.12'],
['10000000', '0.1']],
'fees_maker': [['0', '0.16'],
['50000', '0.14'],
['100000', '0.12'],
['250000', '0.1'],
['500000', '0.08'],
['1000000', '0.06'],
['2500000', '0.04'],
['5000000', '0.02'],
['10000000', '0']],
'leverage_buy': ['2'],
'leverage_sell': ['2'],
'lot': 'unit',
'lot_decimals': '8',
'lot_multiplier': '1',
'margin_call': '80',
'margin_stop': '40',
'ordermin': '0.035',
'pair_decimals': '2',
'quote': 'ZUSD',
'wsname': 'ZEC/USD'},
'limits': {'amount': {'max': 100000000.0, 'min': 0.035},
'cost': {'max': None, 'min': 0},
'price': {'max': None, 'min': 0.01}},
'maker': 0.0016,
'percentage': True,
'precision': {'amount': 8, 'price': 2},
'quote': 'USD',
'quoteId': 'ZUSD',
'symbol': 'ZEC/USD',
'taker': 0.0026,
'tierBased': True,
'tiers': {'maker': [[0, 0.0016],
[50000, 0.0014],
[100000, 0.0012],
[250000, 0.001],
[500000, 0.0008],
[1000000, 0.0006],
[2500000, 0.0004],
[5000000, 0.0002],
[10000000, 0.0]],
'taker': [[0, 0.0026],
[50000, 0.0024],
[100000, 0.0022],
[250000, 0.002],
[500000, 0.0018],
[1000000, 0.0016],
[2500000, 0.0014],
[5000000, 0.0012],
[10000000, 0.0001]]}}
})
exchange = get_patched_exchange(mocker, default_conf, api_mock, id="kraken")
exchange.fill_leverage_brackets()
assert exchange._leverage_brackets == {
'ADA/BTC': ['2', '3'],
'BTC/EUR': ['2', '3', '4', '5'],
'ZEC/USD': ['2']
'BLK/BTC': ['2', '3'],
'TKN/BTC': ['2', '3', '4', '5'],
'ETH/BTC': ['2']
}
ccxt_exceptionhandlers(
mocker,
default_conf,
api_mock,
"kraken",
"fill_leverage_brackets",
"fill_leverage_brackets"
)