Commit Graph

2447 Commits (208e2e9e97860c943615e58d4eced9f8c3c4127b)

Author SHA1 Message Date
Tyler Goodlet 224c01e43e Spawn and cache an fsp cluster ahead of time
Use a fixed worker count and don't respawn for every chart, instead
opting for a round-robin to tasks in a cluster and (for now) hoping for
the best in terms of trio scheduling, though we should obviously route
via symbol-locality next. This is currently a boon for chart spawning
startup times since actor creation is done AOT.

Additionally,
- use `zero_on_step` for dollar volume
- drop rsi on startup (again)
- add dollar volume (via fsp) along side unit volume
- litter more profiling to fsp chart startup sequence
- pre-define tick type classes for update loop
2022-01-23 19:43:45 -05:00
Tyler Goodlet 2eef6c76d0 Start trionics mod with an `async_enter_all` 2022-01-23 19:41:57 -05:00
Tyler Goodlet 746db60e5b Increases IB api connect timeout to 1s 2022-01-23 18:18:10 -05:00
Tyler Goodlet fc3baf4bd1 Bump timeout up 2022-01-23 18:18:10 -05:00
Tyler Goodlet f1d61ac01b WIP ib: toying with showing history before first quote 2022-01-23 18:18:10 -05:00
Tyler Goodlet d69d3b319e Lengthen startup quote get timeout 2022-01-23 18:18:10 -05:00
Tyler Goodlet 0e4a7e3846 Only warn on slow quote query 2022-01-23 18:18:10 -05:00
Tyler Goodlet 0bcaeda784 Repeat the click 3 times 2022-01-23 18:18:10 -05:00
Tyler Goodlet c828261740 Activate/focus original window after feed reset 2022-01-23 18:18:10 -05:00
goodboy 4680d68824
Merge pull request #250 from pikers/single_display_update_loop
Single display update loop
2022-01-23 15:56:11 -05:00
goodboy 242d02b1cd
Merge pull request #249 from pikers/basic_vlm_display
Basic vlm display
2022-01-23 15:20:43 -05:00
Tyler Goodlet 139eca47f7 Don't push stream msgs in fsps by default 2022-01-23 12:49:06 -05:00
Tyler Goodlet 21386f6c1f Rename feed bus entrypoint 2022-01-23 12:22:37 -05:00
Tyler Goodlet 853e8d4466 Process framed ticks by type in main graphics loop
We are already packing framed ticks in extended lists from
the `.data._sampling.uniform_rate_send()` task so the natural solution
to avoid needless graphics cycles for HFT-ish feeds (like binance) is
to unpack those frames and for most cases only update graphics with the
"latest" data per loop iteration. Unpacking in this way also lessens
nested-iterations per tick type.

Btw, this also effectively solves all remaining issues of fast tick
feeds over-triggering the graphics loop renders as long as the original
quote stream is throttled appropriately, usually to the local display
rate.

Relates to #183, #192

Dirty deats:
- drop all per-tick rate checks, they were always somewhat pointless
  when iterating a frame of ticks per render cycle XD.
- unpack tick frame into ticks per frame type, and last of each type;
  the lasts are used to update each part of the UI/graphics by class.
- only skip the label update if we can't retrieve the last from from a
  graphics source array; it seems `chart.update_curve_from_array()`
  already does a `len` check internally.
- add some draft commented code for tick type classes and a possible
  wire framed tick data structure.
- move `chart_maxmin()` range computer to module level, bind a chart to
  it with a `partial.`
- only check rate limits in main quote loop thus reporting actual
  overages
- add in commented logic for only updating the "last" cleared price from
  the most recent framed value if we want to eventually (right now seems
  like this is only relevant to ib and it's dark trades: `utrade`).
- rename `_clear_throttle_rate` -> `_quote_throttle_rate`, drop
  `_book_throttle_rate`.
2022-01-23 12:19:11 -05:00
Tyler Goodlet e8cd1a0e83 Update fsps and overlays inside main OHLC chart update loop 2022-01-23 12:19:11 -05:00
Tyler Goodlet 96937829eb Factor FSP subplot update code into func
This is in prep toward doing fsp graphics updates from the main quotes
update loop (where OHLC and volume are done). Updating fsp output from
that task should, for the majority of cases, be fine presuming the
processing is derived from the quote stream as a source. Further,
calling an update function on each fsp subplot/overlay is of course
faster then a full task switch - which is how it currently works with
a separate stream for every fsp output. This also will let us delay
adding full `Feed` support around fsp streams for the moment while still
getting quote throttling dictated by the quote stream.

Going forward, We can still support a separate task/fsp stream for
updates as needed (ex. some kind of fast external data source that isn't
synced with price data) but it should be enabled as needed required by
the user.
2022-01-23 12:19:11 -05:00
Tyler Goodlet 4ea42a0a7e More prep for FSP feeds
The major change is moving the fsp "daemon" (more like wanna-be fspd)
endpoint to use the newer `tractor.Portal.open_context()` and
bi-directional streaming api.

There's a few other things in here too:
- make a helper for allocating single colume fsp shm arrays
- rename some some fsp related functions to be more explicit on their
  purposes
2022-01-23 12:19:11 -05:00
Tyler Goodlet 30a5f32ef8 Add back in rsi 2022-01-23 12:19:11 -05:00
Tyler Goodlet 37eeb0d74b Resize volume yaxis to in view range 2022-01-22 19:12:43 -05:00
Tyler Goodlet dd752927a2 Update vlm sticky 2022-01-22 19:12:31 -05:00
Tyler Goodlet dbdd7b6497 Fix color passthrough, make overlays a `dict` 2022-01-22 19:11:25 -05:00
Tyler Goodlet 39fb2ee85d Clean up some imports, shift around some commented code 2022-01-22 19:11:25 -05:00
Tyler Goodlet 40c874ce92 Pass curve color through to y sticky label 2022-01-22 19:11:25 -05:00
Tyler Goodlet ea5b55945f Re-order grays by "lightness" 2022-01-22 19:11:25 -05:00
Tyler Goodlet 216afec19c Add test logic for range based volume curve filling 2022-01-22 19:10:20 -05:00
Tyler Goodlet 4f9aa0d965 Add dynamic subplot sizing logic, passthrouh step curve colors 2022-01-22 19:05:15 -05:00
Tyler Goodlet 04373fd62a Drop rsi from display by default 2022-01-22 18:00:02 -05:00
Tyler Goodlet 2a59ccf1bb Incrementally yield to Qt loop to resize sidepanes
Since our startup is very concurrent there is often races where widgets
have not fully spawned before python (re-)sizing code has a chance to
run sizing logic and thus incorrect dimensions are read. Instead ensure
the Qt render loop gets to run in between such checks.

Also add a `open_sidepane()` mngr for creating a minimal form widget for
FSP subchart sidepanes which can be configured from an input `dict`.
2022-01-22 14:40:41 -05:00
Tyler Goodlet 6ec0fdcabf Add charting support for "step curves" via `style="step"` 2022-01-22 14:28:14 -05:00
goodboy b2ee78b71f
Merge pull request #239 from pikers/tinas_unite
Draft tina install section
2022-01-19 22:46:01 -05:00
Guillermo Rodriguez 9fc95deab7
Merge pull request #246 from pikers/msgpack_no_sets_allowed
Can't serialize a `set` on `msgpack` codec
2022-01-14 12:03:12 -03:00
Tyler Goodlet 50e8b3464f Can't serialize a `set` on `msgpack` codec 2022-01-14 09:16:34 -05:00
Tyler Goodlet 1ad2cd36c5 Draft tina install section 2021-12-09 16:26:18 -05:00
goodboy b8ed7da63c
Merge pull request #242 from pikers/simpler_quote_throttle_logic
Simplify throttle loop to a single `while` block
2021-12-09 16:21:35 -05:00
Tyler Goodlet bcc8d8a0d5 Simplify throttle loop to a single while block
This should in theory result in increased burstiness since we remove
the plain `trio.sleep()` and instead always wait on the receive channel
as much as possible until the `trio.move_on_after()` (+ time diffing
calcs) times out and signals the next throttled send cycle. This also is
slightly easier to grok code-wise instead of the `try, except` and
another tight while loop until a `trio.WouldBlock`. The only simpler
way i can think to do it is with 2 tasks: 1 to collect ticks and the
other to read and send at the throttle rate.

Comment out the log msg for now to avoid latency and add much more
detailed comments. Add an overrun log msg to the main sample loop.
2021-12-09 08:23:59 -05:00
goodboy c808965a6f
Merge pull request #240 from pikers/fast_step_curve
Fast step curve
2021-12-07 16:12:47 -05:00
Tyler Goodlet 18859e1b8c Add detailed comments, comment out fill mode 2021-12-07 16:10:33 -05:00
Tyler Goodlet 4f899edcef Use a `pyqtgraph` dev branch pin (again)
There's lotsa movement on the project these days with stuff getting
improved, borked, fixed, rinse repeat. Might as well use a pin on our
fork so we can more easily hack on it and pull in latest features
piece-wise for testing.
2021-12-07 15:11:00 -05:00
Tyler Goodlet a2659d1fde Only update curve lengths on non-negative index diffs 2021-11-12 16:03:23 -05:00
Tyler Goodlet 739399d5a9 Make `.paint()` method always the last 2021-11-12 16:03:23 -05:00
Tyler Goodlet 95bf522b48 Always draw a last step line with px width=2 2021-11-12 16:03:23 -05:00
Tyler Goodlet 43666a1a8e Increase current bar's pen size by a px 2021-11-12 16:03:23 -05:00
Tyler Goodlet 5bf8e6a90e Use filled rect for current step
A `QRectF` is easier to make and draw (i think?) so use that and fill it
on volume events for decent sleek real-time look. Adjust the step array
generator to allow for an endpoints flag. Comment and/or clean out all
the old path filling calls that gave us perf issues..
2021-11-12 16:03:23 -05:00
Tyler Goodlet 0876d2f4fe Bleh, try a bunch of stuff for step filling
Turns out the performance of updating and refilling step curves > 1k ish
points is super slow :sadkek:. Disabling the fill basically returns
normal performance, so it seems maybe we'll stick with unfilled volume
"bars" for now. The other tricky bit is getting the path to extend and
fill which is particularly slow if you use the `QPainterPath.united()`
(what `+` set op does) operation which seems to require an entire redraw
of the curve each paint iteration. Removing the pixel buffer cache makes
things that much worse too..

One technique i tried was only setting a `._fill` flag when so many
datums are in view (< 1k as determined by the chart widget), and this
helps, but under high load (trade rates) you still see more lag then
without the fill which makes me say screw it and let's stick with
unfilled bars for now. Trying go to get performant filled curves will be
an exercise for an aspiring graphics eng :P
2021-11-12 16:03:23 -05:00
Tyler Goodlet c378a56b29 Add last step updates and path fill support 2021-11-12 16:03:23 -05:00
Tyler Goodlet e4e1b4d64a Invert 'c' (connection) array
In latest `pyqtgraph` it seems there's a discrepancy
since `function.arrayToQPath()` was reworked and now
we need to *not* connect the last point for each bar.
2021-11-12 16:03:23 -05:00
Tyler Goodlet 4cf51ffb1e Draft 'step' curve; couldn't get pg builtin to work 2021-11-12 16:03:23 -05:00
Tyler Goodlet 61f3ce43b3 Toss in references step mode impl 2021-11-12 16:03:23 -05:00
goodboy 3e302f8445
Merge pull request #237 from pikers/unit_select_fixes
Order pane fixes
2021-11-12 15:54:34 -05:00
goodboy 837c34e24b
Merge pull request #241 from pikers/fsp_hotfixes
Fsp hotfixes
2021-11-05 15:44:08 -04:00