From 8cd2354d7390508a9f727c18707ba1d4ce26dff9 Mon Sep 17 00:00:00 2001 From: algorandpa Date: Sat, 28 Jan 2023 18:14:59 -0500 Subject: [PATCH] ensure that paper pps are pulled on open --- piker/clearing/_paper_engine.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/piker/clearing/_paper_engine.py b/piker/clearing/_paper_engine.py index cd4eccf9..3c8ad233 100644 --- a/piker/clearing/_paper_engine.py +++ b/piker/clearing/_paper_engine.py @@ -288,6 +288,8 @@ class PaperBoi(Struct): # Write to pps toml with open_pps(self.broker, 'paper-id') as table: table.update_from_trans(self._txn_dict) + # save pps in local state + self._positions.update(table.pps) pp.add_clear(t) @@ -551,9 +553,16 @@ async def trades_dialogue( ) as feed, ): + with open_pps(broker, 'paper-id') as table: + # save pps in local state + _positions.update(table.pps) + + pp_msgs: list[BrokerdPosition] = [] pos: Position token: str # f'{symbol}.{self.broker}' + print("POSITIONS::") + print(_positions.items()) for token, pos in _positions.items(): pp_msgs.append(BrokerdPosition( broker=broker,