piker/piker/clearing
Tyler Goodlet 0462415491 `_ems`: tolerate and warn on already popped execs
In the `translate_and_relay_brokerd_events()` loop task that is, such
that we never crash on a `status_msg = book._active.pop(oid)` in the
'closed' status handler whenever a double removal happens.

Turns out there were unforeseen races here when a benign backend error
would cause an order-mode dialog to be cancelled (incorrectly) and then
a UI side `.on_cancel()` would trigger too-early removal from the
`book._active` table despite the backend sending an actual 'closed'
event (much) later, this would crash on the now missing entry..

So instead we now,
- obviously use `book._active.pop(oid, None)`
- emit a `log.warning()` (not info lol) on a null-read and with a less
  "one-line-y" message explaining the double removal and maybe *why*.
2025-09-29 13:21:11 -04:00
..
README.rst Further root readme bump, factor `.clearing` content 2025-02-12 15:01:51 -05:00
__init__.py Bleh, move `.data.types` back up to top level pkg 2023-08-05 15:57:10 -04:00
_client.py Adjust to `trio`'s strict eg nurseries throughout! 2025-06-26 11:07:56 -04:00
_ems.py `_ems`: tolerate and warn on already popped execs 2025-09-29 13:21:11 -04:00
_messages.py Add an option `BrokerdPosition.bs_mktid` field 2025-09-26 17:38:22 -04:00
_paper_engine.py TOSQUASH: 84ad34f51, one more `float` cast for paperboi.. 2025-04-22 22:29:12 -04:00
_util.py Bleh, move `.data.types` back up to top level pkg 2023-08-05 15:57:10 -04:00

README.rst

piker.clearing

trade execution-n-control subsys for both live and paper trading as well as algo-trading manual override/interaction across any backend broker and data provider.

avail UIs

order ctl

the piker.clearing subsys is exposed mainly though the piker chart GUI as a "chart trader" style UX and is automatically enabled whenever a chart is opened.

the "manual" order control features are exposed via the piker.ui.order_mode API and can pretty much always be used (at least) in simulated-trading mode, aka "paper"-mode, and the micro-manual is as follows:

order_mode (

edge triggered activation by any of the following keys, mouse-click on y-level to submit at that price ):

  • f/ ctl-f to stage buy
  • d/ ctl-d to stage sell
  • a to stage alert
search_mode (

ctl-l or ctl-space to open, ctl-c or ctl-space to close ) :

  • begin typing to have symbol search automatically lookup symbols from all loaded backend (broker) providers
  • arrow keys and mouse click to navigate selection
  • vi-like ctl-[hjkl] for navigation

position (pp) mgmt

you can also configure your position allocation limits from the sidepane.