mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
expanded test_load_leverage_tiers
This commit is contained in:
parent
3bfd9186f7
commit
3fe0e13bb1
|
@ -4242,8 +4242,66 @@ def test_load_leverage_tiers(mocker, default_conf, leverage_tiers):
|
|||
api_mock.fetch_leverage_tiers = MagicMock()
|
||||
type(api_mock).has = PropertyMock(return_value={'fetchLeverageTiers': True})
|
||||
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['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(
|
||||
mocker,
|
||||
|
|
|
@ -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):
|
||||
# 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
|
||||
|
|
Loading…
Reference in New Issue
Block a user