no_symcache_no_problem: be more tolerant of not-yet-implemented provider backends #39

Merged
goodboy merged 5 commits from no_symcache_no_problem into main 2026-01-05 16:29:00 +00:00

A workaround for cases where broker/data backends don’t yet implement a sym-cache (intro-ed in GH commit 0050232) and break on fqme lookup while processing a trades ledger..

Instead, this patch attempts to allow bypassing this, BUT it’s pretty flaky (at best) and will definitely fail on multiple mkts loaded into a single chart..

See history of .data._symcache here to grok how-n-why it was added; more or less it avoids re-downloading the mkt-pair set from a provider every time the backend boots, reducing startup time.


Specific hack-around for the moment..

  • 15078a7: uses some guard logic and a new only_require: list[str]|True in Account.update_from_ledger() to allow the caller to avoid raising failed mkt: MktPair = symcache.mktmaps[fqme] lookups on symbols it doesn’t care about; this will obvi happen when the symcache isn’t populated due to lacking backend support.
    • use this param when called from the paper engine.

Other improvements/tweaks landing here

  • general code styling updates to latest prefs.
  • officially drop .accounting.Symbol, it was replaced long ago on GH by MktPair.
A workaround for cases where broker/data backends don't yet implement a sym-cache (intro-ed in GH commit 0050232) and break on fqme lookup while processing a trades ledger.. Instead, this patch *attempts* to allow bypassing this, BUT it's **pretty flaky** (at best) and will definitely fail on multiple mkts loaded into a single chart.. See history of `.data._symcache` [here](https://pikers.dev/pikers/piker/commits/branch/account_tests/piker/data/_symcache.py) to grok how-n-why it was added; more or less it avoids re-downloading the mkt-pair set from a provider every time the backend boots, reducing startup time. --- #### Specific hack-around for the moment.. - 15078a7: uses some guard logic and a new `only_require: list[str]|True` in `Account.update_from_ledger()` to allow the caller to avoid raising failed `mkt: MktPair = symcache.mktmaps[fqme]` lookups on symbols it doesn't care about; this will obvi happen when the `symcache` isn't populated due to lacking backend support. * use this param when called from the paper engine. --- #### Other improvements/tweaks landing here - general code styling updates to latest prefs. - officially drop `.accounting.Symbol`, it was replaced long ago on GH by `MktPair`.
goodboy added 3 commits 2025-02-20 16:48:07 +00:00
850cdbfe59 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..
a945bb33f3 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()`.
9e6bfa0926 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.
goodboy force-pushed no_symcache_no_problem from 9e6bfa0926 to c3f3b25524 2025-02-21 21:37:55 +00:00 Compare
goodboy force-pushed no_symcache_no_problem from c3f3b25524 to 81693cc2f7 2026-01-01 20:18:41 +00:00 Compare
goodboy force-pushed no_symcache_no_problem from 81693cc2f7 to 577da2e8e3 2026-01-02 17:12:08 +00:00 Compare
goodboy changed title from no_symcache_no_problem: be more tolerant of not-yet-implemented provider backends to no_symcache_no_problem: be more tolerant of not-yet-implemented provider backends 2026-01-02 17:13:00 +00:00
goodboy changed target branch from tsp_gaps to main 2026-01-02 17:13:00 +00:00
goodboy force-pushed no_symcache_no_problem from 577da2e8e3 to 07fbe859c3 2026-01-02 21:52:17 +00:00 Compare
goodboy merged commit 65a4fafb5d into main 2026-01-05 16:29:00 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: pikers/piker#39
There is no content yet.