models.__init__ exception for no interest_rates on Margin trading

This commit is contained in:
Sam Germain 2021-12-31 06:20:00 -06:00
parent 867483170a
commit 46072be011
1 changed files with 3 additions and 1 deletions

View File

@ -335,7 +335,9 @@ class LocalTrade():
if self.isolated_liq:
self.set_isolated_liq(self.isolated_liq)
self.recalc_open_trade_value()
# TODO-lev: Throw exception if on margin and interest_rate is none
if self.trading_mode == TradingMode.MARGIN and self.interest_rate is None:
raise OperationalException(
f"{self.trading_mode.value} trading requires param interest_rate on trades")
def _set_stop_loss(self, stop_loss: float, percent: float):
"""