Makes the emsd run the dark clearing and relay loop tasks in inside the long lived Router.nursery and avoid more then a single task per instrument real-time feed except where needed by the paper clearing engine.
deats:
_emsd_main() now on-demand spawns trade relay tasks per symbol and leaves them running even when no clients are connected to the EMS and now only directly determines the lifetime of the process_client_order_cmds() task
includes some naive support for notifications when the emsd is running "headless" which is currently packed into Router.client_broadcast()
solve the slight causality dilemma when a backend first boots:
when a client connects the first time it needs the current position and/or book state but on the first connect to some backend the book will be empty and needs to be populated with existing live orders, but the translate_and_relay_brokerd_events() needs to be first started so that existing open orders can be loaded and relayed to the client
solution => make Router.open_trade_relays() deliver a client_ready: trio.Event which the client-caller-task sets once it opened a stream thus signalling the relay task to start and existing orders to be relayed to the now registered client
(replacement for #406 after rebase history adjustments.) Resolves the requirements listed in #405 and requires the patch in https://github.com/goodboy/tractor/pull/329.
Makes the
emsd
run the dark clearing and relay loop tasks in inside the long livedRouter.nursery
and avoid more then a single task per instrument real-time feed except where needed by the paper clearing engine.deats:
_emsd_main()
now on-demand spawns trade relay tasks per symbol and leaves them running even when no clients are connected to the EMS and now only directly determines the lifetime of theprocess_client_order_cmds()
taskemsd
is running "headless" which is currently packed intoRouter.client_broadcast()
translate_and_relay_brokerd_events()
needs to be first started so that existing open orders can be loaded and relayed to the clientRouter.open_trade_relays()
deliver aclient_ready: trio.Event
which the client-caller-task sets once it opened a stream thus signalling the relay task to start and existing orders to be relayed to the now registered clienttest list:
see #405