diff --git a/piker/clearing/_ems.py b/piker/clearing/_ems.py index c35e2e5f..f802b8a3 100644 --- a/piker/clearing/_ems.py +++ b/piker/clearing/_ems.py @@ -414,6 +414,9 @@ async def open_brokerd_trades_dialogue( ) try: + positions: list[BrokerdPosition] + accounts: tuple[str] + async with ( open_trades_endpoint as (brokerd_ctx, (positions, accounts,)), brokerd_ctx.open_stream() as brokerd_trades_stream, diff --git a/piker/ui/order_mode.py b/piker/ui/order_mode.py index 432c4801..48be0384 100644 --- a/piker/ui/order_mode.py +++ b/piker/ui/order_mode.py @@ -47,7 +47,7 @@ from ._position import ( ) from ._label import FormatLabel from ._window import MultiStatus -from ..clearing._messages import Order +from ..clearing._messages import Order, BrokerdPosition from ._forms import open_form_input_handling @@ -529,7 +529,12 @@ async def open_order_mode( book: OrderBook trades_stream: tractor.MsgStream - position_msgs: dict + + # The keys in this dict **must** be in set our set of "normalized" + # symbol names (i.e. the same names you'd get back in search + # results) in order for position msgs to correctly trigger the + # display of a position indicator on screen. + position_msgs: dict[str, list[BrokerdPosition]] # spawn EMS actor-service async with ( @@ -563,7 +568,9 @@ async def open_order_mode( providers=symbol.brokers ) - # use only loaded accounts according to brokerd + # XXX: ``brokerd`` delivers a set of account names that it allows + # use of but the user also can define the accounts they'd like + # to use, in order, in their `brokers.toml` file. accounts = {} for name in brokerd_accounts: # ensure name is in ``brokers.toml``