checks in maintenance margin

This commit is contained in:
Sam Germain 2021-08-01 23:08:47 -06:00
parent c49a64ea59
commit 923e4ead49

View File

@ -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):