Commit Graph

1637 Commits (5ea2273cfb87993f94334f98f522a1074eb23196)

Author SHA1 Message Date
Tyler Goodlet 5ea2273cfb Factor out context cacher to `tractor.trionics` 2021-10-29 16:14:45 -04:00
Tyler Goodlet e4ddc794ad Error out clearing task on first quote being nan 2021-10-29 16:14:45 -04:00
Tyler Goodlet 6ed455d23d Drop throttled rate margin to 100us 2021-10-29 16:14:45 -04:00
Tyler Goodlet 1cb3fedb81 Turn on profiling for the moment 2021-10-29 16:14:45 -04:00
Tyler Goodlet a461139a85 De-densify some funcs 2021-10-29 16:14:45 -04:00
Tyler Goodlet dfc407eb39 Add some typing around web bs 2021-10-29 16:14:45 -04:00
Tyler Goodlet 67a5ff54cb Rename feed bus entrypoint 2021-10-29 16:14:45 -04:00
Tyler Goodlet 9354d0d8e2 Update some typing and add latency checks for binance 2021-10-29 16:14:45 -04:00
Tyler Goodlet 95f4b2aa02 Expect accounts as tuple, don't start rt pnl on no live pp 2021-10-29 16:14:45 -04:00
Tyler Goodlet 80e8112daa Please please please let this dpi scaling hack work 2021-10-29 16:14:45 -04:00
Tyler Goodlet 3a1a906808 Port imports to tractor's new subpkg 2021-10-29 16:14:45 -04:00
Tyler Goodlet 521b995530 Drop old bps from fsp engine 2021-10-29 16:14:45 -04:00
Tyler Goodlet df2dc4d1c5 Repeat the click 3 times 2021-10-29 16:14:45 -04:00
Tyler Goodlet 0470a58e6c Comment on default account load order 2021-10-29 16:14:00 -04:00
Tyler Goodlet 36f1486739 Avoid value error on puterizing unit name 2021-10-29 16:14:00 -04:00
Tyler Goodlet eb75f37b25 Rage drop the limit size unit enum 2021-10-29 16:14:00 -04:00
Tyler Goodlet 6dde26a43f Start testing out trionics helpers, put vlm before rsi 2021-10-29 16:14:00 -04:00
Tyler Goodlet dea0d43ccb Make openGL flag actually work.. 2021-10-29 16:14:00 -04:00
Tyler Goodlet ae5a009c3e Fix exit-slot-edge-case when only one discrete unit remains 2021-10-29 16:14:00 -04:00
Tyler Goodlet 66da98ac5b Fix rsi history off-by-one due to `np.diff()` 2021-10-29 16:14:00 -04:00
Tyler Goodlet 80fa76e8a9 Move sync diffing helpers out of index loop 2021-10-29 16:14:00 -04:00
Tyler Goodlet 9cd63ffc99 Move "desynced" logic into a predicate 2021-10-29 16:14:00 -04:00
Tyler Goodlet b3ed09249a Fix the drunk fix
This should finally be correct fsp src-to-dst array syncing now..
There's a few edge cases but mostly we need to be sure we sync both
back-filled history diffs and avoid current step lag/leads. Use
a polling routine and the more stringent task re-spawn system to get
this right.
2021-10-29 16:14:00 -04:00
Tyler Goodlet 3aeb6e03f1 Sync history recalcs to diff checks via a "task tracker" 2021-10-29 16:14:00 -04:00
wattygetlood a5fc318015 Only scale down for scale < 2 2021-10-29 16:14:00 -04:00
Tyler Goodlet f0f103b60a Revert to old shm "last" meaning last row 2021-10-29 16:14:00 -04:00
Tyler Goodlet efcad0045a Drunkfix: finally solve the fsp alignment race? 2021-10-29 16:14:00 -04:00
Tyler Goodlet 4dd3b8869a 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
2021-10-29 16:14:00 -04:00
Tyler Goodlet 4c806b3187 Start trionics mod with an `async_enter_all` 2021-10-29 16:14:00 -04:00
Tyler Goodlet 42bb8e332c Activate/focus original window after feed reset 2021-10-29 16:14:00 -04:00
Tyler Goodlet fc12e72906 Add zero on increment support 2021-10-29 16:14:00 -04:00
Tyler Goodlet 3ed0739bbe Do fsp sync-to-source in sample step task 2021-10-29 16:14:00 -04:00
Tyler Goodlet 2a723ac994 Expose dollar volume to fsp engine
It can now be declared inside an fsp config dict under the name
`dolla_vlm`. We still need to offer an engine control that zeros
the newest sample value instead of copying from the previous.

This also litters the engine code with `pyqtgraph` profiling to see if
we can improve startup times - likely it'll mean pre-allocating a small
fsp daemon cluster at startup.
2021-10-29 16:14:00 -04:00
Tyler Goodlet 614bb1717b Fix shm index update race
There was a lingering issue where the fsp daemon would sync its shm
array with the source data and we'd set the start/end indices to the
same value. Under some races a reader would then read an empty `.array`
which it wasn't expecting. This fixes that as well as tidies up the
`ShmArray.push()` logic and adds a temporary check in `.array` for zero
length if the array hasn't been written yet.

We can now start removing read array length checks in consumer code
and hopefully no more races will show up.
2021-10-29 16:14:00 -04:00
Tyler Goodlet cd4f0e3276 TOSQUASH fix subplots.values() cuckup 2021-10-29 16:14:00 -04:00
Tyler Goodlet 63e7d1c914 Add first draft of "dollar volume" fsp 2021-10-29 16:14:00 -04:00
Tyler Goodlet 670de076fb Autoscale the y-range for all linked charts 2021-10-29 16:14:00 -04:00
Tyler Goodlet 825820e281 `graphics_name` is more explicit then `name` 2021-10-29 16:14:00 -04:00
Tyler Goodlet 7c0a2a6100 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`.
2021-10-29 16:14:00 -04:00
Tyler Goodlet 29d41b36a3 Update fsps and overlays inside main OHLC chart update loop 2021-10-29 16:14:00 -04:00
Tyler Goodlet a36bbdea7a Fix color passthrough, make overlays a `dict` 2021-10-29 16:14:00 -04:00
Tyler Goodlet c67d90eace 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.
2021-10-29 16:14:00 -04:00
Tyler Goodlet 6e226de692 Move top level fsp pkg code into an `_engine` module 2021-10-29 16:14:00 -04:00
Tyler Goodlet 6fffa071d2 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
2021-10-29 16:14:00 -04:00
Tyler Goodlet 429b6f6891 Port fsp daemon to tractor's context api 2021-10-29 16:14:00 -04:00
Tyler Goodlet 154e1f7087 Keep slots ratio of 1 on derivs at startup 2021-10-29 16:14:00 -04:00
Tyler Goodlet e00b98ac3b Force min pnl label width to avoid resizes on magnitude steps 2021-10-29 16:14:00 -04:00
Tyler Goodlet 3538cfd9a0 Shorten edit name, passthrough kwargs to adder methods 2021-10-29 16:14:00 -04:00
Tyler Goodlet be6bc86773 More explicit error on shm push overruns 2021-10-29 16:14:00 -04:00
Tyler Goodlet f973e39093 Update pp size label on settings changes
Resolves #232
2021-10-29 16:14:00 -04:00