Skip to content

token-trade-coverage: quota-respecting sub-sampling#1338

Merged
Flotapponnier merged 1 commit into
mainfrom
feat/ttc-quota-optimization
Jul 23, 2026
Merged

token-trade-coverage: quota-respecting sub-sampling#1338
Flotapponnier merged 1 commit into
mainfrom
feat/ttc-quota-optimization

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Optimize API consumption so the bench fits provider free tiers without dropping statistical relevance.

Changes:

  • SWEEP_SEC default 1800 → 3600 (1h base cadence)
  • Per-provider EveryN sub-sampling: Mobula/Codex every sweep, Bitquery every 6th sweep (fits ~1000pts/mo Free plan budget)
  • Configurable page/row caps prevent runaway pagination on heavy tokens
  • New Prom counter ocb_token_trade_api_calls_total{provider}increase()[30d] gives monthly consumption

Budget math at defaults:

Provider Cadence Calls/mo Free-tier fit
Mobula every 1h 7,200 own API (unlimited)
Bitquery every 6h ~960 ≤ 1000 pts/mo ✓
Codex every 1h 5,760 fits rate limits ✓

Bitquery samples per (chain, token) per day drop from 48 → 4, but 4 daily samples still average to a stable p50 over 24h. Bump BITQUERY_EVERY_N=1 if upgrading to Developer plan.

…ser, page caps, api_calls_total counter for observability)
@Flotapponnier
Flotapponnier merged commit e7ccf63 into main Jul 23, 2026
@Flotapponnier
Flotapponnier deleted the feat/ttc-quota-optimization branch July 23, 2026 18:14
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