piker/piker
Tyler Goodlet 5f470d6122 Rework overlay pin technique: "align to first"
As part of solving a final bullet-issue in #455, which is specifically
a case:
- with N > 2 curves, one of which is the "major" dispersion curve" and
  the others are "minors",
- we can run into a scenario where some minor curve which gets pinned to
  the major (due to the original "pinning technique" -> "align to
  major") at some `P(t)` which is *not* the major's minimum / maximum
  due to the minor having a smaller/shorter support and thus,
- requires that in order to show then max/min on the minor curve we have
  to expand the range of the major curve as well but,
- that also means any previously scaled (to the major) minor curves need
  to be adjusted as well or they'll not be pinned to the major the same
  way!

I originally was trying to avoid doing the recursive iteration back
through all previously scaled minor curves and instead decided to try
implementing the "per side" curve dispersion detection (as was
originally attempted when first starting this work). The idea is to
decide which curve's up or down "swing in % returns" would determine the
global y-range *on that side*. Turns out I stumbled on the "align to
first" technique in the process: "for each overlay curve we align its
earliest sample (in time) to the same level of the earliest such sample
for whatever is deemed the major (directionally disperse) curve in
view".

I decided (with help) that this "pin to first" approach/style is equally
as useful and maybe often more so when wanting to view support-disjoint
time series:

- instead of compressing the y-range on "longer series which have lesser
  sigma" to make whatever "shorter but larger-sigma series" pin to it at
  an intersect time step, this instead will expand the price ranges
  based on the earliest time step in each series.
- the output global-returns-overlay-range for any N-set of series is equal to
  the same in the previous "pin to intersect time" technique.
- the only time this technique seems less useful is for overlaying
  market feeds which have the same destination asset but different
  source assets (eg. btceur and btcusd on the same chart since if one
  of the series is shorter it will always be aligned to the earliest
  datum on the longer instead of more naturally to the intersect sample
  level as was in the previous approach).

As such I'm going to keep this technique as discovered and will later
add back optional support for the "align to intersect" approach from
previous (which will again require detecting the highest dispersion
curve direction-agnostic) and pin all minors to the price level at which
they start on the major.

Further details of the implementation rework in
`.interact_graphics_cycle()` include:

- add `intersect_from_longer()` to detect and deliver a common datum
  from 2 series which are different in length: the first time-index
  sample in the longer.
- Rewrite the drafted `OverlayT` to only compute (inversed log-returns)
  transforms for a single direction and use 2 instances, one for each
  direction inside the `Viz`-overlay iteration loop.
- do all dispersion-per-side major curve detection in the first pass of
  all `Viz`s on a plot, instead updating the `OverlayT` instances for
  each side and compensating for any length mismatch and
  rescale-to-minor cases in each loop cycle.
2023-03-10 18:20:22 -05:00
..
brokers Don't crash on a `xdotool` timeout.. 2023-03-09 15:37:43 -05:00
clearing Start `piker.service` sub-package 2023-03-09 15:37:42 -05:00
cli Move all docker and external db code to `piker.service` 2023-03-09 15:37:42 -05:00
data Better handle dynamic registry sampler broadcasts 2023-03-10 18:20:22 -05:00
fsp Fix history array name 2023-02-12 13:55:26 -05:00
service Don't double send `enable_modules` and `debug_mode` in kwargs.. 2023-03-10 10:30:26 -05:00
testing Pass a config `tmp_dir: Path` to the runtime when testing 2023-03-09 15:37:43 -05:00
ui Rework overlay pin technique: "align to first" 2023-03-10 18:20:22 -05:00
watchlists Add license headers to pertinent files 2020-11-06 12:23:14 -05:00
__init__.py Start `piker.service` sub-package 2023-03-09 15:37:42 -05:00
_cacheables.py Port to new `tractor.trionics.maybe_open_context()` api 2022-01-23 21:01:38 -05:00
_profile.py Make profiler work when nested and not? 2023-02-13 12:27:58 -05:00
calc.py Lul, adhere to returning `str`s in `humanize()` 2022-01-25 07:57:01 -05:00
config.py Pull testing config dir from `tractor` runtime vars 2023-03-09 15:37:43 -05:00
log.py Doc string and types bump in loggin mod 2023-03-09 15:37:42 -05:00
pp.py Read `Symbol` tick precision fields when no entry in `.broker_info` 2023-03-08 17:22:34 -05:00
trionics.py Start trionics mod with an `async_enter_all` 2022-01-23 19:41:57 -05:00