Commit Graph

493 Commits (7395b22e3dbb0631df950a83f4b6a937e6272ad0)

Author SHA1 Message Date
Tyler Goodlet 7395b22e3d Add historical bars retreival 2020-07-15 08:20:03 -04:00
Tyler Goodlet cf8a5d04ce Store lines graphics in struct array to simplify indexing 2020-07-09 08:37:30 -04:00
Tyler Goodlet 93fed5ec28 Drop kivy stuff from docs 2020-07-08 15:42:51 -04:00
Tyler Goodlet 5d0f4bf112 Deps bump 2020-07-08 15:42:32 -04:00
Tyler Goodlet 9dc3bdf273 Add WIP real-time 5s bar charting 2020-07-08 15:42:05 -04:00
Tyler Goodlet ee4b3a327c Always convert to posix time 2020-07-08 15:41:14 -04:00
Tyler Goodlet ac5e9de1b3 Make run_qtrio invoke tractor at top level 2020-07-08 15:40:35 -04:00
Tyler Goodlet 7bc49eac9f Move bar generation into func; support bar appends
There's really nothing coupling it to the graphics class (which frankly
also seems like it doesn't need to be a class.. Qt).

Add support to `.update_from_array()` for diffing with the input array
and creating additional bar-lines where necessary. Note, there are still
issues with the "correctness" here in terms of bucketing open/close
values in the time frame / bar range. Also, this jamming of each bar's 3
lines into a homogeneous array seems like it could be better done with
struct arrays and avoid all this "index + 3" stuff.
2020-07-08 15:06:39 -04:00
Tyler Goodlet 4aa526f400 Use structure array indexing syntax 2020-07-08 14:56:45 -04:00
Tyler Goodlet db76443389 Handle flat bar updates
Flat bars have a rendering issue we work around by hacking values in `QLineF`
but we have to revert those on any last bar that is being updated in
real-time. Comment out candle implementations for now; we can get back
to it if/when the tinas unite. Oh, and make bars have a little space
between them.
2020-07-07 10:44:55 -04:00
Tyler Goodlet 52e258fe83 Docs the ui pkg mod 2020-07-07 10:39:22 -04:00
Tyler Goodlet 27a20c8535 Add better contract search/lookup
Add a `Client.find_contract()` which internally takes
a <symbol>.<exchange> str as input and uses `IB.qualifyContractsAsync()`
internally to try and validate the most likely contract. Make the module
script call this using `asyncio.run()` for console testing.
2020-07-07 10:33:47 -04:00
Tyler Goodlet 4fbb41a978 Convert to stream, parse into dataclass 2020-07-05 11:43:58 -04:00
Tyler Goodlet a852292563 Start kraken backend 2020-07-04 18:59:02 -04:00
Tyler Goodlet 36303f0770 Fix a bunch of scrolling / panning logic
Don't allow zooming to less then a min number of data points. Allow
panning "outside" the data set (i.e. moving one of the sequence "ends"
to the middle of the view. Start adding logging.
2020-07-04 17:48:31 -04:00
Tyler Goodlet a4658ac990 Add ib 2020-07-03 19:09:57 -04:00
Tyler Goodlet 13caf821fe Use msgpack-numpy 2020-07-03 18:32:40 -04:00
Tyler Goodlet ccaedfae3f Handle high = low bars
For whatever reason if the `QLineF` high/low values are the same a weird
little rectangle is drawn (my guess is a `float` precision error of some
sort). Instead, if they're the same just use one of the values.
Also, store local vars to avoid so many lookups.
2020-07-03 18:08:03 -04:00
Tyler Goodlet 4ca4ced6e8 Make search work with ib backend 2020-07-02 16:02:58 -04:00
Tyler Goodlet f216d1f922 Add a mostly actor aware API to IB backend
Infected `asyncio` support is being added to `tractor` in
goodboy/tractor#121 so delegate to all that new machinery.

Start building out an "actor-aware" api which takes care of all the
`trio`-`asyncio` interaction for data streaming and request handling.
Add a little (shudder) method proxy system which can be used to invoke
client methods from another actor. Start on a streaming api in
preparation for real-time charting.
2020-07-02 12:54:34 -04:00
Tyler Goodlet 72a3149dc7 Allow passing in tbk keys to query 2020-06-24 14:23:37 -04:00
Tyler Goodlet 56132d1fcc Use new method name 2020-06-24 14:13:56 -04:00
Tyler Goodlet dc9dbf4385 Add search command to cli 2020-06-24 14:13:36 -04:00
Tyler Goodlet 4d6f529d66 Add symbol search to broker api 2020-06-24 14:13:00 -04:00
Tyler Goodlet 1b31fcca57 Add stocks search to qt client 2020-06-24 14:12:38 -04:00
Tyler Goodlet f768e6d91e Add initial IB broker backend using ib_insync
Start working towards meeting the backend client api.
Infect `asyncio` using `trio`'s new guest mode and demonstrate
real-time ticker streaming to console.
2020-06-24 13:17:29 -04:00
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