From 45871d5846df441684af1cb4a3ea6f526f05b4c1 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 10 Jul 2022 20:00:12 -0400 Subject: [PATCH] Freeze transactions, add todo notes for incr update --- piker/pp.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/piker/pp.py b/piker/pp.py index 88a7147d..4fe97ae6 100644 --- a/piker/pp.py +++ b/piker/pp.py @@ -96,7 +96,7 @@ def open_trade_ledger( return toml.dump(ledger, cf) -class Transaction(Struct): +class Transaction(Struct, frozen=True): # TODO: should this be ``.to`` (see below)? fqsn: str @@ -688,6 +688,18 @@ def update_pps_conf( dict[str, Position], dict[str, Position], ]: + # TODO: ideally we can pass in an existing + # pps state to this right? such that we + # don't have to do a ledger reload all the + # time.. a couple ideas I can think of, + # - load pps once after backend ledger state + # is loaded and keep maintainend in memory + # inside a with block, + # - mirror this in some client side actor which + # does the actual ledger updates (say the paper + # engine proc if we decide to always spawn it?), + # - do diffs against updates from the ledger writer + # actor and the in-mem state here? # this maps `.bsuid` values to positions pp_objs: dict[Union[str, int], Position]