Isolated liq branch passes all tests and has the general structure that it is supposed to, but is patchy, and doesnt get the correct maintenance amt and maintenance margin rate yet

This commit is contained in:
Sam Germain
2021-11-05 19:27:06 -06:00
parent eee7271ab8
commit ba02605d77
6 changed files with 103 additions and 44 deletions

View File

@@ -365,9 +365,11 @@ class LocalTrade():
def set_isolated_liq(
self,
isolated_liq: Optional[float],
wallet_balance: Optional[float],
current_price: Optional[float]
isolated_liq: Optional[float] = None,
wallet_balance: Optional[float] = None,
current_price: Optional[float] = None,
maintenance_amt: Optional[float] = None,
mm_rate: Optional[float] = None,
):
"""
Method you should use to set self.liquidation price.
@@ -389,9 +391,9 @@ class LocalTrade():
mm_ex_1=0.0,
upnl_ex_1=0.0,
position=self.amount * current_price,
wallet_balance=wallet_balance,
# TODO-lev: maintenance_amt,
# TODO-lev: mm_rate,
wallet_balance=self.amount / self.leverage, # TODO-lev: Is this correct?
maintenance_amt=maintenance_amt,
mm_rate=mm_rate,
)
if isolated_liq is None: