diff --git a/freqtrade/maintenance_margin.py b/freqtrade/maintenance_margin.py index 8fa5cf58a..7e198b9ed 100644 --- a/freqtrade/maintenance_margin.py +++ b/freqtrade/maintenance_margin.py @@ -1,4 +1,5 @@ -from freqtrade.enums import LiqFormula +from freqtrade.enums import LiqFormula, TradingMode +from freqtrade.exceptions import OperationalException from freqtrade.persistence import Trade @@ -13,9 +14,14 @@ class MaintenanceMargin: @property def liq_level(self): # This may be a constant value and may not need a function - return + return # If constant, would need to be recalculated after each new trade - def __init__(self, formula: LiqFormula): + def __init__(self, formula: LiqFormula, trading_mode: TradingMode): + if ( + trading_mode != TradingMode.CROSS_MARGIN or + trading_mode != TradingMode.CROSS_FUTURES + ): + raise OperationalException("Maintenance margin should only be used for cross trading") return def add_new_trade(self, trade):