checks in maintenance margin
This commit is contained in:
parent
c49a64ea59
commit
923e4ead49
@ -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
|
from freqtrade.persistence import Trade
|
||||||
|
|
||||||
|
|
||||||
@ -13,9 +14,14 @@ class MaintenanceMargin:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def liq_level(self): # This may be a constant value and may not need a function
|
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
|
return
|
||||||
|
|
||||||
def add_new_trade(self, trade):
|
def add_new_trade(self, trade):
|
||||||
|
Loading…
Reference in New Issue
Block a user