1.5 KiB
Prompt
Become familiar with Piker’s clearing, accounting, order-control, and trade-ledger tracking subsystems in deep detail while fixing a paper-engine crash. The supplied traceback showed TransactionLedger.write_config() calling SymbologyCache.search(), followed by RapidFuzz raising TypeError: object of type 'MktPair' has no len() after a paper fill.
Response
Fixed the crash at the symbology-cache contract boundary. SymbologyCache.search() now fuzzy-matches the selected table’s string keys and resolves each matched key back to its struct value. RapidFuzz therefore never receives MktPair values as sequences, and native market-ID aliases remain intact in search results.
git diff HEAD~1..HEAD -- piker/data/_symcache.py
Added a regression that recreates the failing paper-ledger write with an unqualified Binance perpetual FQME. It also checks a native market-ID alias, preventing a weaker processor=str workaround that would lose the actual matched key.
git diff HEAD~1..HEAD -- tests/test_accounting.py
Verification:
./py313/bin/python -m pytest -p no:xonsh -q -x --tb=short --no-header tests/test_accounting.py::test_account_file_default_empty tests/test_accounting.py::test_paper_ledger_fuzzy_qualifies_mktmap_keys
Result: 2 passed in 0.02s.
git diff --check also passed. Ruff was not available in the existing py313 environment, so no environment provisioning was performed.