expanded test_load_leverage_tiers

This commit is contained in:
Sam Germain 2022-02-16 04:37:11 -06:00
parent 3bfd9186f7
commit 3fe0e13bb1
2 changed files with 59 additions and 1 deletions

View File

@ -4242,8 +4242,66 @@ def test_load_leverage_tiers(mocker, default_conf, leverage_tiers):
api_mock.fetch_leverage_tiers = MagicMock() api_mock.fetch_leverage_tiers = MagicMock()
type(api_mock).has = PropertyMock(return_value={'fetchLeverageTiers': True}) type(api_mock).has = PropertyMock(return_value={'fetchLeverageTiers': True})
default_conf['dry_run'] = False default_conf['dry_run'] = False
api_mock.fetch_leverage_tiers = MagicMock(return_value=[
{
'ADA/USDT:USDT': [
{
'tier': 1,
'notionalFloor': 0,
'notionalCap': 500,
'maintenanceMarginRatio': 0.02,
'maxLeverage': 75,
'info': {
'baseMaxLoan': '',
'imr': '0.013',
'instId': '',
'maxLever': '75',
'maxSz': '500',
'minSz': '0',
'mmr': '0.01',
'optMgnFactor': '0',
'quoteMaxLoan': '',
'tier': '1',
'uly': 'ADA-USDT'
}
},
]
}
])
# SPOT
exchange = get_patched_exchange(mocker, default_conf, api_mock)
assert exchange.load_leverage_tiers() == {}
# FUTURES
default_conf['trading_mode'] = 'futures' default_conf['trading_mode'] = 'futures'
default_conf['margin_mode'] = 'isolated' default_conf['margin_mode'] = 'isolated'
exchange = get_patched_exchange(mocker, default_conf, api_mock)
assert exchange.load_leverage_tiers() == {
'ADA/USDT:USDT': [
{
'tier': 1,
'notionalFloor': 0,
'notionalCap': 500,
'maintenanceMarginRatio': 0.02,
'maxLeverage': 75,
'info': {
'baseMaxLoan': '',
'imr': '0.013',
'instId': '',
'maxLever': '75',
'maxSz': '500',
'minSz': '0',
'mmr': '0.01',
'optMgnFactor': '0',
'quoteMaxLoan': '',
'tier': '1',
'uly': 'ADA-USDT'
}
},
]
}
ccxt_exceptionhandlers( ccxt_exceptionhandlers(
mocker, mocker,

View File

@ -75,5 +75,5 @@ def test_get_maintenance_ratio_and_amt_gateio(default_conf, mocker, pair, mm_rat
]) ])
def test_get_max_leverage_gateio(default_conf, mocker, pair, nominal_value, max_lev): def test_get_max_leverage_gateio(default_conf, mocker, pair, nominal_value, max_lev):
# Binance has a different method of getting the max leverage # Binance has a different method of getting the max leverage
exchange = get_patched_exchange(mocker, default_conf, id="kraken") exchange = get_patched_exchange(mocker, default_conf, id="gateio")
assert exchange.get_max_leverage(pair, nominal_value) == max_lev assert exchange.get_max_leverage(pair, nominal_value) == max_lev