Commit Graph

1618 Commits (549ff4ef119eacea0b01c448fff97e0cf633682a)

Author SHA1 Message Date
Tyler Goodlet 549ff4ef11 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-03 09:09:02 -04:00
Tyler Goodlet 6751840568 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-03 09:09:02 -04:00
Tyler Goodlet d0bad2e98e Make `.paint()` method always the last 2021-11-03 09:09:02 -04:00
Tyler Goodlet f269fe9732 Always draw a last step line with px width=2 2021-11-03 09:09:02 -04:00
Tyler Goodlet c37e6e2440 Clean up some imports, shift around some commented code 2021-11-03 09:09:02 -04:00
Tyler Goodlet 95baca219d Resize volume yaxis to in view range 2021-11-03 09:09:02 -04:00
Tyler Goodlet 6a82b1802b Update vlm sticky 2021-11-03 09:09:02 -04:00
Tyler Goodlet d751707e06 Pass curve color through to y sticky label 2021-11-03 09:09:02 -04:00
Tyler Goodlet 063b860cd4 Re-order grays by "lightness" 2021-11-03 09:09:02 -04:00
Tyler Goodlet 94793c276f Add back in rsi 2021-11-03 09:09:02 -04:00
Tyler Goodlet baaf6abec6 Increase current bar's pen size by a px 2021-11-03 09:09:02 -04:00
Tyler Goodlet a1b455349f Add dynamic subplot sizing logic, passthrouh step curve colors 2021-11-03 09:09:02 -04:00
Tyler Goodlet 940fc5d2f0 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-03 09:09:02 -04:00
Tyler Goodlet 6dd42bcfb3 Add test logic for range based volume curve filling 2021-11-03 09:09:02 -04:00
Tyler Goodlet 3670184c18 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-03 09:09:02 -04:00
Tyler Goodlet d6d284fec5 Add last step updates and path fill support 2021-11-03 09:09:02 -04:00
Tyler Goodlet c82046d59b Drop rsi from display by default 2021-11-03 09:09:02 -04:00
Tyler Goodlet 230fb00777 Add todo for new view padding testing 2021-11-03 09:09:02 -04:00
Tyler Goodlet 168c1eb2a9 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-03 09:09:02 -04:00
Tyler Goodlet 699e670363 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-03 09:09:02 -04:00
Tyler Goodlet 1e20b1d4dd Draft 'step' curve; couldn't get pg builtin to work 2021-11-03 09:09:02 -04:00
Tyler Goodlet df14ff052a Draft tina install section 2021-11-03 09:09:02 -04:00
Tyler Goodlet 8d34a2f13a Toss in references step mode impl 2021-11-03 09:09:02 -04:00
Tyler Goodlet 8d44706588 Add some type annots around pp msg handling 2021-11-03 08:58:44 -04:00
Tyler Goodlet cdf9f740f7 Expect accounts as tuple, don't start rt pnl on no live pp 2021-11-03 08:58:44 -04:00
Tyler Goodlet 96c8908e9c Comment on default account load order 2021-11-03 08:58:44 -04:00
Tyler Goodlet 3efe3b38b8 Avoid value error on puterizing unit name 2021-11-03 08:58:44 -04:00
Tyler Goodlet a6629520b1 Rage drop the limit size unit enum 2021-11-03 08:58:44 -04:00
Tyler Goodlet febb9310e8 Fix exit-slot-edge-case when only one discrete unit remains 2021-11-03 08:58:44 -04:00
Tyler Goodlet 8cfd046284 Keep slots ratio of 1 on derivs at startup 2021-11-03 08:58:44 -04:00
Tyler Goodlet 05a00c9dcc Force min pnl label width to avoid resizes on magnitude steps 2021-11-03 08:58:44 -04:00
Tyler Goodlet 12858e9113 Shorten edit name, passthrough kwargs to adder methods 2021-11-03 08:58:44 -04:00
Tyler Goodlet edcbc88a42 Update pp size label on settings changes
Resolves #232
2021-11-03 08:55:19 -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
Tyler Goodlet dd9f6e8a7c Move sync diffing helpers out of index loop 2021-11-01 13:28:57 -04:00
Tyler Goodlet 53dedbd645 Move "desynced" logic into a predicate 2021-11-01 13:28:57 -04:00
Tyler Goodlet 3dd82c8d31 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-11-01 13:28:57 -04:00
Tyler Goodlet 086aaf1d16 Sync history recalcs to diff checks via a "task tracker" 2021-11-01 13:28:57 -04:00
Tyler Goodlet f68671b614 Revert to old shm "last" meaning last row 2021-11-01 13:28:57 -04:00
Tyler Goodlet 1981b113b7 Drunkfix: finally solve the fsp alignment race? 2021-11-01 13:28:57 -04:00
Tyler Goodlet 6f83e358fe Add zero on increment support 2021-11-01 13:28:57 -04:00
Tyler Goodlet 5b1be8a8da Do fsp sync-to-source in sample step task 2021-11-01 13:28:57 -04:00
Tyler Goodlet 2b9fb952a9 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-01 13:28:57 -04:00
Tyler Goodlet 2cd594ed35 Add profiling to fsp engine
Litter 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-01 13:28:57 -04:00
Tyler Goodlet d4b00d74f8 Move top level fsp pkg code into an `_engine` module 2021-11-01 13:28:57 -04:00
Tyler Goodlet 33d1f56440 Port fsp daemon to tractor's context api 2021-11-01 13:28:57 -04:00
Tyler Goodlet 31f4dbef7d More explicit error on shm push overruns 2021-11-01 13:28:57 -04:00
Tyler Goodlet 92d7ffd332 WIP fsp output throttling - not working yet 2021-11-01 13:28:57 -04:00