Commit Graph

2166 Commits (536d1ff0d155f435acf3168968e828f037654f81)

Author SHA1 Message Date
Tyler Goodlet 536d1ff0d1 Relay frame size in `NoData` due to null-result history 2022-04-29 10:05:52 -04:00
Tyler Goodlet be7c047e2f Add , indicates hist size to decrement to storage logic 2022-04-29 08:12:29 -04:00
Tyler Goodlet d3e6ed3ba4 An absolute uppx diff of >= 1 seems more then fine 2022-04-27 17:19:08 -04:00
Tyler Goodlet 329e833e96 Up the display throttle rate to 22Hz 2022-04-27 17:18:11 -04:00
Tyler Goodlet 4e85d1d395 Truncate trade rate wma window sizes 2022-04-27 17:17:40 -04:00
Tyler Goodlet 19205d57a1 More tolerance for "stream-ended-early" conditions in quote throttler 2022-04-27 17:17:04 -04:00
Tyler Goodlet e4158dce01 Drop legacy back-filling logic
Use the new `open_history_client()` endpoint/API and expect backends to
provide a history "getter" routine that can be called to load historical
data into shm even when **not** using a tsdb. Add logic for filling in
data from the tsdb once the backend has provided data up to the last
recorded in the db. Add logic for avoiding overruns of the shm buffer
with more-then-necessary queries of tsdb data.
2022-04-27 17:13:15 -04:00
Tyler Goodlet 66c20b80a5 Add support for no `._first.value` update shm prepends 2022-04-27 14:51:20 -04:00
Tyler Goodlet c07aa76201 Double up shm buffer size 2022-04-26 09:29:09 -04:00
Tyler Goodlet d39e1e9a46 Drop legacy backfilling, load a day's worth of data by default 2022-04-26 09:28:51 -04:00
Tyler Goodlet 5294017891 Only do curve appends on low uppx levels 2022-04-26 09:28:09 -04:00
Tyler Goodlet 255f081e11 Startup up with 3k bars 2022-04-26 09:27:38 -04:00
Tyler Goodlet 549830784b Drop vwap fsp for now; causes hangs.. 2022-04-26 09:27:24 -04:00
Tyler Goodlet 4178791023 Drop step routine import 2022-04-26 09:27:04 -04:00
Tyler Goodlet 347ac0a22b Drop uppx guard around downsamples on interaction
Since downsampling with the more correct version of m4 (uppx driven
windows sizing) is super fast now we don't need to avoid downsampling
on low uppx values. Further all graphics objects now support in-view
slicing so make sure to use it on interaction updates. Pass in the view
profiler to update method calls for more detailed measuring.

Even moar,
- Add a manual call to `.maybe_downsample_graphics()` inside the mouse
  wheel event handler since it seems that sometimes trailing events get
  lost from the `.sigRangeChangedManually` signal which can result in
  "non-downsampled-enough" graphics on chart given the scroll amount;
  this manual call seems to entirely fix this?
- drop "max zoom" guard since internals now support (near) infinite
  scroll out to graphics becoming a single pixel column line XD
- add back in commented xrange signal connect code for easy testing to
  verify against range updates not happening without it
2022-04-26 08:52:34 -04:00
Tyler Goodlet b694ac2747 WIP get incremental step curve updates working
This took longer then i care to admit XD but it definitely adds a huge
speedup and with only a few outstanding correctness bugs:

- panning from left to right causes strange trailing artifacts in the
  flows fsp (vlm) sub-plot but only when some data is off-screen on the
  left but doesn't appear to be an issue if we keep the `._set_yrange()`
  handler hooked up to the `.sigXRangeChanged` signal (but we aren't
  going to because this makes panning way slower). i've got a feeling
  this is a bug todo with the device coordinate cache stuff and we may
  need to report to Qt core?
- factoring out the step curve logic from
  `FastAppendCurve.update_from_array()` (un)fortunately required some
  logic branch uncoupling but also meant we needed special input controls
  to avoid things like redraws and curve appends for special cases,
  this will hopefully all be better rectified in code when the core of
  this method is moved into a renderer type/implementation.
- the `tina_vwap` fsp curve now somehow causes hangs when doing erratic
  scrolling on downsampled graphics data. i have no idea why or how but
  disabling it makes the issue go away (ui will literally just freeze
  and gobble CPU on a `.paint()` call until you ctrl-c the hell out of
  it). my guess is that something in the logic for standard line curves
  and appends on large data sets is the issue?

Code related changes/hacks:
- drop use of `step_path_arrays_from_1d()`, it was always a bit hacky
  (being based on `pyqtgraph` internals) and was generally hard to
  understand since it returns 1d data instead of the more expected (N,2)
  array of "step levels"; instead this is now implemented (uglily) in
  the `Flow.update_graphics()` block for step curves (which will
  obviously get cleaned up and factored elsewhere).
- add a bunch of new flags to the update method on the fast append
  curve:  `draw_last: bool`, `slice_to_head: int`, `do_append: bool`,
  `should_redraw: bool` which are all controls to aid with previously
  mentioned issues specific to getting step curve updates working
  correctly.
- add a ton of commented tinkering related code (that we may end up
  using) to both the flow and append curve methods that was written as
  part of the effort to get this all working.
- implement all step curve updating inline in `Flow.update_graphics()`
  including prepend and append logic for pre-graphics incremental step
  data maintenance and in-view slicing as well as "last step" graphics
  updating.

Obviously clean up commits coming stat B)
2022-04-26 08:34:53 -04:00
Tyler Goodlet 41d9642a00 Drop cursor debounce delay, decrease rate limit 2022-04-24 17:09:58 -04:00
Tyler Goodlet 33a29a43ff Downsample on every uppx inrement since it's way faster 2022-04-24 17:09:30 -04:00
Tyler Goodlet 516dd26f08 Drop log scaling support since uppx driven scaling seems way faster/better 2022-04-24 17:08:16 -04:00
Tyler Goodlet 8959f04791 Hipshot, use uppx to drive theoretical px w 2022-04-24 14:49:58 -04:00
Tyler Goodlet 1a24038638 Fix null match 2022-04-24 13:14:54 -04:00
Tyler Goodlet 895d45f730 WIP incrementally update step array format 2022-04-24 13:14:54 -04:00
Tyler Goodlet 8fd5b95fb9 Add 16 fetch limit if no tsdb data found 2022-04-24 13:14:54 -04:00
Tyler Goodlet c3b43d7ae9 Don't require a symbol to subcmd 2022-04-24 13:14:54 -04:00
Tyler Goodlet 0b7961bb09 Don't open a feed, write or read ohlc in for now 2022-04-24 13:14:54 -04:00
Tyler Goodlet 2250566e72 Always maybe render graphics
Since we have in-view style rendering working for all curve types
(finally) we can avoid the guard for low uppx levels and without losing
interaction speed. Further don't delay the profiler so that the nested
method calls correctly report upward - which wasn't working likely due
to some kinda GC collection related issue.
2022-04-24 13:14:54 -04:00
Tyler Goodlet a6bd29c1d1 Always set coords cache on curves 2022-04-24 13:14:54 -04:00
Tyler Goodlet f68b8c5987 Handle null output case for vlm chart mxmn 2022-04-24 13:14:54 -04:00
Tyler Goodlet d4e26c1a26 Right, handle the case where the shm prepend history isn't full XD 2022-04-24 13:14:54 -04:00
Tyler Goodlet 42dc1f804e Always use coord cache, add naive view range diffing logic 2022-04-24 13:14:54 -04:00
Tyler Goodlet 0e7d274f2e Put mxmn profile mapping at end of method 2022-04-24 13:14:54 -04:00
Tyler Goodlet 9042244939 If a sample stream is already ded, just warn 2022-04-24 13:14:54 -04:00
Tyler Goodlet 06f311c182 `FastAppendCurve`: Only render in-view data if possible
More or less this improves update latency like mad. Only draw data in
view and avoid full path regen as much as possible within a given
(down)sampling setting. We now support append path updates with in-view
data and the *SPECIAL CAVEAT* is that we avoid redrawing the whole curve
**only when** we calc an `append_length <= 1` **even if the view range
changed**. XXX: this should change in the future probably such that the
caller graphics update code can pass a flag which says whether or not to
do a full redraw based on it knowing where it's an interaction based
view-range change or a flow update change which doesn't require a full
path re-render.
2022-04-24 13:14:54 -04:00
Tyler Goodlet be5ec76e73 Remove `._set_yrange()` handler from x-range-change signal 2022-04-24 13:14:54 -04:00
Tyler Goodlet 31f76e44e3 Delegate graphics cycle max/min to chart/flows 2022-04-24 13:14:54 -04:00
Tyler Goodlet 8073c6b47e Incrementally update flattend OHLC data
After much effort (and exhaustion) but failure to get a view into
our `numpy` OHLC struct-array, this instead allocates an in-thread-memory
array which is updated with flattened data every flow update cycle.

I need to report what I think is a bug to `numpy` core about the whole
view thing not working but, more or less this gets the same behaviour
and minimizes work to flatten the sampled data for line-graphics
drawing thus improving refresh latency when drawing large downsampled
curves.

TL;DR:
- add `ShmArray.ustruct()` to return a **copy of** (since a view doesn't
  work..) the (field filtered) shm array which is the same index-length
  as the source data.
- update the OHLC ds curve with view aware data sliced out from the
  pre-allocated and incrementally updated data (we had to add a last
  index var `._iflat` to track appends - this should be moved into
  a renderer eventually?).
2022-04-24 13:14:54 -04:00
Tyler Goodlet fe3009c5a8 Add `FastAppendCurve.draw_last()` 2022-04-24 13:14:54 -04:00
Tyler Goodlet 8d0c6cba58 Don't require data input to constructor 2022-04-24 13:14:54 -04:00
Tyler Goodlet 44c7ff253f More WIP, implement `BarItems` rendering in `Flow.update_graphics()` 2022-04-24 13:14:54 -04:00
Tyler Goodlet 789c77f9b2 Add `BarItems.draw_last()` and disable `.update_from_array()` 2022-04-24 13:14:54 -04:00
Tyler Goodlet 9a0716143c WIP starting architecture doc str writeup.. 2022-04-24 13:14:54 -04:00
Tyler Goodlet c95d160210 WIP incremental render apis 2022-04-24 13:14:54 -04:00
Tyler Goodlet 073dab20d7 Warn before return lul 2022-04-24 13:14:53 -04:00
Tyler Goodlet fe14ac5c79 Port view downsampling handler to new update apis 2022-04-24 13:14:53 -04:00
Tyler Goodlet 198de1efac Port ui components to use flows, drop all late assignments of shm 2022-04-24 13:14:53 -04:00
Tyler Goodlet 6a44c83e84 Add new `ui._flows` module
This begins the removal of data processing / analysis methods from the
chart widget and instead moving them to our new `Flow` API (in the new
module introduce here) and delegating the old chart methods to the
respective internal flow. Most importantly is no longer storing the
"last read" of an array from shm in an internal chart table (was
`._arrays`) and instead the `ShmArray` instance is passed as input and
stored in the `Flow` instance. This greatly simplifies lookup logic such
that the display loop now doesn't have to worry about reading shm, it
can be done by internal graphics logic as desired. Generally speaking,
all previous `._arrays`/`._graphics` lookups are now delegated to the
entries in the chart's `._flows` table.

The new `Flow` methods are generally better factored and provide more
detailed output regarding data-stream <-> graphics inter-relations for
the future purpose of allowing much more efficient update calls in the
display loop as well as supporting low latency interaction UX.

The concept here is that we're introducing an intermediary layer that
ties together graphics and real-time data flows such that widget code is
oriented around plot layout and the flow apis are oriented around
real-time low latency updates and providing an efficient high level
metric layer for the UX.

The summary api transition is something like:
- `update_graphics_from_array()` -> `.update_graphics_from_flow()`
- `.bars_range()` -> `Flow.datums_range()`
- `.bars_range()` -> `Flow.datums_range()`
2022-04-24 13:14:53 -04:00
Tyler Goodlet eb2b844c2d Always update last mx/mn (REVERT PRIOR CHANGE) 2022-04-24 13:14:53 -04:00
Tyler Goodlet 961f01448d Don't run legacy backfill when isn't up 2022-04-24 12:41:35 -04:00
Tyler Goodlet 72b93c0f24 Start legacy backfill with partial too 2022-04-18 08:47:25 -04:00
Tyler Goodlet 13c88a075d Unify backfilling logic into common task-routine 2022-04-17 15:13:07 -04:00