Commit Graph

1933 Commits (a45156cbb70cd46811d23deb770f990257ab72b6)

Author SHA1 Message Date
Tyler Goodlet 75e1bf3f6e Factor combobox logic into a new `Selection` subtype 2021-09-14 10:34:36 -04:00
Tyler Goodlet 6a31c4e160 Fix missing tracker to ui update call 2021-09-13 19:08:30 -04:00
Tyler Goodlet 335e72bf32 Move icons generatino to new module 2021-09-13 18:40:12 -04:00
Tyler Goodlet 66199bfe6f Implement the pixmap mask hack for long/short pp icons 2021-09-13 17:40:14 -04:00
Tyler Goodlet 3de4b9afbb Scale down icons size, add RHS icons theory code 2021-09-13 17:39:19 -04:00
Tyler Goodlet 6ac092d618 Scale search results indent to font size 2021-09-13 08:48:11 -04:00
Tyler Goodlet 4f9827c070 Try out account icons from order mode 2021-09-13 08:48:04 -04:00
Tyler Goodlet bbcdb88263 Add account icon setter method 2021-09-13 08:47:06 -04:00
Tyler Goodlet d08886dceb Try to set icons on RHS, store combo box entries in map 2021-09-13 08:47:06 -04:00
goodboy 07214f2044
Merge pull request #225 from pikers/pp_relay_hotfix
Ugh, positions relay hotfix
2021-09-13 08:46:23 -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 c6cc592f4e Fix wrong key, use account value 2021-09-13 08:24:45 -04:00
Tyler Goodlet eb70baf161 Pass account names on wire: brokerd => emsd 2021-09-13 08:24:45 -04:00
Tyler Goodlet 16b7456fef Fix indentation 2021-09-13 08:24:45 -04:00
Tyler Goodlet 6acfd6c38a Ugh, positions relay hotfix
Must have run into some confusion with data structures in `brokerd` vs.
`emsd`. This fixes the ems `relay.positions` state tracking to be
composed maps, vs. messages from `brokerd` should just be a sequence.
2021-09-12 19:30:43 -04:00
goodboy cecba8904d
Merge pull request #223 from pikers/account_select
`brokerd`, `emsd` and UI multi-account per broker, order mode support
2021-09-12 17:32:32 -04:00
Tyler Goodlet ef6594cfc4 Re-factor pnl display logic into settings pane 2021-09-12 12:40:27 -04:00
Tyler Goodlet 21e6bee39b Fix legacy import from `QtGui` 2021-09-11 18:19:58 -04:00
Tyler Goodlet 2312b6aeb2 Fix conftest config mod import 2021-09-11 18:15:42 -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 f81d47efc4 Detail some comments 2021-09-11 13:10:20 -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 8886f11c62 Don't allow selecting accounts that haven't been loaded 2021-09-11 10:41:52 -04:00
Tyler Goodlet c00cf12f94 Deliver ems cached pps are dict of lists 2021-09-10 18:54:34 -04:00
Tyler Goodlet 054ddf6732 Send error on non-paper account requests to paperboi 2021-09-10 18:54:04 -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 d25aec53e3 Append pp values per account during startup on ib 2021-09-10 11:36:46 -04:00
Tyler Goodlet 71afce69d0 Append paper account last when loading 2021-09-10 11:35:30 -04:00
Tyler Goodlet f9e5769b01 Lintn: add missing space 2021-09-10 11:35:00 -04:00
Tyler Goodlet 46d3bf0484 Drop commented assert about `form.model` 2021-09-10 11:34:29 -04:00
Tyler Goodlet 4e1bac0071 Update label on `.show()` 2021-09-10 11:33:58 -04:00
Tyler Goodlet e1efb0943b Track per-account pps in ems memory 2021-09-10 11:33:08 -04:00
Tyler Goodlet 87bca9aae1 Tweak accounts schema to be per-provider 2021-09-09 10:46:39 -04:00
Tyler Goodlet c9eb0b5afb Show account name on pp line 2021-09-09 10:34:48 -04:00
Tyler Goodlet 5e947e7887 Maybe show account names on order lines 2021-09-09 10:34:14 -04:00
Tyler Goodlet 15aba154f2 Return account name in next order info 2021-09-09 10:33:52 -04:00
Tyler Goodlet c53b8ec43c Make `ib` backend multi-client capable
This adds full support for a single `brokerd` managing multiple API
endpoint clients in tandem. Get the client scan loop correct and load
accounts from all discovered clients as specified in a user's
`broker.toml`. We now just always re-scan for all clients and if there's
a cache hit just skip a creation/connection logic.

Route orders with an account name to the correct client in the
`handle_order_requests()` endpoint and spawn an event relay task per
client for transmitting trade events back to `emsd`.
2021-09-09 08:07:11 -04:00
Tyler Goodlet dedfb27a3a Add per-account order entry for ib
Make the `handle_order_requests()` tasks now lookup the appropriate API
client for a given account (or error if it can't be found) and use it
for submission. Account names are loaded from the
`brokers.toml::accounts.ib` section both UI side and in the `brokerd`.
Change `_aio_get_client()` to a `load_aio_client()` which now tries to
scan and load api clients for all connections defined in the config as
well as deliver the client cache and account lookup tables.
2021-09-08 15:55:45 -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 504040eb59 Add an `account` field to EMS msging schemas 2021-09-08 14:03:18 -04:00
Tyler Goodlet 0d2cddec9a Return accounts in `bidict` 2021-09-08 14:01:54 -04:00
Tyler Goodlet 063788499a Use a pnl task per symbol 2021-09-07 12:54:32 -04:00
Tyler Goodlet b5c1120ad0 Set account in ui handler 2021-09-07 12:54:10 -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 2bc07ae05b Try explicit matches of symbol to our adhoc set for pp msgs 2021-09-07 09:22:56 -04:00
Tyler Goodlet 7b86b6ae20 Add account settings change support 2021-09-07 09:22:24 -04:00
Tyler Goodlet 09d34f7355 Make `accounts` field public, add an account name method 2021-09-07 09:21:55 -04:00