Commit Graph

3486 Commits (service_subpkg_backup)

Author SHA1 Message Date
Tyler Goodlet 9b321bc7f1 2nd try: dispersion normalize y-ranges around median
In the dispersion swing calcs, use the series median from the in-view
data to determine swing proportions to apply on each "minor curve"
(series with lesser dispersion the one with the greatest). Track the
major `Viz` as before by max dispersion. Apply the dispersion swing
proportions to each minor curve-series in a third loop/pass of all
overlay groups: this ensures all overlays are dispersion normalized in
their ranges but, minor curves are currently (vertically) centered (vs.
the major) via their medians.

There is a ton of commented code from attempts to try and vertically
align minor curves to the major via the "first datum" in-view/available.
This still needs work and we may want to offer it as optional.

Also adds logic to allow skipping margin adjustments in `._set_yrange()`
if you pass `range_margin=None`.
2023-03-03 18:36:45 -05:00
Tyler Goodlet 81f384db13 First draft, group y-minmax transform algo
On overlaid ohlc vizs we compute the largest max/min spread and
apply that maxmimum "up and down swing" proportion to each `Viz`'s
viewbox in the group.

We obviously still need to clip to the shortest x-range so that
it doesn't look exactly the same as before XD
2023-03-03 18:36:45 -05:00
Tyler Goodlet b15136a351 Rename `.maybe_downsample_graphics()` -> `.interact_graphics_cycle()` 2023-03-03 18:36:45 -05:00
Tyler Goodlet 1770ceeacc Right, handle y-ranging multiple paths per plot
We were hacking this before using the whole `ChartView._maxmin()`
setting stuff since in some cases you might want similarly ranged paths
on the same view, but of course you need to max/min them together..

This adds that group sorting by using a table of `dict[PlotItem,
tuple[float, float]` and taking the abs highest/lowest value for each
plot in the viz interaction update loop.

Also removes the now commented signal registry calls and thus
`._yranger`, drops the `set_range: bool` from `._set_yrange` and adds
and extra `.maybe_downsample_graphics()` to the mouse wheel handler to
avoid a weird slow debounce where ds-ing is delayed until a further
interaction.
2023-03-03 18:36:45 -05:00
Tyler Goodlet 399186a10a Drop Qt interaction signal usage
It's kind of hard to understand with the C++ fan-out to multiple views
(imo a cluster-f#$*&) and seems honestly just plain faster to loop (in
python) through all the linked view handlers XD

Core adjustments:
- make the panning and wheel-scroll handlers just call
  `.maybe_downsample_graphics()` directly; drop all signal emissions.
- make `.maybe_downsample_graphics()` loop through all vizs per subchart
  and use the new pipeline-style call sequence of:
  - `Viz.update_graphics() -> <read_slc>: tuple`
  - `Viz.maxmin(i_read_range=<read_slc>) -> yrange: tuple`
  - `Viz.plot.vb._set_yrange(yrange=yrange)`
  which inlines all the necessary calls in the most efficient way whilst
  leveraging `.maxmin()` caching and ymxmn-from-m4-during-render to
  boot.
- drop registering `._set_yrange()` for handling `.sigRangeChangedManually`.
2023-03-03 18:36:45 -05:00
Tyler Goodlet 5ce4337d42 Add first-draft `PlotItemOverlay.group_maxmin()`
Computes the maxmin values for each underlying plot's in-view range as
well as the max up/down swing (in percentage terms) from the plot with
most dispersion and returns a all these values plus a `dict` of plots to
their ranges as part of output.
2023-03-03 18:36:45 -05:00
Tyler Goodlet 4c838474be `flake8` linter cleanup and comment out order ctl draft code 2023-03-03 18:32:24 -05:00
Tyler Goodlet 1bd421a0f3 Block hist queries for non-60s 2023-03-03 18:17:02 -05:00
Tyler Goodlet 2ea850eed0 `deribit`: add new `Trade.block_trade_id` field.. 2023-03-03 18:17:02 -05:00
Tyler Goodlet e6fd2adb69 Include `deribit` backend in default brokers scan set 2023-03-03 18:17:02 -05:00
Tyler Goodlet 3bfe541259 `deribit`: fix history query routine sig to take `timeframe: float` 2023-03-03 18:17:02 -05:00
Tyler Goodlet 18d70447cd `deribit`: various lib API compat fixes
- port to new `msgspec` "default fields must come after non-default
  ones" shite they changed.
- adjust to  `open_jsonrpc_session()` kwarg remap: `dtype` ->
  `response_type=JSONRPCResult`.
2023-03-03 18:17:02 -05:00
Tyler Goodlet c85324f142 `deribit`: drop removed (now deprecated and removed) `.backfill_bars()` endpoint 2023-03-03 18:17:02 -05:00
goodboy 6cd18576aa
Merge pull request #474 from pikers/xdo_and_you
`ib`: restore and (maybe) use `xdotool` + `i3ipc` reset method
2023-03-03 17:42:29 -05:00
Tyler Goodlet daa6a5c80a `ib`: restore and (maybe) use `xdotool` + `i3ipc` reset method
Since apparently the container we were using is totally borked on new
kernels and/or latest jvm, this move our old manual local-X-desktop script
back for use in `brokerd` backend code.

Adds a new `.brokers.ib._util` which contains the 2 methods and fails
over to this one when we can't connect to a VNC server. Also adjusts the
original in `scripts/ib_data_reset.py` to import and run the module code
as a script-program.
2023-03-03 17:37:26 -05:00
goodboy 201f86e482
Merge pull request #470 from pikers/decimalization_take_2
Fixed float dust bug on zero position
2023-03-03 17:34:36 -05:00
Guillermo Rodriguez d4ac8972ac
Merge pull request #477 from pikers/backward_compat_trans_with_symbolinfo
Backward compat support for `Transaction.sym: Symbol`
2023-03-02 23:19:55 -03:00
Tyler Goodlet b4a1cc8f22 `kraken`: parse and load info `Transaction.sym: Symbol`
Also includes a retyping of `Client._pair: dict[str, Pair]` to look up
pair structs and map all alt-key-name-sets to each for easy precision
info lookup to set the `.sym` field for each transaction including for
on-chain transfers which kraken provides as an "asset decimals" field,
presumably pulled from the particular block-token's limitation info.
2023-03-02 19:25:43 -05:00
Tyler Goodlet 69b85aa7e5 `ib`: parse and load info for new `Transaction.sym: Symbol` field 2023-03-02 19:23:47 -05:00
Tyler Goodlet 3a4794e9d1 Backward-compat: don't require `'lot_tick_size'`
In order to support existing `pps.toml` files in the wild which don't
have the `asset_type, price_tick_size, lot_tick_size` fields, we need to
only optionally read them and instead expect that backends will write
the fields going forward (coming in follow patches).

Further this makes some small asset-size (vlm accounting) quantization
related adjustments:
- rename `Symbol.decimal_quant()` -> `.quantize_size()` since that is
  explicitly what this method is doing.
- and expect an input `size: float` which we cast to decimal instead of
  doing it inside the `.calc_size()` caller code.
- drop `Symbol.iterfqsns()` which wasn't being used anywhere at all..

Additionally, this drafts out a new replacement market-trading-pair data
type to eventually replace `.data._source.Symbol` -> `MktPair` which we
aren't using yet, but serves as the documentation-driven motivator ;)
and, it relates to https://github.com/pikers/piker/issues/467.
2023-03-02 19:22:19 -05:00
Guillermo Rodriguez 6be96a96aa
Drop symbol section on Position serialization 2023-03-01 21:06:52 -03:00
Guillermo Rodriguez d704b153ca
Fix mayor bug found by fomo, sym info getting stored incorrectly on pps.toml causing it to load pp wrong on second open, also fix header leak bug 2023-03-01 21:06:52 -03:00
Guillermo Rodriguez 20d91f5e06
Good catch by j, unnecesary kwarg on open_pps 2023-03-01 21:06:52 -03:00
Guillermo Rodriguez 6c23c79f2a
Minor fixes after fomo's review 2023-03-01 21:06:52 -03:00
Guillermo Rodriguez f5b8b9a14f
Add sym registry to PaperBoi as well as a sym ref on Transaction
Add decimal quantize API to Symbol to simplify by-broker truncation
Add symbol info to `pps.toml`
Move _assert call to outside the _async_main context manager
Minor indentation and styling changes, also convert a few prints to log calls
Fix multi write / race condition on open_pps call
Switch open_pps to not write by default
Fix integer math kraken syminfo _tick_size initialization
2023-03-01 21:06:48 -03:00
Guillermo Rodriguez dc78994dcf
Fixed float dust bug on zero position case 2023-03-01 21:05:37 -03:00
goodboy 269a04ba1a
Merge pull request #475 from pikers/explicit_write_pps_on_exit
Explicitly write `pps.toml` on exit for `ib` and `kraken`
2023-03-01 17:47:57 -05:00
Tyler Goodlet 569df45d18 `kraken.`: drop trade history query limit 2023-03-01 17:40:36 -05:00
Tyler Goodlet f53f4df583 `ib/kraken`: adjust to new default of not-writing in `open_pps()` 2023-03-01 17:40:33 -05:00
jaredgoldman d04fe366ab
Merge pull request #462 from pikers/paper_trade_improvements_rebase
Paper trade improvements
2023-02-28 14:30:20 -05:00
jaredgoldman c83fe5aaa7 Fix typo in test docstring 2023-02-28 14:22:24 -05:00
jaredgoldman 41f81eb701 Make write on exit default false 2023-02-28 14:14:05 -05:00
jaredgoldman 05fdc9dd60 Add xfail 2023-02-28 13:55:12 -05:00
jaredgoldman 1323981cc4 Format lines in conftest
Add extra line in conftest
2023-02-28 13:52:12 -05:00
jaredgoldman 882032e3a3 Change skip to xfail 2023-02-28 13:52:03 -05:00
jaredgoldman a6257ae615 Add docstrings to test cases,
format function calls
2023-02-28 13:52:03 -05:00
jaredgoldman 973c068e96 Assert conditions like a nerd 2023-02-28 13:52:03 -05:00
jaredgoldman d7317c3710 Shorten assertion docstring 2023-02-28 13:52:03 -05:00
jaredgoldman 87eb9c5772 Format assertion conditions 2023-02-28 13:51:47 -05:00
jaredgoldman ecb22dda1a Remove whitespace, remove stale comments 2023-02-28 13:51:47 -05:00
jaredgoldman 6f15d47012 Add space in docstrings,
remove duplicate import
2023-02-28 13:51:47 -05:00
jaredgoldman 802af306ac Add specific location of _testing dir in delete_testing_dir fixture 2023-02-28 13:51:47 -05:00
jaredgoldman e4e368923d Add specific kwarg key to open_pps call when starting paperboi 2023-02-28 13:51:47 -05:00
jaredgoldman 342aec648b Skip zero test and change use Path when creating a config folder in marketstore 2023-02-28 13:51:47 -05:00
jaredgoldman 55253c8469 Remove whitespace and correct typo 2023-02-28 13:51:47 -05:00
jaredgoldman 4b72d3ba99 Add backpressure setting back as it wasn't altering test behaviour 2023-02-28 13:51:47 -05:00
jaredgoldman 61296bbdfc Minor formatting, removing whitespace 2023-02-28 13:51:47 -05:00
jaredgoldman 36f466fff8 Ensure tests are running and working up until asserting pps 2023-02-28 13:51:47 -05:00
Guillermo Rodriguez 26146097eb
Merge pull request #469 from pikers/emsd_loglevel_fix
Fix `loglevel` not getting propagated to `emsd`
2023-02-26 00:49:43 -03:00
jaredgoldman fcd8b8eb78 Remove breaking call to load pps from ledger 2023-02-25 18:59:40 -05:00