diff --git a/bfxbot/models.py b/bfxbot/models.py index 0cce18d..ff6cc94 100644 --- a/bfxbot/models.py +++ b/bfxbot/models.py @@ -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]: