Commit Graph

2920 Commits (18e4352faf870a3457f08b9b69804f4a0026e9e0)

Author SHA1 Message Date
Tyler Goodlet 2a59ccf1bb Incrementally yield to Qt loop to resize sidepanes
Since our startup is very concurrent there is often races where widgets
have not fully spawned before python (re-)sizing code has a chance to
run sizing logic and thus incorrect dimensions are read. Instead ensure
the Qt render loop gets to run in between such checks.

Also add a `open_sidepane()` mngr for creating a minimal form widget for
FSP subchart sidepanes which can be configured from an input `dict`.
2022-01-22 14:40:41 -05:00
Tyler Goodlet 6ec0fdcabf Add charting support for "step curves" via `style="step"` 2022-01-22 14:28:14 -05:00
goodboy b2ee78b71f
Merge pull request #239 from pikers/tinas_unite
Draft tina install section
2022-01-19 22:46:01 -05:00
Guillermo Rodriguez 9fc95deab7
Merge pull request #246 from pikers/msgpack_no_sets_allowed
Can't serialize a `set` on `msgpack` codec
2022-01-14 12:03:12 -03:00
Tyler Goodlet 50e8b3464f Can't serialize a `set` on `msgpack` codec 2022-01-14 09:16:34 -05:00
Tyler Goodlet 1ad2cd36c5 Draft tina install section 2021-12-09 16:26:18 -05:00
goodboy b8ed7da63c
Merge pull request #242 from pikers/simpler_quote_throttle_logic
Simplify throttle loop to a single `while` block
2021-12-09 16:21:35 -05:00
Tyler Goodlet bcc8d8a0d5 Simplify throttle loop to a single while block
This should in theory result in increased burstiness since we remove
the plain `trio.sleep()` and instead always wait on the receive channel
as much as possible until the `trio.move_on_after()` (+ time diffing
calcs) times out and signals the next throttled send cycle. This also is
slightly easier to grok code-wise instead of the `try, except` and
another tight while loop until a `trio.WouldBlock`. The only simpler
way i can think to do it is with 2 tasks: 1 to collect ticks and the
other to read and send at the throttle rate.

Comment out the log msg for now to avoid latency and add much more
detailed comments. Add an overrun log msg to the main sample loop.
2021-12-09 08:23:59 -05:00
goodboy c808965a6f
Merge pull request #240 from pikers/fast_step_curve
Fast step curve
2021-12-07 16:12:47 -05:00
Tyler Goodlet 18859e1b8c Add detailed comments, comment out fill mode 2021-12-07 16:10:33 -05:00
Tyler Goodlet 4f899edcef Use a `pyqtgraph` dev branch pin (again)
There's lotsa movement on the project these days with stuff getting
improved, borked, fixed, rinse repeat. Might as well use a pin on our
fork so we can more easily hack on it and pull in latest features
piece-wise for testing.
2021-12-07 15:11:00 -05:00
Tyler Goodlet a2659d1fde Only update curve lengths on non-negative index diffs 2021-11-12 16:03:23 -05:00
Tyler Goodlet 739399d5a9 Make `.paint()` method always the last 2021-11-12 16:03:23 -05:00
Tyler Goodlet 95bf522b48 Always draw a last step line with px width=2 2021-11-12 16:03:23 -05:00
Tyler Goodlet 43666a1a8e Increase current bar's pen size by a px 2021-11-12 16:03:23 -05:00
Tyler Goodlet 5bf8e6a90e 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-12 16:03:23 -05:00
Tyler Goodlet 0876d2f4fe 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-12 16:03:23 -05:00
Tyler Goodlet c378a56b29 Add last step updates and path fill support 2021-11-12 16:03:23 -05:00
Tyler Goodlet e4e1b4d64a 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-12 16:03:23 -05:00
Tyler Goodlet 4cf51ffb1e Draft 'step' curve; couldn't get pg builtin to work 2021-11-12 16:03:23 -05:00
Tyler Goodlet 61f3ce43b3 Toss in references step mode impl 2021-11-12 16:03:23 -05:00
goodboy 3e302f8445
Merge pull request #237 from pikers/unit_select_fixes
Order pane fixes
2021-11-12 15:54:34 -05:00
goodboy 837c34e24b
Merge pull request #241 from pikers/fsp_hotfixes
Fsp hotfixes
2021-11-05 15:44:08 -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
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