Commit Graph

467 Commits (4e6d1b8bd11a1e9a3b85572ec5c09f0b576139ef)

Author SHA1 Message Date
Tyler Goodlet 4e6d1b8bd1 Rework charting internals for real-time plotting
`pg.PlotCurveItem.setData()` is normally used for real-time updates to
curves and takes in a whole new array of data to graphics.
It makes sense to stick with this interface especially if
the current datum graphic will originally be drawn from tick quotes and
later filled in when bars data is available (eg. IB has this option in
TWS charts for volume). Additionally, having a data feed api where the push
process/task can write to shared memory and the UI task(s) can read from
that space is ideal. It allows for indicator and algo calculations to be
run in parallel (via actors) with initial price draw instructions
such that plotting of downstream metrics can be "pipelined" into the
chart UI's render loop. This essentially makes the chart UI async
programmable from multiple remote processes (or at least that's the
goal).

Some details:
- Only store a single ref to the source array data on the
  `LinkedSplitCharts`.  There should only be one reference since the main
  relation is **that** x-time aligned sequence.
- Add `LinkedSplitCharts.update_from_quote()` which takes in a quote
  dict and updates the OHLC array from it's contents.
- Add `ChartPlotWidget.update_from_array()` method to trigger graphics
  updates per chart with consideration for overlay curves.
2020-06-19 08:01:10 -04:00
Tyler Goodlet b328457f3b Support updating bars graphics from array
This makes a OHLC graphics "sequence" update very similar (actually API
compatible) with `pg.PlotCurveItem.setData()`. The difference here is
that only latest OHLC datum is used to update the charts last bar.
2020-06-19 08:00:04 -04:00
Tyler Goodlet b14cb66d7c Drop disk caching of quotes 2020-06-17 22:59:24 -04:00
Tyler Goodlet bae7ea1ac1 Revert weird bad .time access 2020-06-17 22:58:54 -04:00
Tyler Goodlet 9a397c54ac Factor signalling api into new module 2020-06-17 22:56:27 -04:00
Tyler Goodlet 48f266e276 Rip out all usage of `quantdom.bases.Quotes` smh. 2020-06-17 20:45:47 -04:00
Tyler Goodlet feccadc331 Add a sane pandas.DataFrame to recarray converter 2020-06-17 19:22:37 -04:00
Tyler Goodlet cdb70d25f3 Move all Qt components into top level ui module 2020-06-17 19:20:54 -04:00
Tyler Goodlet ea93e96d88 Move all kivy ui components to subpackage 2020-06-17 14:51:29 -04:00
Tyler Goodlet 56f65bcd40 Cleanup yrange auto-update callback
This was a mess before with a weird loop using the parent split charts
to update all "indicators". Instead just have each plot do its own
yrange updates since the signals are being handled just fine per plot.
Handle both the OHLC and plane line chart cases with a hacky `try:,
except IndexError:` for now.

Oh, and move the main entry point for the chart app to the relevant
module. I added some WIP bar update code for the moment.
2020-06-17 11:45:43 -04:00
Tyler Goodlet 970a528264 Add zeroed ohlc array constructor 2020-06-17 11:44:54 -04:00
Tyler Goodlet 482c4ff87f Add update method for last bars graphic 2020-06-17 09:29:18 -04:00
Tyler Goodlet a92b53d2c1 Use a single array for all lines
Speed up the lines array creation using proper slice assignment.
This gives another 10% speedup to the historical price rendering.
Drop ``_tina_mode`` support for now since we're not testing it.
2020-06-16 14:24:24 -04:00
Tyler Goodlet 11a7530d09 Render plots from provided input sequence(s)
Previously graphics were loaded and rendered implicitly during the
import and creation of certain objects. Remove all this and instead
expect client code to pass in the OHLC sequence to plot. Speed up
the bars graphics rendering by simplifying to a single iteration of
the input array; gives about a 2x speedup.
2020-06-16 13:44:53 -04:00
Tyler Goodlet d102537ca8 Add symbol-info command 2020-06-16 11:55:37 -04:00
Tyler Goodlet d10f80865e Add ui package mod 2020-06-16 11:52:16 -04:00
Tyler Goodlet 16ecd1ffe3 Don't scroll right after max zoom 2020-06-16 11:52:16 -04:00
Tyler Goodlet ef214226a2 Factor components into more suitably named modules 2020-06-16 11:52:16 -04:00
Tyler Goodlet 44984272be Move drawing and resize behavior into chart widget 2020-06-16 11:52:16 -04:00
Tyler Goodlet ea234f4472 Start grouping interactions into a ``ViewBox``
Move chart resize code into our ``ViewBox`` subtype (a ``ChartView``)
in an effort to start organizing interaction behaviour closer to the
appropriate underlying objects. Add some docs for all this and do some
renaming.
2020-06-16 11:52:16 -04:00
Tyler Goodlet 68266f5a20 Lol I guess we probably need this 2020-06-16 11:52:16 -04:00
Tyler Goodlet 856c6f2fd8 Factor common chart configuration 2020-06-16 11:52:16 -04:00
Tyler Goodlet 6bac250db5 Add scrolling from right and cross-hair
Modify the default ``ViewBox`` scroll to zoom behaviour such that
whatever right-most point is visible is used as the "center" for
zooming. Add a "traditional" cross-hair cursor.
2020-06-16 11:52:16 -04:00
Tyler Goodlet 9d4a432757 Styling, start re-org, commenting
- Move out equity plotting to new module.
- Make axis margins and fonts look good on i3.
- Adjust axis labels colors to gray.
- Start commenting a lot of the code after figuring out what it all does
  when cross referencing with ``pyqtgraph``.
- Add option to move date axis to middle.
2020-06-16 11:52:16 -04:00
Tyler Goodlet 49949ae6d5 Who needs it ;P 2020-06-16 11:52:16 -04:00
Tyler Goodlet 0d06dbbefa Add piker chart command 2020-06-16 11:52:16 -04:00
Tyler Goodlet 489e8c226f Move UI spawning cmds to new module 2020-06-16 11:52:16 -04:00
Tyler Goodlet 42aa2bce5b Add charting components from `Quantdom`
Hand select necessary components to get real-time charting with
`pyqtgraph` from the `Quantdom` projects:
https://github.com/constverum/Quantdom

We've offered to collaborate with the author but have received no
response and the project has not been updated in over a year.
Given this, we are moving forward with taking the required components to
make further improvements upon especially since the `pyqtgraph` project
is now being actively maintained again.

If the author comes back we will be more then happy to contribute
modified components upstream:
https://github.com/constverum/Quantdom/issues/18

Relates to #80
2020-06-16 11:52:16 -04:00
Tyler Goodlet b7f306b715 Add initial Qt-trio integration
Use the new "guest mode" available on trio master branch.  Add
entrypoint for `pyqtgraph` based charting based on the `Quantdom`
project.
2020-06-16 11:52:16 -04:00
Tyler Goodlet 0fa515d0e3 Use qt5 and trio guest mode 2020-06-16 11:52:16 -04:00
Tyler Goodlet 98deb4759e Use darkstyle pkg 2020-06-16 11:52:16 -04:00
Tyler Goodlet aa711cdee8 Blind stab at a basic chart 2020-06-16 11:52:16 -04:00
Tyler Goodlet 784f75fff6 Add glue link in readme 2020-06-16 11:52:16 -04:00
Tyler Goodlet 0111bf1a60 Update quote cache on each loop 2020-06-16 11:52:16 -04:00
Tyler Goodlet 9173f22f3b Add tbk tick streaming with trio-websocket 2020-06-16 11:52:16 -04:00
Tyler Goodlet c47df8811b Fix assignment out of order 2020-06-16 11:52:16 -04:00
Tyler Goodlet b2ac571147 Make monitor handle non-full quote messages 2020-06-16 11:52:16 -04:00
Tyler Goodlet 3042d1eec6 Push only new key value pairs over quote streams
This is something I've been meaning to try for a while and will likely
make writing tick data to a db more straight forward (filling in NaN
values is more matter of fact) plus it should minimize bandwidth usage.
Note, it'll require stream consumers to be considerate of non-full
quotes arriving and thus using the first "full" quote message to fill
out dynamically formatted systems or displays.
2020-06-16 11:52:16 -04:00
Tyler Goodlet 2f2ff7cded Make stock quote formatter work with diff streams 2020-06-16 11:52:16 -04:00
Tyler Goodlet b47803457e Update version and deps 2020-06-16 11:52:14 -04:00
Tyler Goodlet 63b7c3687c Add support for TICK ingest to marketstore 2020-06-16 11:51:45 -04:00
goodboy 837f4d3823
Merge pull request #97 from pikers/relicense_as_agplv3
Relicense to AGPLv3
2020-06-16 10:20:15 -05:00
Tyler Goodlet b58820e297 Relicense to AGPLv3 2020-06-16 00:12:19 -04:00
Tyler Goodlet 2c93bb0302 Drop use of deprecated `trio.Event.clear()` 2020-06-02 10:33:57 -04:00
Tyler Goodlet eccd9e2ffb It's not markdown bub 2020-06-02 10:32:04 -04:00
goodboy 9eddfa7b3b
Merge pull request #92 from pikers/questrade_candles
Questrade candles
2020-06-01 13:44:54 -05:00
Tyler Goodlet 882f4a28d1 Add privacy note 2020-06-01 14:43:39 -04:00
Tyler Goodlet 64993666fa Pull 100 bars by default 2020-05-26 14:49:50 -04:00
Tyler Goodlet 5f200b8db1 Always delay bars 15m; rename to volume 2020-05-26 14:49:50 -04:00
Tyler Goodlet a7f7de32b4 Docstring tweaks 2020-05-26 14:49:50 -04:00