Commit Graph

2134 Commits (06f311c1828c2c09fabbbcd10be4202e9b2162b0)

Author SHA1 Message Date
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
Tyler Goodlet ba8f443bf9 Add `Storage.load()` and `.write_ohlcv()` 2022-04-17 15:12:26 -04:00
Tyler Goodlet 72083eae17 A bit hacky but, broadcast index streams on each history prepend 2022-04-16 18:34:22 -04:00
Tyler Goodlet 25be7f8d08 Factor subscription broadcasting into a func 2022-04-16 18:33:26 -04:00
Tyler Goodlet 5c84a5f8b4 Always update ohlc (main source chart) on `trigger_all=True` 2022-04-16 18:32:36 -04:00
Tyler Goodlet 74cac9fc62 Make ib history client expect datetimes for input 2022-04-16 18:31:51 -04:00
Tyler Goodlet 2f052a7383 Add binance history client support with datetime use throughout 2022-04-16 17:48:02 -04:00
Tyler Goodlet 550d81ee2c Handle non-fqsn for derivs and don't put brokername in 2022-04-16 15:39:24 -04:00
Tyler Goodlet e430756944 Limit ohlc queries to 800k datums to avoid `purepc` size error 2022-04-16 15:39:24 -04:00
Tyler Goodlet 44b613024e Get sync-to-marketstore-tsdb history retrieval workinnn 2022-04-16 15:39:24 -04:00
Tyler Goodlet 36b8253b66 Handle "fatal" level log msgs in docker super 2022-04-16 15:39:24 -04:00
Tyler Goodlet a16cd2fe6d Add basic tsdb history loading
If `marketstore` is detected try to only load most recent missing data
from the data provider (broker) and the rest from the tsdb and push it
all to shm for display in the UI. If the provider/broker doesn't have
the history client endpoint, just use the old one for now so we can
start to incrementally add support. Don't start the ohlc step
incrementer task until the backend signals that the feed is live.
2022-04-16 15:39:24 -04:00
Tyler Goodlet 245085d493 Drop `ms-shell`, add `piker storesh` cmd 2022-04-16 15:39:24 -04:00
Tyler Goodlet 0b68bf257e Add diffing logic to `tsdb_history_update()`
Add some basic `numpy` epoch slice logic to generate append and prepend
arrays to write to the db.

Mooar cool things,
- add a `Storage.delete_ts()` method to wipe a column series from the db
  easily.
- don't attempt to read in any OHLC series by default on client load
- add some `pyqtgraph` profiling and drop manual latency measures
- if no db series for the fqsn exists write the entire shm array
2022-04-16 15:39:24 -04:00
Tyler Goodlet 68ac759b3f Drop `pandas` to `numpy` converter 2022-04-16 15:39:24 -04:00
Tyler Goodlet 2679d6261e Disable re-connect for now in ib script 2022-04-16 15:39:24 -04:00
Tyler Goodlet 48c989d400 Ensure bfqsn is lower cased for feed api consumers
Also, Start tinkering with `tractor.trionics.ipython_embed()`

In effort to get back to a usable REPL around the mkts client
this adds usage of the new `tractor` integration api as well as logic
for skipping backfilling if existing tsdb arrays are found.
2022-04-16 15:39:24 -04:00
Tyler Goodlet 831c23872c Try downsampling mkts data 2022-04-16 15:39:24 -04:00
Tyler Goodlet 008e153f36 Drop old type annot 2022-04-16 15:39:24 -04:00
Tyler Goodlet 38be93a009 Comment each special key combo 2022-04-16 15:39:24 -04:00
Tyler Goodlet 3bf3f450f4 Load any symbol-matching shm array if no `marketstored` found 2022-04-16 15:39:24 -04:00
Tyler Goodlet 4e1ab378f4 Get ib key hack script to work with reconnect 2022-04-16 15:39:24 -04:00
Tyler Goodlet 8d77d177bf Move ib data reset script into a new `scripts/` dir 2022-04-16 15:39:24 -04:00
Tyler Goodlet 36463dddbe Use new `tractor.query_actor()` for service checking 2022-04-16 15:39:24 -04:00
Tyler Goodlet e399b74b67 Return all timeframe arrays if `timeframe` not passed as input 2022-04-16 15:39:24 -04:00
Tyler Goodlet 15b609bf13 Make `pikerd` work again without `--tsdb` flag 2022-04-16 15:39:24 -04:00
Tyler Goodlet dfc3fb76fd Add a service checker predicate 2022-04-16 15:39:24 -04:00
Tyler Goodlet 881b1afc12 Allow kill-child-proc-with-root-perms to fail silently in `tractor` reaping 2022-04-16 15:39:24 -04:00
Tyler Goodlet 9878735ff3 Proxy `marketstore` container log level to our own 2022-04-16 15:39:24 -04:00
Tyler Goodlet 1389ee51f3 Prototype a high level `Storage` api
Starts a wrapper around the `marketstore` client to do basic ohlcv query
and retrieval and prototypes out write methods for ohlc and tick.
Try to connect to `marketstore` automatically (which will fail if not
started currently) but we will eventually first do a service query.

Further:

- get `pikerd` working with and without `--tsdb` flag.
- support spawning `brokerd` with no real-time quotes.
- bring back in "fqsn" support that was originally not
  in this history before commits factoring.
2022-04-16 15:39:24 -04:00
Tyler Goodlet 6225e8a58e Doc str formatting 2022-04-16 15:39:24 -04:00
Tyler Goodlet 2b48943066 Add latency measures around diffs/writes to mkts 2022-04-16 15:39:24 -04:00
Tyler Goodlet 92d074f308 Prototype out writing `1Sec` OHLCV data 2022-04-16 15:39:24 -04:00