Added enter_side and exit_side computed variables to persistence

This commit is contained in:
Sam Germain
2021-07-17 01:57:57 -06:00
parent 4b81fb31fb
commit 35fd8d6a02
2 changed files with 18 additions and 0 deletions

View File

@@ -297,6 +297,20 @@ class LocalTrade():
def close_date_utc(self):
return self.close_date.replace(tzinfo=timezone.utc)
@property
def enter_side(self) -> str:
if self.is_short:
return "sell"
else:
return "buy"
@property
def exit_side(self) -> str:
if self.is_short:
return "buy"
else:
return "sell"
def __init__(self, **kwargs):
for key in kwargs:
setattr(self, key, kwargs[key])