test_ccxt_load_leverage_tiers

This commit is contained in:
Sam Germain 2022-02-16 08:48:53 -06:00
parent ef5dae2770
commit a1e9e940dd

View File

@ -359,19 +359,24 @@ class TestCCXTExchange():
assert futures_pair in leverage_tiers assert futures_pair in leverage_tiers
pair_tiers = leverage_tiers[futures_pair] pair_tiers = leverage_tiers[futures_pair]
assert len(pair_tiers) > 0 assert len(pair_tiers) > 0
oldLeverage = 0 oldLeverage = float('inf')
oldMaintenanceMarginRate = oldNotionalFloor = oldNotionalCap = float('inf') oldMaintenanceMarginRate = oldNotionalFloor = oldNotionalCap = -1
for tier in pair_tiers: for tier in pair_tiers:
for key in ['maintenanceMarginRate', 'notionalFloor', 'notionalCap', 'maxLeverage']: for key in [
'maintenanceMarginRatio', # TODO-lev: Change to maintenanceMarginRate
'notionalFloor',
'notionalCap',
'maxLeverage'
]:
assert key in tier assert key in tier
assert pair_tiers[key] > 0.0 assert tier[key] >= 0.0
assert pair_tiers['notionalCap'] > pair_tiers['notionalFloor'] assert tier['notionalCap'] > tier['notionalFloor']
assert tier['maxLeverage'] < oldLeverage assert tier['maxLeverage'] <= oldLeverage
assert tier['maintenanceMarginRate'] > oldMaintenanceMarginRate assert tier['maintenanceMarginRatio'] >= oldMaintenanceMarginRate
assert tier['notionalFloor'] > oldNotionalFloor assert tier['notionalFloor'] > oldNotionalFloor
assert tier['notionalCap'] > oldNotionalCap assert tier['notionalCap'] > oldNotionalCap
oldLeverage = tier['maxLeverage'] oldLeverage = tier['maxLeverage']
oldMaintenanceMarginRate = tier['maintenanceMarginRate'] oldMaintenanceMarginRate = tier['maintenanceMarginRatio']
oldNotionalFloor = tier['notionalFloor'] oldNotionalFloor = tier['notionalFloor']
oldNotionalCap = tier['notionalCap'] oldNotionalCap = tier['notionalCap']