Commit Graph

2843 Commits (61ca5f7e19c64706be62c333dd7c2f16b14a2395)

Author SHA1 Message Date
Tyler Goodlet 2f1e9ee760 Update dev deps to current state of things.. 2020-10-02 12:13:49 -04:00
Tyler Goodlet 07beec59bf Hopefully fix datum offset on signal sub-plots
Added a comment to clarify, ish.
Add `ChartPlotWidget._overlays` as registry of curves added on top of
main graphics. Hackishly (ad-hoc-ishly?) update the curve assuming the
data resides in the same `._array` for now (which it does for historical
vwap).
2020-10-02 12:13:28 -04:00
Tyler Goodlet 2cc2b32805 Fix dbz with `np.divide()` 2020-10-02 12:13:28 -04:00
Tyler Goodlet eb5d64ceef Add support for overlay curves and fixed y-range
Allow passing a fixed ylow, yhigh tuple to `._set_yrange()` which avoids
recomputing the range from data if desired (eg. rsi-like bounded
signals). Add support for overlay curves to the OHLC chart and add basic
support to brokers which provide a historical 'vwap`. The data array
increment logic had to be tweaked to copy the vwap from the last bar.

Oh, and hack the subchart curves with two extra prepended datums to make
them align "better" with the ohlc main chart; need to talk to
`pyqtgraph` core about how to do this more correctly.
2020-10-02 12:13:28 -04:00
Tyler Goodlet e91ba55d68 Always draw any history bars on update 2020-10-02 12:13:28 -04:00
Tyler Goodlet a4a5bff3fa Yes, even more grays 2020-10-02 12:13:28 -04:00
Tyler Goodlet da2325239c Copy non-base dtype fields on bar increment 2020-10-02 12:13:28 -04:00
Tyler Goodlet 80f191c57d Adjust range logic to avoid overlap with labels
By mapping any in view "contents labels" to the range of the
``ViewBox``'s data we can avoid having graphics overlap with labels.
Take this approach instead of specifying a min y-range using the std
and activate the range compute on resize and mouser scrolling.
Also, add y-sticky update for signal plots.
2020-10-02 12:13:28 -04:00
Tyler Goodlet fc0a03d597 Handle OHLC *and* signal indexing 2020-10-02 12:13:28 -04:00
Tyler Goodlet 9a59f2408d Start fsp subpackage, separate momo stuff 2020-10-02 12:13:28 -04:00
Tyler Goodlet ee6e4d2207 Add colorama for numba tracebacks 2020-10-02 12:13:28 -04:00
Tyler Goodlet 7d24e8eeb0 First draft of real-time rsi using numba 2020-10-02 12:13:28 -04:00
Tyler Goodlet 9d8a867767 Bar graphics update speed improvements
Use two separate `QPicture` instances:
- one for the 3 lines for the last bar
- one for all the historical bars lines

On price changes update the last bar and only update historical bars
when the current bar's period expires (when a new bar is "added").
Add a flag `just_history` for this  `BarItems.draw_lines()`.
Also, switch the internal lines array/buffer to a 2D numpy array to avoid
the type-cast step and instead just flatten using `numpy.ravel()`.

Overall this should avoid the problem of draws getting slower over time
as new bars are added to the history since price updates only redraw
a single bar to the "last" `QPicture` instance. Ideally in the future we
can make the `history` `QPicture` a `QPixmap` but it looks like this
will require some internal work in `pyqtgraph` to support it.
2020-10-02 12:13:28 -04:00
Tyler Goodlet b1591e3ee1 Start mucking with faster bars updates
Use a ``rec2array`` struct array converter to generate lines sequence
faster. Start looking into using a `QPixmap` to avoid redrawing all
bars every update.
2020-10-02 12:13:28 -04:00
Tyler Goodlet aed310dd8b Kill pipenv 2020-10-02 12:13:28 -04:00
Tyler Goodlet 48c70e8ae4 better readme 2020-10-02 12:13:28 -04:00
Tyler Goodlet 0e513599eb Info log fsp output for now 2020-10-02 12:13:28 -04:00
Tyler Goodlet f1b72dfd6b Better bg color, tweak margins. 2020-10-02 12:13:28 -04:00
Tyler Goodlet 17d205f773 Add proper x-axis time-stamping 2020-10-02 12:13:28 -04:00
Tyler Goodlet ea2a675adf Use dashed crosshair, simplify x-axis alloc 2020-10-02 12:13:28 -04:00
Tyler Goodlet 387a696232 Even more colors 2020-10-02 12:13:28 -04:00
Tyler Goodlet fca6257152 Use dashed lines for crosshair 2020-10-02 12:13:28 -04:00
Tyler Goodlet 7a245ddda4 Add and update y-sticky labels on new price data 2020-10-02 12:13:28 -04:00
Tyler Goodlet 363d4cf609 Start color map 2020-10-02 12:13:28 -04:00
Tyler Goodlet d7466a58b4 Add updateable y-sticky label 2020-10-02 12:13:28 -04:00
Tyler Goodlet 8d29338174 Cleanup latency tracker 2020-10-02 12:13:28 -04:00
Tyler Goodlet 58b2e7e395 Refer to main chart's data for date axis 2020-10-02 12:13:28 -04:00
Tyler Goodlet f46fa99a6e Add "contents" labels to charts
Add a default "contents label" (eg. OHLC values for bar charts) to each
chart and update on crosshair interaction.

Few technical changes to make this happen:
- adjust bar graphics to have the HL line be in the "middle" of the
  underlying arrays' "index range" in the containing view.
- add a label dict each chart's graphics name to a label + update routine
- use symbol names instead of this "main" identifier crap for referring to
  particular price curves/graphics
2020-10-02 12:13:28 -04:00
Tyler Goodlet 61e460a422 Start brokers.api module 2020-10-02 12:13:28 -04:00
Tyler Goodlet fd21f4b0fe WIP initial draft of FSP subsystem
This is a first attempt at a financial signal processing subsystem which
utilizes async generators for streaming frames of numpy array data
between actors. In this initial attempt the focus is on processing price
data and relaying it to the chart app for real-time display. So far this
seems to work (with decent latency) but much more work is likely needed
around improving the data model for even better latency and less data
duplication.

Surprisingly (or not?) a lot of simplifications to the charting code
came out of this in terms of conducting graphics updates in streaming
tasks instead of hiding them inside the obfuscated mess that is the
Qt-style-inheritance-OO-90s-trash. The goal from here on wards will be
to enforce strict semantics around reading and writing of data such that
state is kept outside "object trees" as much as possible and streaming
function semantics guide our flow model. Unsurprisingly, this reduction
in "instance state" is happening wherever we use `trio` ;)

A little summary on the technical changes:
- not going to explain the fsp system yet; it's too nascent and
  probably going to get some heavy editing.
- drop any "update" methods from the `LinkedCharts` type since each
  sub-chart will have it's own update task and thus a separate update
  loop; further individual graphics (per chart) may eventually require
  this same design.
- delete `ChartView`; moved into separate mod.
- add "stream from fsp" task to start our foray into real-time actor
  processed numpy streaming.
2020-10-02 12:13:28 -04:00
Tyler Goodlet edb32e8c2b Drop weird chart type enum 2020-10-02 12:13:28 -04:00
Tyler Goodlet 04e21a96da Use partial, pass kwargs to `tractor._main()` 2020-10-02 12:13:28 -04:00
Tyler Goodlet a29b7d9be5 Start "interaction" module 2020-10-02 12:13:28 -04:00
Tyler Goodlet 8a46f8d6ed Port monitor to normalized streams 2020-10-02 12:13:28 -04:00
Tyler Goodlet 241b2374e8 Port `DataFeed` api to broker specific normalizer routine 2020-10-02 12:13:28 -04:00
Tyler Goodlet 9bbf0e0d7a Add a normalizer routine which emits quote differentials/ticks 2020-10-02 12:13:28 -04:00
Tyler Goodlet 81fb327fe1 Add `services` cmd for monitoring actors 2020-10-02 12:13:28 -04:00
Tyler Goodlet 65fb92eaff Flatten out chart tasks 2020-10-02 12:13:28 -04:00
Tyler Goodlet 6b572eb0ef Add ravel() reference link 2020-10-02 12:13:28 -04:00
Tyler Goodlet 971b871647 Handle "mouse-not-on-plot" edge cases 2020-10-02 12:13:28 -04:00
Tyler Goodlet b2506b04f6 Attempt more reliable chart startup
Wait for a first actual real-time quote before starting graphics update
tasks. Use the new normalized tick format brokers are expected to emit
as a `quotes['ticks']` list. Auto detect time frame from historical
bars.
2020-10-02 12:13:28 -04:00
Tyler Goodlet d81f6620f5 Passthrough loglevel from qtractor 2020-10-02 12:13:28 -04:00
Tyler Goodlet 2eea946e5b Drop forkserver usage.
We've got the sweet and realable `trio` spawner now :)
2020-10-02 12:13:28 -04:00
Tyler Goodlet 1a143f6b16 Pass piker log level through to tractor for chart app 2020-10-02 12:13:28 -04:00
Tyler Goodlet 7a78c3a1c7 Add a couple more deps 2020-10-02 12:13:28 -04:00
Tyler Goodlet dc919fa676 Set tractor loglevel in cli config 2020-10-02 12:13:28 -04:00
Tyler Goodlet ec4f7476c5 Drop "pipfiles"; pipenv is getting the hard boot 2020-10-02 12:13:28 -04:00
Tyler Goodlet cb8215c203 Also log the payload 2020-10-02 12:13:28 -04:00
Tyler Goodlet 46c804db0b Support the `stream_quotes()` api in questrade backend 2020-10-02 12:13:28 -04:00
Tyler Goodlet ad519c10a9 Always just look up the current plot on mouse handling 2020-10-02 12:13:28 -04:00