Documentation is in progress. Every page in this section describes the current implementation and may change as PolyLab evolves.
Appendix

Storage and Runtime Reference

In Progress Last updated 2026-03-10

Appendix-level detail on the current runtime jobs, SQLite tables, and how the public scanner is materially assembled.

Current Implementation

This page is intentionally explicit and implementation-first. If the product or upstream APIs change, the current behavior described here can change with them.

Runtime components

ComponentCurrent role
gamma_client.pyFetch paginated markets and events from Gamma
scraper.pyBuild the active outcome snapshot and tags
smart_money_scraper.pyFetch holders, wallet PnL, and smart-money counts context
auto_refresh.pyCoordinate hourly scrape and 6-hour smart-money runs
main.pyServe API routes and public static surfaces

Primary tables

TableCurrent purpose
active_market_outcomesActive outcome snapshot shown in the scanner
market_tagsTag lookup for include/exclude category filtering
holdersSampled holders keyed by condition id and outcome index
wallets_statsWallet PnL, alias, and wallet tags
market_smart_money_statsStored background smart_money_win_rate values and timestamps

Request logging

The metrics database also stores request_logs for API timing and diagnostics.

Indexing and read path

The backend ensures indices on commonly queried fields such as:

  • price
  • spread
  • volume_usd
  • liquidity_usd
  • apr
  • question
  • outcome_name

This is one reason the scanner can stay simple while still serving a large active snapshot.

Why this matters publicly

This appendix exists so users can understand where the app is doing straightforward storage and where it is applying interpretation layers. A transparent scanner is easier to trust, especially when it openly documents its own limits.