fixed tests

This commit is contained in:
Sam Germain 2022-02-16 04:52:26 -06:00
parent 3fe0e13bb1
commit 1f3d3d87f6

View File

@ -3500,11 +3500,10 @@ def test_set_margin_mode(mocker, default_conf, margin_mode):
("okx", TradingMode.FUTURES, MarginMode.CROSS, True), ("okx", TradingMode.FUTURES, MarginMode.CROSS, True),
("binance", TradingMode.FUTURES, MarginMode.ISOLATED, False), ("binance", TradingMode.FUTURES, MarginMode.ISOLATED, False),
# ("gateio", TradingMode.FUTURES, MarginMode.ISOLATED, False), ("gateio", TradingMode.FUTURES, MarginMode.ISOLATED, False),
("okx", TradingMode.FUTURES, MarginMode.ISOLATED, False), ("okx", TradingMode.FUTURES, MarginMode.ISOLATED, False),
# * Remove once implemented # * Remove once implemented
("gateio", TradingMode.FUTURES, MarginMode.ISOLATED, True),
("binance", TradingMode.MARGIN, MarginMode.CROSS, True), ("binance", TradingMode.MARGIN, MarginMode.CROSS, True),
("binance", TradingMode.FUTURES, MarginMode.CROSS, True), ("binance", TradingMode.FUTURES, MarginMode.CROSS, True),
("kraken", TradingMode.MARGIN, MarginMode.CROSS, True), ("kraken", TradingMode.MARGIN, MarginMode.CROSS, True),
@ -4274,34 +4273,41 @@ def test_load_leverage_tiers(mocker, default_conf, leverage_tiers):
exchange = get_patched_exchange(mocker, default_conf, api_mock) exchange = get_patched_exchange(mocker, default_conf, api_mock)
assert exchange.load_leverage_tiers() == {} assert exchange.load_leverage_tiers() == {}
# FUTURES # FUTURES has.fetchLeverageTiers == False
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) exchange = get_patched_exchange(mocker, default_conf, api_mock)
type(api_mock).has = PropertyMock(return_value={'fetchLeverageTiers': False})
exchange = get_patched_exchange(mocker, default_conf, api_mock)
assert exchange.load_leverage_tiers() == {}
# FUTURES regular
type(api_mock).has = PropertyMock(return_value={'fetchLeverageTiers': True})
exchange = get_patched_exchange(mocker, default_conf, api_mock)
assert exchange.load_leverage_tiers() == { assert exchange.load_leverage_tiers() == {
'ADA/USDT:USDT': [ 'ADA/USDT:USDT': [
{ {
'tier': 1, 'tier': 1,
'notionalFloor': 0, 'notionalFloor': 0,
'notionalCap': 500, 'notionalCap': 500,
'maintenanceMarginRatio': 0.02, 'maintenanceMarginRatio': 0.02,
'maxLeverage': 75, 'maxLeverage': 75,
'info': { 'info': {
'baseMaxLoan': '', 'baseMaxLoan': '',
'imr': '0.013', 'imr': '0.013',
'instId': '', 'instId': '',
'maxLever': '75', 'maxLever': '75',
'maxSz': '500', 'maxSz': '500',
'minSz': '0', 'minSz': '0',
'mmr': '0.01', 'mmr': '0.01',
'optMgnFactor': '0', 'optMgnFactor': '0',
'quoteMaxLoan': '', 'quoteMaxLoan': '',
'tier': '1', 'tier': '1',
'uly': 'ADA-USDT' 'uly': 'ADA-USDT'
} }
}, },
] ]
} }
ccxt_exceptionhandlers( ccxt_exceptionhandlers(
mocker, mocker,