subsys_refinery #29

Open
goodboy wants to merge 22 commits from subsys_refinery into gitea_feats

22 Commits (310_plus)

Author SHA1 Message Date
Tyler Goodlet 2836aa3e18 Mk jsronrpc's underlying ws timeout `float('inf')`
Since currently we're only using this IPC subsys for `deribit`, and
generally speaking we're primarly supporting options markets (which are
fairly "slow moving"), flip to a default of NOT resetting the `NoBsWs`
on timeout since doing so normally breaks the jsron-rpc IPC session.
Without a proper `fixture` passed to `open_autorecon_ws()` (which we
should eventually implement!!) relying on a timeout-to-reset more or
less will just cause breakage issues - a proper reconnect sequence must
be implemented before using that feature.

Deats,
- expose and proxy through the `msg_recv_timeout` from
  `open_jsonrpc_session()` into the underlying `open_autorecon_ws()`
  call.
2025-02-17 14:57:25 -05:00
Tyler Goodlet 17f54723e1 Refine history gap/termination signalling
Namely handling backends which do not provide a default "frame
size-duration" in their init-config by making the backfiller guess the
value based on the first frame received.

Deats,
- adjust `start_backfill()` to take a more explicit
  `def_frame_duration: Duration` expected to be unpacked from any
  backend hist init-config by the `tsdb_backfill()` caller which now
  also computes a value from the first received frame when the config
  section isn't provided.
- in `start_backfill()` we now always expect the `def_frame_duration`
  input and always decrement the query range by this value whenever
  a `NoData` is raised by the provider-backend paired with an explicit
  `log.warning()` about the handling.
- also relay any `DataUnavailable.args[0]` message from the provider
  in the handler.
- repair "gap reporting" which checks for expected frame duration vs.
  that received with much better humanized logging on the missing
  segment using `pendulum.Interval/Duration.in_words()` output.
2025-02-17 14:57:25 -05:00
Tyler Goodlet 004b0fbbdf Only use `frame_types` if delivered during enter
The `open_history_client()` provider endpoint can *optionally*
deliver a `frame_types: dict[int, pendulum.Duration]` subsection in its
`config: dict[str, dict]` (as was implemented with the `ib` backend).
This allows the `tsp` backfilling machinery to use this "recommended
frame duration" to subtract from the `last_start_dt` any time a `NoData`
gap is signalled by the `get_hist()` call allowing gaps to be ignored
safely without missing history by knowing the next earliest dt we can
query from using the `end_dt`. However, currently all crypto$ providers
haven't implemented this feat yet..

As such only try to use the `frame_types` feature if provided when
handling `NoData` conditions inside `tsp.start_backfill()` and otherwise
raise as normal.
2025-02-17 14:57:25 -05:00
Tyler Goodlet 7a912deb4a Enable `greenback` for `.pause_from_sync()` by default? 2025-02-17 14:56:26 -05:00
Tyler Goodlet f6625b5929 `.brokers.cli`: module type and todo for `--pdb` flag to NOT src from sub-cmd 2025-02-17 14:56:26 -05:00
Tyler Goodlet 992d5f5af8 Catch using `Sampler.bcast_errors` where possible
In all other possible IPC disconnect handling blocks. Also more
comprehensive typing throughout `uniform_rate_send()`.
2025-02-17 14:56:26 -05:00
Tyler Goodlet 04f5a79d36 Group bcast errors as `Sampler.bcast_errors`
A new class var `tuple[Exception]` such that the err set can be reffed
externally as needed for catching other similar pub-sub/IPC failures in
other (related) real-time sub-systems.

Also added some now-masked logging for debugging live-feed stream reading
issues that should ONLY be used for debugging since they'll greatly
degrade HFT perf. Used the new `log.mk_repr()` stuff (that one day we
should prolly pull from `modden` as a dep) for pretty console emissions.
2025-02-17 14:56:26 -05:00
Tyler Goodlet e4044e4547 Suppress `trio.EndOfChannel`s raised by remote peer
Since now `tractor` will raise this native `trio`-exc translated from
a `Stop` msg when the peer gracefully terminates a `tractor.MsgStream`.
Just `info()` log in such cases versus continuing to warn for the
others.
2025-02-17 14:56:26 -05:00
Tyler Goodlet d91697c917 `.tsp._anal`: add (unused) `detect_vlm_gaps()` 2025-02-17 14:56:26 -05:00
Tyler Goodlet 70f77d67cd `.storage.cli`: collect gap-markup-aids into `tf2aids: dict` prior to pause for introspection 2025-02-17 14:56:26 -05:00
Tyler Goodlet 18bf3484e0 Delegate to `tractor.msg.pretty_struct` since it was factored from here! 2025-02-17 14:56:26 -05:00
Tyler Goodlet 2ab7038d48 Teensie `piker.data` styling tweaks
- use more compact optional value style with `|`-union
- fix `.flows` typing-only import since we need `MktPair` to be
  immediately defined for use on a `msgspec.Struct` field.
- more "tree-like" warning msg in `.validate()` reporting.
2025-02-17 14:56:26 -05:00
Tyler Goodlet 046e7dcec5 Invert `getattr()` check for `get_mkt_pairs()` ep
Such that we `return` early when not defined by the provider backend to
reduce an indent level in `SymbologyCache.load()`.
2025-02-17 14:56:26 -05:00
Tyler Goodlet 320e8ddc57 Various `.clearing` todos/notes on potential issues with loglevel settings.. 2025-02-17 14:56:26 -05:00
Tyler Goodlet a4ffbb7927 Type loaded backend modules 2025-02-17 14:56:26 -05:00
Tyler Goodlet aa506d124a Bump various `.brokers.core` doc string content/style 2025-02-17 14:56:26 -05:00
Tyler Goodlet de05b4ae17 Ignore any non-`.parquet` files under `.config/piker/nativedb/` subdir 2025-02-17 14:56:26 -05:00
Tyler Goodlet c6d6ccd702 Doc-n-clean `.data._web_bs.open_jsonrpc_session()`
Add a doc-string reflecting recent refinements, drop all the old hook
params, rename `n: trio.Nursery` -> `tn` for "task nursery" fitting with
code base's naming style.
2025-02-17 14:56:26 -05:00
Tyler Goodlet b02a03a0a8 Allow ledger passes to ignore (symcache) unknown fqmes
For example in the paper-eng, if you have a backend that doesn't fully
support a symcache (yet) it's handy to be able to ignore processing
other paper-eng txns when all you care about at the moment is the
simulated symbol.

NOTE, that currently this will still result in a key-error when you load
more then one mkt with the paper engine (for which the backend does not
have the symcache implemented) since no fqme ad-hoc query was made for
the 2nd symbol (and i'm not sure we should support that kinda hackery
over just encouraging the sym-cache being added?). Def needs a little
more thought depending on how many backends are never going to be able
to (easily) support caching..
2025-02-17 14:56:26 -05:00
Tyler Goodlet dce73af6cc .clearing._ems: Don't require `first_quote['last']`
Instead just check for the field (which i'm not huge on the key-name for
anyway) and if not found get the "last price" from the real-time shm
buffer's latest 'close' sample.

Unrelatedly, use a `subs.copy()` in the `Router.client_broadcast()` loop
such that if a `client_stream` is popped on connection failure, we don't
RTE for the "size changed on iteration".
2025-02-17 14:56:26 -05:00
Tyler Goodlet b990a66e8c data._web_bs: try to raise jsonrpc errors in parent task 2025-02-17 14:56:26 -05:00
Tyler Goodlet f427956a68 Mask no-data pause, add perps to no-`/src`-in-fqme asset set
Was orig for debugging an issue with `kucoin` i think but definitely
shouldn't be left in XD

Also add `'perpetual_future'` to the `.start_backfill()` input literal
set since we don't expect the 'btc/usd.perp.binance' for now.
2025-02-17 14:56:26 -05:00