return none if no position in previous tick

This commit is contained in:
Giulio De Pasquale 2020-12-19 21:46:15 +00:00
parent e541b3d7d5
commit 13a6fb087e

View File

@ -172,6 +172,9 @@ class SymbolStatus:
if self.current_tick == 1:
return None
if not self.positions[self.current_tick - 1]:
return None
return next(filter(lambda x: x.position.id == pid, self.positions[self.current_tick - 1]))
def active_position_wrapper_from_id(self, position_id: int) -> Optional[PositionWrapper]: