Updated exchange tests

This commit is contained in:
Sam Germain 2022-02-10 03:31:16 -06:00
parent fa2c9fc51f
commit 3b43d42eaa
4 changed files with 10 additions and 11 deletions

View File

@ -1135,6 +1135,7 @@ def get_markets():
'taker': 0.0006, 'taker': 0.0006,
'maker': 0.0002, 'maker': 0.0002,
'contractSize': 10, 'contractSize': 10,
'maintenanceMarginRate': 0.02,
'active': True, 'active': True,
'expiry': None, 'expiry': None,
'expiryDatetime': None, 'expiryDatetime': None,

View File

@ -4313,7 +4313,7 @@ def test_get_leverage_tiers_for_pair(mocker, default_conf, leverage_tiers):
type(api_mock)._ft_has = PropertyMock(return_value={'fetchLeverageTiers': True}) type(api_mock)._ft_has = PropertyMock(return_value={'fetchLeverageTiers': True})
exchange = get_patched_exchange(mocker, default_conf, api_mock) exchange = get_patched_exchange(mocker, default_conf, api_mock)
exchange._ft_has['can_fetch_multiple_tiers'] = False exchange._ft_has['can_fetch_multiple_tiers'] = False
assert exchange.get_leverage_tiers_for_pair('ADA/USDT') is None assert exchange.get_leverage_tiers_for_pair('ADA/USDT') == []
# 'can_fetch_multiple_tiers': True # 'can_fetch_multiple_tiers': True
default_conf['trading_mode'] = 'futures' default_conf['trading_mode'] = 'futures'
@ -4321,19 +4321,19 @@ def test_get_leverage_tiers_for_pair(mocker, default_conf, leverage_tiers):
type(api_mock).has = PropertyMock(return_value={'fetchLeverageTiers': True}) type(api_mock).has = PropertyMock(return_value={'fetchLeverageTiers': True})
exchange = get_patched_exchange(mocker, default_conf, api_mock) exchange = get_patched_exchange(mocker, default_conf, api_mock)
exchange._ft_has['can_fetch_multiple_tiers'] = True exchange._ft_has['can_fetch_multiple_tiers'] = True
assert exchange.get_leverage_tiers_for_pair('ADA/USDT:USDT') is None assert exchange.get_leverage_tiers_for_pair('ADA/USDT:USDT') == []
# 'fetchLeverageTiers': False # 'fetchLeverageTiers': False
type(api_mock).has = PropertyMock(return_value={'fetchLeverageTiers': False}) type(api_mock).has = PropertyMock(return_value={'fetchLeverageTiers': False})
exchange = get_patched_exchange(mocker, default_conf, api_mock) exchange = get_patched_exchange(mocker, default_conf, api_mock)
exchange._ft_has['can_fetch_multiple_tiers'] = False exchange._ft_has['can_fetch_multiple_tiers'] = False
assert exchange.get_leverage_tiers_for_pair('ADA/USDT:USDT') is None assert exchange.get_leverage_tiers_for_pair('ADA/USDT:USDT') == []
# 'fetchLeverageTiers': False # 'fetchLeverageTiers': False
type(api_mock).has = PropertyMock(return_value={'fetchLeverageTiers': True}) type(api_mock).has = PropertyMock(return_value={'fetchLeverageTiers': True})
exchange = get_patched_exchange(mocker, default_conf, api_mock) exchange = get_patched_exchange(mocker, default_conf, api_mock)
exchange._ft_has['can_fetch_multiple_tiers'] = False exchange._ft_has['can_fetch_multiple_tiers'] = False
assert exchange.get_leverage_tiers_for_pair('ADA/USDT:USDT') is not None assert exchange.get_leverage_tiers_for_pair('ADA/USDT:USDT') != []
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

View File

@ -46,18 +46,16 @@ def test_get_maintenance_ratio_and_amt_gateio(default_conf, mocker, pair, mm_rat
'ETH/USDT:USDT': { 'ETH/USDT:USDT': {
'taker': 0.0000075, 'taker': 0.0000075,
'maker': -0.0000025, 'maker': -0.0000025,
'info': { 'maintenanceMarginRate': 0.005,
'maintenance_rate': '0.005', 'info': {},
},
'id': 'ETH_USDT', 'id': 'ETH_USDT',
'symbol': 'ETH/USDT:USDT', 'symbol': 'ETH/USDT:USDT',
}, },
'ADA/USDT:USDT': { 'ADA/USDT:USDT': {
'taker': 0.0000075, 'taker': 0.0000075,
'maker': -0.0000025, 'maker': -0.0000025,
'info': { 'maintenanceMarginRate': 0.003,
'maintenance_rate': '0.003', 'info': {},
},
'id': 'ADA_USDT', 'id': 'ADA_USDT',
'symbol': 'ADA/USDT:USDT', 'symbol': 'ADA/USDT:USDT',
}, },

View File

@ -10,7 +10,7 @@ def test_get_maintenance_ratio_and_amt_okex(
api_mock = MagicMock() api_mock = MagicMock()
default_conf['trading_mode'] = 'futures' default_conf['trading_mode'] = 'futures'
default_conf['margin_mode'] = 'isolated' default_conf['margin_mode'] = 'isolated'
default_conf['dry_run'] = True default_conf['dry_run'] = False
api_mock.fetch_leverage_tiers = MagicMock(return_value={ api_mock.fetch_leverage_tiers = MagicMock(return_value={
'SHIB/USDT:USDT': [ 'SHIB/USDT:USDT': [
{ {