Commit Graph

2193 Commits (2f3418546f610e7049d1e5f86e656c879ec0a6d2)

Author SHA1 Message Date
Tyler Goodlet 82dbdd6148 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-30 13:28:43 -04:00
Tyler Goodlet 79eff13e76 Add back fqsn passthrough and feed opening 2022-04-30 13:28:24 -04:00
Tyler Goodlet 8e5f5b6be6 Implement `open_history_client()` correctly for `kraken` 2022-04-30 13:28:24 -04:00
Tyler Goodlet 8110c4c70d Add to signal broker won't deliver more data 2022-04-30 13:28:24 -04:00
Tyler Goodlet 6f64ff5842 Relay frame size in `NoData` due to null-result history 2022-04-30 13:28:24 -04:00
Tyler Goodlet bd23b6e8f2 Add , indicates hist size to decrement to storage logic 2022-04-30 13:28:24 -04:00
Tyler Goodlet 49f3e15a3c Truncate trade rate wma window sizes 2022-04-30 13:28:24 -04:00
Tyler Goodlet c985c01c62 More tolerance for "stream-ended-early" conditions in quote throttler 2022-04-30 13:28:24 -04:00
Tyler Goodlet 8e11d79712 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-30 13:28:24 -04:00
Tyler Goodlet 48cce42c77 Drop legacy backfilling, load a day's worth of data by default 2022-04-30 13:28:24 -04:00
Tyler Goodlet 1fd3513689 Add 16 fetch limit if no tsdb data found 2022-04-30 13:28:24 -04:00
Tyler Goodlet 9d375a0ce5 Don't require a symbol to subcmd 2022-04-30 13:28:24 -04:00
Tyler Goodlet c18795e454 Don't open a feed, write or read ohlc in for now 2022-04-30 13:28:24 -04:00
Tyler Goodlet 76287a7523 Don't run legacy backfill when isn't up 2022-04-30 13:28:24 -04:00
Tyler Goodlet b0f659a66b Start legacy backfill with partial too 2022-04-30 13:28:24 -04:00
Tyler Goodlet f7b3215aa4 Unify backfilling logic into common task-routine 2022-04-30 13:28:24 -04:00
Tyler Goodlet c5ed9b5955 Add `Storage.load()` and `.write_ohlcv()` 2022-04-30 13:28:23 -04:00
Tyler Goodlet ea9d76ffce A bit hacky but, broadcast index streams on each history prepend 2022-04-30 13:28:23 -04:00
Tyler Goodlet 16f2f6ff94 Factor subscription broadcasting into a func 2022-04-30 13:28:23 -04:00
Tyler Goodlet 4a383795bf Always update ohlc (main source chart) on `trigger_all=True` 2022-04-30 13:28:23 -04:00
Tyler Goodlet ef8e71f628 Make ib history client expect datetimes for input 2022-04-30 13:28:23 -04:00
Tyler Goodlet 21d0d551d3 Add binance history client support with datetime use throughout 2022-04-30 13:28:23 -04:00
Tyler Goodlet 32c3f63cfd Add `docker` as `tsdb` extras dep 2022-04-30 13:24:12 -04:00
Tyler Goodlet 894dcc2de4 Add `anyio-marketstore` client as dev dep 2022-04-30 13:22:30 -04:00
Tyler Goodlet 8b8ffe78af Handle non-fqsn for derivs and don't put brokername in 2022-04-30 11:38:24 -04:00
Tyler Goodlet 99a37f504f Limit ohlc queries to 800k datums to avoid `purepc` size error 2022-04-30 11:38:24 -04:00
Tyler Goodlet d3ddcc8206 Get sync-to-marketstore-tsdb history retrieval workinnn 2022-04-30 11:38:24 -04:00
Tyler Goodlet 9b1491efc9 Handle "fatal" level log msgs in docker super 2022-04-30 11:38:24 -04:00
Tyler Goodlet 7175901d0d 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-30 11:38:24 -04:00
Tyler Goodlet bb13f76375 Drop `ms-shell`, add `piker storesh` cmd 2022-04-30 11:38:24 -04:00
Tyler Goodlet a682887e63 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-30 11:38:24 -04:00
Tyler Goodlet 1837e467be Drop `pandas` to `numpy` converter 2022-04-30 11:38:24 -04:00
Tyler Goodlet 7df795435e Disable re-connect for now in ib script 2022-04-30 11:38:24 -04:00
Tyler Goodlet 8421422768 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-30 11:38:24 -04:00
Tyler Goodlet 23d386e0f5 Try downsampling mkts data 2022-04-30 11:38:24 -04:00
Tyler Goodlet f0c4261aa4 Drop old type annot 2022-04-30 11:38:24 -04:00
Tyler Goodlet 2be8f63487 Comment each special key combo 2022-04-30 11:38:24 -04:00
Tyler Goodlet 24a07fd5e5 Load any symbol-matching shm array if no `marketstored` found 2022-04-30 11:38:24 -04:00
Tyler Goodlet a893537ade Get ib key hack script to work with reconnect 2022-04-30 11:38:24 -04:00
Tyler Goodlet 15d15fdfbf Move ib data reset script into a new `scripts/` dir 2022-04-30 11:38:24 -04:00
Tyler Goodlet d1b05246f8 Use new `tractor.query_actor()` for service checking 2022-04-30 11:38:24 -04:00
Tyler Goodlet 96ec4ba28b Return all timeframe arrays if `timeframe` not passed as input 2022-04-30 11:38:24 -04:00
Tyler Goodlet fa0be47d66 Make `pikerd` work again without `--tsdb` flag 2022-04-30 11:38:24 -04:00
Tyler Goodlet 65609a35dc Add a service checker predicate 2022-04-30 11:38:24 -04:00
Tyler Goodlet d8d7757e88 Allow kill-child-proc-with-root-perms to fail silently in `tractor` reaping 2022-04-30 11:38:24 -04:00
Tyler Goodlet c439e99f8a Proxy `marketstore` container log level to our own 2022-04-30 11:38:24 -04:00
Tyler Goodlet 5c2b9a01e9 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-30 11:38:24 -04:00
Tyler Goodlet 15d3f99410 Doc str formatting 2022-04-30 11:38:24 -04:00
Tyler Goodlet ae8170204f Add latency measures around diffs/writes to mkts 2022-04-30 11:38:24 -04:00
Tyler Goodlet 7d628c4059 Prototype out writing `1Sec` OHLCV data 2022-04-30 11:38:24 -04:00