Commit Graph

3096 Commits (e45bc4c619cbc493a97cd8915cbda97a749a6a6f)

Author SHA1 Message Date
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
Tyler Goodlet d38a6bf032 Create alloc instance in factory body, template out defaults loading 2021-09-07 08:38:24 -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 5333d25bf6 Better separation of UI vs. allocator settings
Get rid of `PositionTracker.init_status_ui()` and instead make
a helper func `mk_allocator()` which takes in the alloc and adjusts
default settings on the allocator alone (which is expected to be
passed in). Expect a `Position` instance to be passed into the tracker
which will be looked up for UI updates. Move *update-from-position-msg*
ops into a `Position.update_from_msg()` method.
2021-09-06 21:35:11 -04:00
Tyler Goodlet 15025d6047 Move config module to top level 2021-09-06 21:26:28 -04:00
goodboy 73b555a677
Merge pull request #205 from pikers/ordermode_pps
Ordermode pps for gamified chart trading .
2021-09-06 16:35:26 -04:00
Tyler Goodlet 202b857620 Add micro-manual for order mode to readme 2021-09-06 14:09:39 -04:00
Tyler Goodlet 85fd0a7a30 Avoid "n" as name since it conflicts with pdb 2021-09-06 13:46:07 -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 3713831070 Fix fsp pane width to exactly the same as OHLC chart 2021-09-06 09:28:11 -04:00
Tyler Goodlet 37719efe37 Scale status bar labels to actual bar height 2021-09-06 09:28:11 -04:00
Tyler Goodlet 28047c523d Drop cruft from before pane-per-chart was added 2021-09-06 09:28:11 -04:00
Tyler Goodlet c26161ed7e Make config acounts loading more explicit. 2021-09-06 09:28:11 -04:00
Tyler Goodlet c86c4218ce Allow blank accounts config 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 27f10293bd Fix pp line label update logic
We weren't updating the LHS size labels on creation and we now use the
lot size digits to do so. Change `PositionTracker.update()` to
`.update_from_pp_msg()`.
2021-09-06 09:28:11 -04:00
Tyler Goodlet 171832cfb8 Tweak account label 2021-09-06 09:28:11 -04:00
Tyler Goodlet 35fe26cb95 Assign unique shm keys for duplicate fsps to avoid array clobbering 2021-09-06 09:28:11 -04:00
Tyler Goodlet 709288d034 Sway fixes that avoid weird window resizing 2021-09-06 09:28:11 -04:00
Tyler Goodlet e95589e5b0 Ignore ohlc step stream subs lookup errors 2021-09-06 09:28:11 -04:00
Tyler Goodlet 9c4437b179 Scale pp pane to chart height
Acts as a fix for lodpi and better sizing logic for the pp status bar.
Drop all the redundant passing of the form to its child layouts during
instantiating (since they're all added as layouts to the tree). Comment
out the feed status label for now since it's not hooked up to the
backend and we'll get it going in a new PR.

Down the road we probably want to do all the pp pane component-widget
sizing *after* the `pyqtgraph` chart is up; it's going to take some
reworking of the charting api tho.
2021-09-06 09:28:11 -04:00
Tyler Goodlet cf9de5cd50 Use ``order_line()`` factor for pp tracker 2021-09-06 09:28:11 -04:00
Tyler Goodlet dc7fcbe792 Tweak mouse rate limits per sway experiments; size line dot to dpi font 2021-09-06 09:28:11 -04:00
Tyler Goodlet 34d4d098d2 Add silver futes 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 1d8767d548 Make `order_line()` configurable for a pp line
We were re-implementing a few things order lines already support.
All we really needed was to not add a pp size label if one is provided.
Use `.hide_label()` in the mouse hover handler.
2021-09-06 09:28:11 -04:00
Tyler Goodlet 77e014daa3 No longer feed specific 2021-09-06 09:28:11 -04:00
Tyler Goodlet 28b6882725 Slapp in exchange suffix position msg key; avoid symbol aliasing on `in` check 2021-09-06 09:28:11 -04:00
Tyler Goodlet fa88d91b8d Add breakpoint on bcast lag for testing 2021-09-06 09:28:11 -04:00
Tyler Goodlet 32f72dd3e8 Drop unused ref 2021-09-06 09:28:10 -04:00
Tyler Goodlet a0c03a8b6b Format pnl label with % type 2021-09-06 09:28:10 -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 4247f28e04 Round slots proportion instead of ceiling-ing them 2021-09-06 09:28:10 -04:00
Tyler Goodlet 60a6016e73 Break up the pnl calc from the percent part 2021-09-06 09:28:10 -04:00
Tyler Goodlet f90be981b0 Form font size must be set before adding widgets 2021-09-06 09:28:10 -04:00
Tyler Goodlet e78a03d988 Fix import from wrong namespace, again. 2021-09-06 09:28:10 -04:00
Tyler Goodlet 55ae007233 Pixel cache our label type 2021-09-06 09:28:10 -04:00