Commit Graph

1019 Commits (b6d8c300d412a4d39fef989bfa9fbc8d7672faa7)

Author SHA1 Message Date
Tyler Goodlet c8537d59a8 Port charting to new shm primary indexing 2020-12-19 16:50:38 -05:00
Tyler Goodlet 9930430721 Close app on last window exit
Use a system triggered SIGINT on app close to tear down the streaming
stack and terminate the `trio`/`tractor` runtimes deterministically.
2020-12-19 16:50:29 -05:00
Tyler Goodlet 599b5276b4 Port data apis to not touch primary index 2020-12-19 16:50:20 -05:00
Tyler Goodlet fda9fcbc55 Add historical backfilling to ib backend 2020-12-19 16:50:08 -05:00
Tyler Goodlet 6d50ad75a7 Ensure right bar x index is an int 2020-12-19 16:49:57 -05:00
Tyler Goodlet 2568a2d2e9 First draft, make graphics work on shm primary index
This is a bit hacky (what with array indexing semantics being relative
to the primary index's "start" value but it works. We'll likely want
to somehow wrap this index finagling into an API soon.
2020-12-19 16:49:43 -05:00
Tyler Goodlet 02b7d6cd19 Add prepend support to shm system 2020-12-19 16:49:35 -05:00
Tyler Goodlet 9710685508 Left align yaxis label 2020-12-19 16:49:27 -05:00
Tyler Goodlet 1f8f2eb8b3 Font size tweaks for low dpi 2020-12-19 16:06:54 -05:00
Tyler Goodlet 247b5fa2ec Tidy up doc string 2020-12-19 16:06:28 -05:00
Tyler Goodlet 3e16840566 Attempt to add numba typing and use `QGraphicsPathItem`
Failed at using either.

Quirks in numba's typing require specifying readonly arrays by
composing types manually.

The graphics item path thing, while it does take less time to write on
bar appends, seems to be slower in general in calculating the
``.boundingRect()`` value. Likely we'll just add manual max/min tracking
on array updates like ``pg.PlotCurveItem`` to squeeze some final juices
on this.
2020-12-19 16:06:22 -05:00
Tyler Goodlet 949e9d6cd1 Drop commented pixmap cruft
See #124 as to why we'll probably never need this.
2020-12-19 16:06:07 -05:00
Tyler Goodlet f083f537b1 Get `QPainterPath` "append" working
Pertains further to #109.

Instead of redrawing the entire `QPainterPath` every time there's
a historical bars update just use `.addPath()` to slap in latest
history. It seems to work and is fast. This also seems like it will be
a great strategy for filling in earlier data, woot!
2020-12-19 16:05:59 -05:00
Tyler Goodlet 413c703e34 Draw bars using `QPainterPath` magic
This gives a massive speedup when viewing large bar sets (think a day's
worth of 5s bars) by using the `pg.functions.arrayToQPath()` "magic"
binary array writing that is also used in `PlotCurveItem`.  We're using
this same (lower level) function directly to draw bars as part of one
large path and it seems to be painting 15k (ish) bars with around 3ms
`.paint()` latency. The only thing still a bit slow is the path array
generation despite doing it with `numba`. Likely, either having multiple
paths or, only regenerating the missing backing array elements should
speed this up further to avoid slight delays when incrementing the bar
step.

This is of course a first draft and more cleanups are coming.
2020-12-19 16:05:53 -05:00
Tyler Goodlet 8aede3cbcb Add field diffing on failed push 2020-12-19 16:05:22 -05:00
Tyler Goodlet f9e4e9507d Tweak axis text offset and margins 2020-12-19 15:05:37 -05:00
Tyler Goodlet c625dc90f1 Use new global var stack from tractor 2020-12-19 15:05:29 -05:00
Tyler Goodlet 9572280553 Kill the tractor tree on window close.
This makes it so you don't have to ctrl-c kill apps.
Add in the experimental openGL support even though I'm pretty sure it's
not being used much for curve plotting (but could be wrong).
2020-12-19 15:05:21 -05:00
Tyler Goodlet bfcf5170dc Add commented ex. code for line price charts 2020-12-19 15:05:14 -05:00
Tyler Goodlet acf8aeb33e Allocate space for 2d worth of 5s bars 2020-12-19 15:05:03 -05:00
Tyler Goodlet daa429f7ca Put fsp plotting into a couple tasks, startup speedups.
Break the chart update code for fsps into a new task (add a nursery) in
new `spawn_fsps` (was `chart_from_fsps`) that async requests actor
spawning and initial historical data (all CPU bound work).  For multiple
fsp subcharts this allows processing initial output in parallel
(multi-core). We might want to wrap this in a "feed" like api
eventually. Basically the fsp startup sequence is now:
- start all requested fsp actors in an async loop and wait for
  historical data to arrive
- loop through them all again to start update tasks which do chart
  graphics rendering

Add separate x-axis objects for each new subchart (required by
pyqtgraph); still need to fix hiding unnecessary ones.
Add a `ChartPlotWidget._arrays: dict` for holding overlay data distinct
from ohlc. Drop the sizing yrange to label heights for now since it's
pretty much all gone to hell since adding L1 labels. Fix y-stickies to
look up correct overly arrays.
2020-12-19 15:04:51 -05:00
goodboy abf8b11a05
Merge pull request #118 from pikers/bar_select
Add initial selection box interaction
2020-12-19 14:35:35 -05:00
Tyler Goodlet 49699a16ff Skip base metrics on no basis 2020-12-17 10:50:05 -05:00
Tyler Goodlet af61611801 Add initial selection box interaction
Requires decent modification of the built-in ``ViewBox``.
We do away with the zoom functionality for now and instead just add
a label full of some simple stats on the bounded data.
2020-11-08 16:15:34 -05:00
Tyler Goodlet 7cabb4854a Add virtualenv lines to install 2020-11-06 16:20:56 -05:00
goodboy e2d4ed063b
Merge pull request #112 from pikers/chart_hacking
Chart hacking
2020-11-06 15:42:24 -05:00
Tyler Goodlet 1972740d0c Make salotz stop grumbling like an old man 2020-11-06 15:35:10 -05:00
Tyler Goodlet 0f458f8263 Add min tick setting to axis type 2020-11-06 15:24:01 -05:00
Tyler Goodlet bdcee2b210 Readme bump 2020-11-06 13:50:59 -05:00
Tyler Goodlet c1109ee3fb Add license headers to pertinent files 2020-11-06 12:23:14 -05:00
Tyler Goodlet be4a3df7ba Add L1 spread streaming to kraken 2020-11-06 11:35:40 -05:00
Tyler Goodlet 043bc985df Configure L1 queue size precisions from history 2020-11-06 11:35:10 -05:00
Tyler Goodlet e27fece4e6 Add L1 queue size precision controls 2020-11-06 11:34:32 -05:00
Tyler Goodlet 205bedce85 Spec dpi aware font size in inches 2020-11-05 20:32:35 -05:00
Tyler Goodlet 1e491fb1bb Use pyqtgraph default pen for level lines 2020-11-05 13:23:29 -05:00
Tyler Goodlet cc88300ac5 Fix L1 updates to be like TWS
I think this gets us to the same output as TWS both on booktrader and
the quote details pane. In theory there might be logic needed to
decreases an L1 queue size on trades but can't seem to get it without
getting -ves displayed occasionally - thus leaving it for now.

Also, fix the max-min streaming logic to actually do its job, lel.
2020-11-05 12:08:29 -05:00
Tyler Goodlet db075b81ac Specialize `LevelLabel` for orientation-around-axis gymnastics 2020-11-05 12:08:02 -05:00
Tyler Goodlet 9c3850874d Add all L1 tick types for ib 2020-11-05 08:18:55 -05:00
Tyler Goodlet f438139ad7 Update L1 labels in price loop 2020-11-03 22:03:49 -05:00
Tyler Goodlet 73e54a2259 Add L1 labels wrapper type
Start a simple API for L1 bid/ask labels.
Make `LevelLabel` draw a line above/below it's text (instead of the
rect fill we had before) since it looks much simpler/slicker.
Generalize the label text orientation through bounding rect
geometry positioning.
2020-11-03 19:48:27 -05:00
Tyler Goodlet 987c13c584 Classify L1 tick types 2020-11-03 16:22:04 -05:00
Tyler Goodlet a5d5208cfa Add sticky "orientation", allow overriding label draw instructions. 2020-11-03 16:21:21 -05:00
Tyler Goodlet e65f511648 Draw flat line on every new time step
Until we get a better datum "cursor" figured out just draw the flat bar
despite the extra overhead. The reason to do this in 2 separate calls is
detailed in the comment but basic gist is that there's a race between
writer and reader of the last shm index.

Oh, and toss in some draft symbol search label code.
2020-11-03 12:25:08 -05:00
Tyler Goodlet d92e02db86 Add back min window size i guess 2020-11-03 12:22:57 -05:00
Tyler Goodlet 22f1b56b36 Always update left (open) arm 2020-11-03 08:15:00 -05:00
Tyler Goodlet 1640906b09 Write shm volume (facepalm), update open=close on first volume 2020-11-03 08:14:37 -05:00
Tyler Goodlet b23e459027 Cleanup unneeded commented stuff 2020-11-02 15:43:19 -05:00
Tyler Goodlet 119196f2ff Scale level label correctly to small(er) fonts
Not sure what fixed it exactly, and I guess we didn't need any relative
DPI scaling factor after all. Using the 3px margin on the level label
seems to make it look nice for any font size (i think) as well.

Gonna need some cleanup after this one.
2020-11-02 15:27:48 -05:00
Tyler Goodlet 96f700a762 Add level line type with custom label 2020-11-02 13:33:19 -05:00
Tyler Goodlet 9e7aa3f9bf Add a dpi aware font wrapper type 2020-11-02 12:02:05 -05:00