Commit Graph

69 Commits (f4740da6a22589a4842220ad9bb8439023dc3f62)

Author SHA1 Message Date
Tyler Goodlet f4740da6a2 Drop `.accounts` field from allocator 2021-09-14 13:10:39 -04:00
Tyler Goodlet 4afafce297 Update icons from pps at order mode startup 2021-09-14 12:26:26 -04:00
Tyler Goodlet be5a8e66d8 Only show accounts reported from clearing sys 2021-09-14 10:37:30 -04:00
Tyler Goodlet 4f9827c070 Try out account icons from order mode 2021-09-13 08:48:04 -04:00
Tyler Goodlet 8ec31d9256 Make order mode expect account names in startup pp msgs 2021-09-13 08:28:44 -04:00
Tyler Goodlet 16b7456fef Fix indentation 2021-09-13 08:24:45 -04:00
Tyler Goodlet ef6594cfc4 Re-factor pnl display logic into settings pane 2021-09-12 12:40:27 -04:00
Tyler Goodlet 1fe29dc86b Revert "Drop extra method"
This reverts commit 6fa8958acf.

We actually do need it since the selection widget of course won't tell
you its "key" that we assign and further we'd have to use a (value, key)
style invocation which isn't super pythonic.
2021-09-11 13:21:19 -04:00
Tyler Goodlet 6fa8958acf Drop extra method 2021-09-11 10:56:03 -04:00
Tyler Goodlet 7e366d18cb Handle paper account loading
The paper engine returns `"paper"` instead of `None` in the pp msgs so
expect that. Don't bother with fills tracking for now (since we'll need
either the account in the msg or a lookup table locally for oids to
accounts). Change the order line update handler to a local module function,
there was no reason for it to be a pane method.
2021-09-11 10:42:32 -04:00
Tyler Goodlet b6b3ca15c5 Activate pnl updates from order mode method on account switches 2021-09-10 14:59:42 -04:00
Tyler Goodlet 149bee1058 Create net-zero pps from startup vs. accounts diff 2021-09-10 14:01:29 -04:00
Tyler Goodlet f16591612e Support real-time account switch and status update
Make a pp tracker per account and load on order mode boot.
Only show details on the pp tracker for the selected account.
Make the settings pane assign a `.current_pp` state on the order mode
instance (for the charted symbol) on account selection switches and no
longer keep a ref to a single pp tracker and allocator in the pane.

`SettingsPane.update_status_ui()` now expects an explicit tracker
reference as input. Still need to figure out the pnl update task logic
despite the intermittent account changes.
2021-09-10 11:50:24 -04:00
Tyler Goodlet b01538f183 Support an account field in clearing system
Each backend broker may support multiple (types) of accounts; this patch
lets clients send order requests that pass through an `account` field in
certain `emsd` <-> `brokerd` transactions. This allows each provider to read
in and conduct logic based on what account value is passed via requests
to the `trades_dialogue()` endpoint as well as tie together positioning
updates with relevant account keys for display in UIs.

This also adds relay support for a `Status` msg with a `'broker_errored'`
status which for now will trigger the same logic as cancelled orders on
the client side and thus will remove order lines submitted on a chart.
2021-09-08 15:46:33 -04:00
Tyler Goodlet 063788499a Use a pnl task per symbol 2021-09-07 12:54:32 -04:00
Tyler Goodlet 5d25a0d370 Better pp loading at startup
- directly lookup the position data for the current symbol
- let `mk_alloc()` create the allocator
- load and set account name for pp in sidepane
2021-09-07 09:23:18 -04:00
Tyler Goodlet 214c622328 Move allocator components to clearing sub-pkg 2021-09-06 22:05:42 -04:00
Tyler Goodlet 343cb4b0ae Port order mode setup to new pp apis; reduces implicit update logic 2021-09-06 21:36:30 -04:00
Tyler Goodlet b9ee0997a7 Only do tracker update if pp msg is received for sym 2021-09-06 12:42:25 -04:00
Tyler Goodlet c26161ed7e Make config acounts loading more explicit. 2021-09-06 09:28:11 -04:00
Tyler Goodlet c5191d66cb Use new method name in order mode 2021-09-06 09:28:11 -04:00
Tyler Goodlet a0258d8be1 Configure alloc to asset type *before* setting pp labels 2021-09-06 09:28:11 -04:00
Tyler Goodlet 30dfcc4530 Use pnl calc in order mode (i.e. no x100%) 2021-09-06 09:28:10 -04:00
Tyler Goodlet 32f8931d79 Show "slots used" aka proportion "x" on order lines 2021-09-06 09:28:10 -04:00
Tyler Goodlet 423fc8332c Allocate pnl calc subtask inside order mode machinery 2021-09-06 09:28:10 -04:00
Tyler Goodlet dfe4ca948a Flip to `open_order_mode()` as ctx mngr
We need a subtask to compute the current pp PnL in real-time but really
only if a pp exists - a spawnable subtask would be ideal for this. Stage
a tick streaming task using a stream bcaster; no actual pnl calc yet.

Since we're going to need subtasks anyway might as well stick the order
mode UI processing loop in a task as well and then just give the whole
thing a ctx mngr api. This'll probably be handy for when we have
auto-strats that need to dynamically use the mode's api as well.

Oh, and move the time -> index mapper to a chart method for now.
2021-09-06 09:28:10 -04:00
Tyler Goodlet 5103204853 Trigger order allocation at stage/creation time 2021-09-06 09:28:10 -04:00
Tyler Goodlet a006ffce80 Update pane status on position updates from ems
Turned out to be pretty simple, on every pp update just recompute
the proportion of slots used based on the limit size units.
Don't assign the allocator callback method for alert lines since
there's no size to generate. Move from-existing-pp calculations
into the order pane itself.
2021-09-06 09:28:10 -04:00
Tyler Goodlet 206af0d575 Port to order pane apis 2021-09-06 09:28:10 -04:00
Tyler Goodlet dfb9c55944 Compute symbol digits at creation time
Add a new factory func `mk_symbol()` to create the initial
instance at feed creation time.
2021-09-06 09:28:10 -04:00
Tyler Goodlet 17fbe6a6ab Start drafting out alloctor settings per asset type 2021-09-06 09:28:10 -04:00
Tyler Goodlet 873d531521 Vastly simplify order mode line management
- generate lines from staged `Order` msgs
- apply level update callback to each order that dynamically
  updates the order size from the allocator calcs
- pass order msg instances to the ems client for submission
- update order size on line moves
- add `Order` msg and `Symbol` refs to each dialog
2021-09-06 09:28:10 -04:00
Tyler Goodlet a40205728f Position tracker is passed at init 2021-09-06 09:28:10 -04:00
Tyler Goodlet b302707bf3 Order mode docs/comments updates 2021-09-06 09:28:10 -04:00
Tyler Goodlet 1ae39c963a Allocate pp config form alongside god widget as a side-pane 2021-09-06 09:28:10 -04:00
Tyler Goodlet d022a105bb Start using a small schema for generating forms 2021-09-06 09:28:10 -04:00
Tyler Goodlet 29ea91553d Use "slots" as name for "number of entries" 2021-09-06 09:28:10 -04:00
Tyler Goodlet 7e2e316cbf "Forms" is a better module name 2021-09-06 09:28:10 -04:00
Tyler Goodlet a2b61a67b5 Allocate pp config with new actory, drop old line update method 2021-09-06 09:28:10 -04:00
Tyler Goodlet 0f176425b1 First WIP of pp config entry widget on status bar 2021-09-06 09:28:10 -04:00
Tyler Goodlet 5144492534 Just warn for now on unknown dialogs 2021-09-06 09:28:10 -04:00
Tyler Goodlet c8b14e9445 Pass position msg to tracker, append fill msgs 2021-09-06 09:28:10 -04:00
Tyler Goodlet 74d6dd5957 Move position tracking to new module
It was becoming too much with all the labels and markers and lines..
Might as well package it all together instead of cramming it in the
order mode loop, chief.

The techincal summary,
- move `_lines.position_line()` -> `PositionInfo.position_line()`.
- slap a `.pp` on the order mode instance which *is* a `PositionInfo`
- drop the position info info label for now (let's see what users want
  eventually but for now let's keep it super minimal).
- add a `LevelMarker` type to replace the old `LevelLine` internal
  marker system (includes ability to change the style and level on the
  fly).
- change `_annotate.mk_marker()` -> `mk_maker_path()` and expect caller
  to wrap in a `QGraphicsPathItem` if needed.
2021-09-06 09:28:10 -04:00
Tyler Goodlet 45d6682ae0 Update entry count on position msgs, draft a composite position info type 2021-09-06 09:28:10 -04:00
Tyler Goodlet d21112dcd7 Drop the open ctx mng; add wip pp label 2021-09-06 09:28:10 -04:00
Tyler Goodlet 0dc18598fb Add a client side order dialog type for tracking flows in the UI 2021-09-05 13:59:40 -04:00
Tyler Goodlet 62dd327ef3 Drop `_graphics` subpkg; flat is better then nested 2021-09-05 13:59:40 -04:00
Tyler Goodlet 8b966cd7e4 Port all to use new cursor and ohlc refs 2021-07-08 10:55:47 -04:00
Tyler Goodlet d3d5d4ad06 Drop global order lines map
Orders in order mode should be chart oriented since there's a mode per
chart. If you want all orders just ask the ems or query all the charts
in a loop.

This fixes cancel-all-orders such that when 'cc' is tapped only the
orders on the *current* chart are cancelled, lel.
2021-07-08 10:55:47 -04:00
Tyler Goodlet eeeeb29f71 Add order cancellation and submission statuses
Generalize the methods for cancelling groups of orders (all or those
under cursor) and add new group status support such that statuses for
each cancel or order submission is displayed in the status bar. In the
"cancel-all-orders" case, use the new group status stuff.
2021-07-08 10:55:47 -04:00