Commit Graph

1237 Commits (d8fd1c0d64f96189888046daf95de23667faac9f)

Author SHA1 Message Date
Tyler Goodlet d8fd1c0d64 Load provider search engines in tasks instead of exit stack 2021-07-05 09:53:19 -04:00
Tyler Goodlet b306d1573b Feed detach must explicitly unsub throttled streams
If a client attaches to a quotes data feed and requests a throttle rate,
be sure to unsub that side-band memchan + task when it detaches and
especially so on any transport connection error.

Also, use an explicit `tractor.Context.cancel()` on the client feed
block exit since we removed the implicit cancel option from the
`tractor` api.
2021-07-05 09:41:35 -04:00
Tyler Goodlet 77baad1e92 Make json resp log debug level 2021-07-05 09:36:54 -04:00
Tyler Goodlet ce40e46c91 TOSQUASH ems comments 2021-07-01 08:43:01 -04:00
Tyler Goodlet f348cbcd52 Better formalize `pikerd` service semantics
An async exit stack around the new `@tractor.context` is problematic
since a pushed context can't bubble errors unless the exit stack has
been closed. But in that case why do you need the exit stack if you're
going to push it and wait it right away; it seems more correct to use
a nursery and spawn a task in `pikerd` that waits on the both the
target context completion first (thus being able to bubble up any errors
from the remote, and top level service task) and the sub-actor portal.
(Sub)service Daemons are spawned with `.start_actor()` and thus will
block forever until cancelled so, add a way to cancel them explicitly
which we'll need eventually for restarts and dynamic feed management.

The big lesson here is that async exit stacks are not conducive to
spawning and monitoring service tasks, and especially so if
a `@tractor.context` is used since if the `.open_context()` call isn't
exited (only possible by the stack being closed), then there will be no
way for `trio` to cancel the task that pushed that context (since it
can't run a checkpoint while yielded inside the stack) without also
cancelling all other contexts pushed on that stack. Presuming one
`pikerd` task is used to do the original pushing (which it was) then
any error would have to kill all service daemon tasks which obviously
won't work.

I see this mostly as the painz of tinkering out an SC service manager
with `tractor` / `trio` for the first time, so try to go easy on the
process ;P
2021-06-26 16:52:15 -04:00
Tyler Goodlet 1edccf37d9 Support multiple client dialogues active on one brokerd trades dialogue 2021-06-26 16:00:04 -04:00
Tyler Goodlet d6d7c24320 WIP single brokerd dialogue 2021-06-25 00:57:58 -04:00
Tyler Goodlet 2465c8fc78 Pop subscriber streams on connection errors 2021-06-25 00:53:32 -04:00
Tyler Goodlet 998775dfd9 Don't use a context stack for contexts 2021-06-25 00:44:02 -04:00
Tyler Goodlet b81c538e85 Add more futes, add in order status comments 2021-06-23 10:09:45 -04:00
Tyler Goodlet 3dea1834de Make subplot proportion slightly larger 2021-06-23 10:07:41 -04:00
Tyler Goodlet 95e8d8c3a2 Label doc tweak 2021-06-23 10:06:27 -04:00
Tyler Goodlet 3bf400a1c3 WIP position market offscreen nav 2021-06-23 10:06:05 -04:00
Tyler Goodlet 39e8fb6e1c Only close event send side (facepalm) 2021-06-23 10:04:56 -04:00
Tyler Goodlet 56d13a46c7 Don't forget to pop the brokerd dialogue on teardown.. 2021-06-22 13:19:38 -04:00
Tyler Goodlet 5787488bdb Don't cancel handler nursery, let errors bubble 2021-06-22 10:58:52 -04:00
Tyler Goodlet 3f02c88718 Better live order handling logic 2021-06-22 10:57:08 -04:00
Tyler Goodlet cfd6e3216f Enable contents labels on q for "query" 2021-06-22 08:18:18 -04:00
Tyler Goodlet 54baa7b132 Avoid multiple `brokerd` trades dialogue flows
This solves a bunch of issues to do with `brokerd` order status msgs
getting relayed for each order to **every** correspondingly connected
EMS client. Previously we weren't keeping track of which emsd orders
were associated with which clients so you had backend msgs getting
broadcast to all clients which not only resulted in duplicate (and
sometimes erroneous, due to state tracking) actions taking place in the
UI's order mode, but it's also just duplicate traffic (usually to the
same actor) over multiple logical streams. Instead, only keep up **one**
(cached) stream with the `trades_dialogue()` endpoint such that **all**
emsd orders route over that single connection to the particular
`brokerd` actor.
2021-06-22 07:48:31 -04:00
Tyler Goodlet 803c02bd3e Port all to use new cursor and ohlc refs 2021-06-22 07:17:49 -04:00
Tyler Goodlet d2c3b03513 Move contents labels management to cursor mod
Add a new type/api to manage "contents labels" (labels that sit in
a view and display info about viewed data) since it's mostly used by
the linked charts cursor. Make `LinkedSplits.cursor` the new and only
instance var for the cursor such that charts can look it up from that
common class. Drop the `ChartPlotWidget._ohlc` array, just add
a `'ohlc'` entry to `._arrays`.
2021-06-21 16:45:27 -04:00
Tyler Goodlet 3a041e4f47 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-06-18 17:13:39 -04:00
Tyler Goodlet 97a55156ed Use group status for symbol loading 2021-06-18 09:38:14 -04:00
Tyler Goodlet 17a40862fd Fix old msg clearing var name 2021-06-18 09:37:55 -04:00
Tyler Goodlet 7d1f9c5102 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-06-17 17:00:57 -04:00
Tyler Goodlet 0c1c18bb94 Add an all order lines getter method 2021-06-17 17:00:10 -04:00
Tyler Goodlet fb040339e5 Add "group statuses" support to status bar
Allows for submitting a top level "group status" associated with
a "group key" which eventually resolves once all sub-statuses associated
with that group key (and thus top level status) complete and are also
removed. Also add support for a "final message" for each status such
that once the status clear callback is called a final msg is placed on
the status bar that is then removed when the next status is set.

It's all a questionable bunch of closures/callbacks but it worx.
2021-06-17 16:53:19 -04:00
Tyler Goodlet 095850c3ae Add fast tap key sequence support and order-mode-type statuses 2021-06-17 16:52:54 -04:00
Tyler Goodlet 92f350ab37 Make alerts solid line only 2021-06-16 10:31:00 -04:00
Tyler Goodlet 760323000f Didn't end up needing a task stack 2021-06-16 08:45:11 -04:00
Tyler Goodlet 8dd5bbf4fa Start input handling **after** order mode is up 2021-06-16 08:28:57 -04:00
Tyler Goodlet 29d3ad59dc Don't access unset cursor 2021-06-16 08:28:11 -04:00
Tyler Goodlet 5c93c2b42f Beautifully simplify kb handling code with set ops 2021-06-16 08:27:34 -04:00
Tyler Goodlet 151e427e1f Drop old commented behaviour; see parent class if needed 2021-06-16 05:43:35 -04:00
Tyler Goodlet 68093d55f2 Factor press and release handling into same qtloop 2021-06-16 05:24:04 -04:00
Tyler Goodlet 376aa66a73 Move region selection to editors mod 2021-06-15 19:02:46 -04:00
Tyler Goodlet 367a058342 Move line and arrow editors to new mod 2021-06-15 18:54:28 -04:00
Tyler Goodlet 23a03e3a0a Port cursor and axes to new widget names 2021-06-15 18:25:03 -04:00
Tyler Goodlet 08a21378b9 Convert view box to async input handling
Instead of callbacks for key presses/releases convert our `ChartView`'s
kb input handling to async code using our event relaying-over-mem-chan
system. This is a first step toward a more async driven modal control
UX. Changed a bunch of "chart" component naming as part of this as well,
namely: `ChartSpace` -> `GodWidget` and `LinkedSplitCharts` ->
`LinkedSplits`. Engage the view boxe's async handler code as part of new
symbol data loading in `display_symbol_data()`. More re-orging to come!
2021-06-15 18:19:59 -04:00
Tyler Goodlet 4759e79d3d Extend Qt event relaying
Add an `open_handler()` ctx manager for wholesale handling event sets
with a passed in async func. Better document and implement the event
filtering core including adding support for key "auto repeat" filtering;
it turns out the events delivered when `trio` does its guest-most tick
are not the same (Qt has somehow consumed them or something) so we have
to do certain things (like getting the `.type()`, `.isAutoRepeat()`,
etc.) before shipping over the mem chan. The alt might be to copy the
event objects first but haven't tried it yet. For now just offer
auto-repeat filtering through a flag.
2021-06-15 18:14:24 -04:00
Tyler Goodlet df2f6487ff Apply `brokerd` quote rate throttling when requested in `open_feed()` 2021-06-14 21:55:51 -04:00
Tyler Goodlet ccf81520cb First attempt data feed side quote throttling
Adding binance's "hft" ws feeds has resulted in a lot of context
switching in our Qt charts, so much so it's chewin CPU and definitely
worth it to throttle to the detected display rate as per discussion in
issue #192.

This is a first very very naive attempt at throttling L1 tick feeds on
the `brokerd` end (producer side) using a constant and uniform delivery
rate by way of a `trio` task + mem chan.  The new func is
`data._sampling.uniform_rate_send()`. Basically if a client request
a feed and provides a throttle rate we just spawn a task and queue up
ticks until approximately the next display rate's worth period of time
has passed before forwarding. It's definitely nothing fancy but does
provide fodder and a start point for an up and coming queueing eng to
start digging into both #107 and #109 ;)
2021-06-14 21:43:19 -04:00
Tyler Goodlet 57a35a3c6c Port feed bus endpoint to a `@tractor.context` 2021-06-14 10:55:01 -04:00
goodboy 8cde68fedb
Merge pull request #198 from pikers/msgspec_fixes
Msgspec fixes
2021-06-14 08:53:51 -04:00
Tyler Goodlet 3455ebc60c Cast back to tuples after msgspec strips them... 2021-06-14 00:03:05 -04:00
Tyler Goodlet 588b5c317c Drop unseralizable "sec tag" for now 2021-06-14 00:02:23 -04:00
goodboy e52ecbe589
Merge pull request #189 from pikers/status_bar
Basic status bar
2021-06-14 00:01:01 -04:00
Tyler Goodlet f320f95288 Drop old hi-dpi font inches sizes 2021-06-13 23:59:02 -04:00
Tyler Goodlet d269edc0b3 Re-org main window singleton into a new module
Avoids some cyclical and confusing import time stuff that we needed to get
DPI aware fonts configured from the active display. Move the main window
singleton into its own module and add a `main_window()` getter for it.
Make `current_screen()` a ``MainWindow` method to avoid so many module
variables.
2021-06-13 23:47:52 -04:00
Tyler Goodlet 84f61c9a92 Avoid clearing cached results; detect repeats later 2021-06-10 13:23:28 -04:00