Commit Graph

1632 Commits (65a645bdde31be8df6406047bc8f2d3e89aeb64e)

Author SHA1 Message Date
Tyler Goodlet 65a645bdde Start trionics mod with an `async_enter_all` 2021-11-05 10:27:03 -04:00
Tyler Goodlet 936171a7d0 Activate/focus original window after feed reset 2021-11-05 10:27:03 -04:00
Tyler Goodlet 81666fd76e 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-11-05 10:27:03 -04:00
Tyler Goodlet 436a86ba2d 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-11-05 10:27:03 -04:00
Tyler Goodlet 9df27931ab TOSQUASH fix subplots.values() cuckup 2021-11-05 10:27:03 -04:00
Tyler Goodlet c440ecefa4 Add first draft of "dollar volume" fsp 2021-11-05 10:27:03 -04:00
Tyler Goodlet 622372a7d5 Autoscale the y-range for all linked charts 2021-11-05 10:27:03 -04:00
Tyler Goodlet e367ffa107 `graphics_name` is more explicit then `name` 2021-11-05 10:27:03 -04:00
Tyler Goodlet 590e08a4d4 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-11-05 10:27:03 -04:00
Tyler Goodlet f98733118b Update fsps and overlays inside main OHLC chart update loop 2021-11-05 10:27:03 -04:00
Tyler Goodlet 3095d602e4 Fix color passthrough, make overlays a `dict` 2021-11-05 10:27:03 -04:00
Tyler Goodlet d1a3c80d93 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-11-05 10:27:03 -04:00
Tyler Goodlet b4cdd36337 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-11-05 10:27:01 -04:00
Tyler Goodlet 280dfe36ca Clean up some imports, shift around some commented code 2021-11-05 10:25:43 -04:00
Tyler Goodlet 03ac7d075f Resize volume yaxis to in view range 2021-11-05 10:25:43 -04:00
Tyler Goodlet 9b7c8ed01b Update vlm sticky 2021-11-05 10:25:43 -04:00
Tyler Goodlet 0a4bc72341 Pass curve color through to y sticky label 2021-11-05 10:25:43 -04:00
Tyler Goodlet 4621d1af1a Re-order grays by "lightness" 2021-11-05 10:25:43 -04:00
Tyler Goodlet a042c7f2b3 Add back in rsi 2021-11-05 10:25:43 -04:00
Tyler Goodlet 1b437f80e0 Add dynamic subplot sizing logic, passthrouh step curve colors 2021-11-05 10:25:43 -04:00
Tyler Goodlet 92d6eedbb7 Add test logic for range based volume curve filling 2021-11-05 10:25:43 -04:00
Tyler Goodlet 33e5a6628d Drop rsi from display by default 2021-11-05 10:25:43 -04:00
Tyler Goodlet 6affead81e Add todo for new view padding testing 2021-11-05 10:25:43 -04:00
Tyler Goodlet fa9eebab35 Add volume plot as default
Toss in support for a "step mode" curve (unfinished atm) and use it to
plot from the `volume` field of the ohlcv shm array (if available).

changes to make it happen,
- dynamically generate the fsp sidepane form from an input config `dict`
  |_ dynamically generate the underlying `pydantic` model
  |_
- add a "volume checker" helper func that inspects the shm array
- toss in sidepane resize calls to avoid race where the ohlcv array
  is plotted too slowly compared to the volume and the chart somehow
  doesn't show..
- drop duplicate rsi2 cruft (previously used to test plots of the shm
  data)
2021-11-05 10:25:43 -04:00
Tyler Goodlet 4436ed2c18 Draft tina install section 2021-11-05 10:25:43 -04:00
Tyler Goodlet bf387bdc77 Only update curve lengths on non-negative index diffs 2021-11-05 10:25:36 -04:00
Tyler Goodlet c9359f265d Make `.paint()` method always the last 2021-11-05 10:25:36 -04:00
Tyler Goodlet 11c5264025 Always draw a last step line with px width=2 2021-11-05 10:25:36 -04:00
Tyler Goodlet 52e89ecd67 Increase current bar's pen size by a px 2021-11-05 10:25:36 -04:00
Tyler Goodlet 99ac72455f 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-05 10:25:36 -04:00
Tyler Goodlet 0a7863e4fa 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-05 10:25:36 -04:00
Tyler Goodlet 46c9943612 Add last step updates and path fill support 2021-11-05 10:25:36 -04:00
Tyler Goodlet e8e5f1525c 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-05 10:25:36 -04:00
Tyler Goodlet f4e1362792 Draft 'step' curve; couldn't get pg builtin to work 2021-11-05 10:25:36 -04:00
Tyler Goodlet 69c2dd866e Toss in references step mode impl 2021-11-05 10:25:36 -04:00
Tyler Goodlet 6825ad4804 Add some type annots around pp msg handling 2021-11-05 10:05:11 -04:00
Tyler Goodlet de0cc6d81a Expect accounts as tuple, don't start rt pnl on no live pp 2021-11-05 10:05:11 -04:00
Tyler Goodlet 46e85e2e4b Comment on default account load order 2021-11-05 10:05:11 -04:00
Tyler Goodlet 75fddb249c Avoid value error on puterizing unit name 2021-11-05 10:05:11 -04:00
Tyler Goodlet c737de7c74 Rage drop the limit size unit enum 2021-11-05 10:05:11 -04:00
Tyler Goodlet 8f70398d88 Fix exit-slot-edge-case when only one discrete unit remains 2021-11-05 10:05:11 -04:00
Tyler Goodlet d706f35668 Keep slots ratio of 1 on derivs at startup 2021-11-05 10:05:11 -04:00
Tyler Goodlet 1f1f0d3909 Force min pnl label width to avoid resizes on magnitude steps 2021-11-05 10:05:11 -04:00
Tyler Goodlet d7cfe4dcb3 Shorten edit name, passthrough kwargs to adder methods 2021-11-05 10:05:11 -04:00
Tyler Goodlet 7cbcfc5525 Update pp size label on settings changes
Resolves #232
2021-11-05 10:05:11 -04:00
Tyler Goodlet 2b97f98151 Don't open stream before starting the fsp context.. 2021-11-05 10:04:10 -04:00
Tyler Goodlet ea9b66d1c3 Hotfix: open a tractor context to fsps...
The prior PR for fixing fsp array misalignment also added
`tractor.Context` usage which wasn't reflected in the graphics update
loop (newer code added it but the prior PR was factored from path
dependent history) and thus was broken. Further in newer work we don't
have fsp actors actually stream value updates since the display loop can
already pull from the source feed and update graphics at a preferred
throttle rate.  Re-enabled the fsp stream sending here by default until
that newer only-throttle-pull-from-source code is landed in the display
loop.
2021-11-05 09:33:48 -04:00
goodboy 186d221dda
Merge pull request #236 from pikers/fsp_drunken_alignment
Fsp drunken alignment
2021-11-03 08:48:45 -04:00
Tyler Goodlet cbec7df225 Drop old bps from fsp engine 2021-11-01 13:28:57 -04:00
Tyler Goodlet c9136e0494 Fix rsi history off-by-one due to `np.diff()` 2021-11-01 13:28:57 -04:00