Skip to content

fix(cache): register insider-trading/search so per-symbol harvests cache - #17

Merged
codemug merged 1 commit into
mainfrom
fix/cache-insider-trades-search
Aug 19, 2026
Merged

fix(cache): register insider-trading/search so per-symbol harvests cache#17
codemug merged 1 commit into
mainfrom
fix/cache-insider-trades-search

Conversation

@codemug

@codemug codemug commented Aug 19, 2026

Copy link
Copy Markdown
Owner

The problem

CachedClient passes unregistered methods straight through to the live API — silently. insider_trades.latest_insider_trades is registered, but search_insider_trades was not, so any caller harvesting a universe symbol by symbol bypassed the cache entirely while appearing to use it.

Found while investigating why a project with caching enabled was still burning its FMP quota.

Measured impact

Against the live API, on a real nightly harvest of ~5,900 symbols:

endpoint per call calls/night nightly
insider-trading/search 60 KB × ~12 pages 5,940 symbols ~4.3 GB
grades-historical 20 KB 5,980 ~120 MB
analyst-estimates 5 KB 5,989 ~30 MB
profile 3 KB ~6,500 ~20 MB

The starter plan meters bytes on a rolling 20 GB window. This one unregistered endpoint was 96% of the traffic.

The change

Registers search_insider_trades as PAGE_WALK sharded on symbol, mirroring the global latest_insider_trades entry directly above it.

walk_date_field is filingDate, not transactionDate: Form 4 allows two business days to file, so the transaction date runs behind the feed's own ordering and would make the walk look out of sequence.

Tests

Adds test_insider_trades_search_registered, alongside the existing entry's test. Full tests/test_cachedclient/ suite passes (105 passed).

🤖 Generated with Claude Code

`latest_insider_trades` is a GLOBAL feed. A caller harvesting a universe symbol
by symbol reaches for `search_insider_trades` instead, and with no registry
entry every one of those calls bypassed the cache entirely -- silently, since
CachedClient passes unregistered methods straight through.

Measured on a real harvest: ~5,900 symbols x ~12 pages x 60KB is about 4.3GB a
night, against a plan that meters bytes on a rolling 20GB window. The cache was
enabled and appeared to be working; it simply had no entry for the endpoint
that accounted for 96% of the traffic.

Registered as PAGE_WALK sharded on `symbol`, mirroring the global entry above
it. `walk_date_field` is `filingDate` rather than `transactionDate`: Form 4
allows two business days to file, so the transaction date runs behind the feed
order and would make the walk look out of sequence.
@codemug
codemug force-pushed the fix/cache-insider-trades-search branch from b4a50a7 to 3e14337 Compare August 19, 2026 09:12
@codemug
codemug merged commit 047aa18 into main Aug 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant