Add tools/undervalued.py: trading strategy, goods priced below production cost

Finds manufactured goods currently selling below their implied
production cost (live input cost vs output price) - candidates to buy
and hold for a price-reversion bounce, the mirror of the "is this
worth building" question saturation.py already answers.

Backtested first (326 output tickers, 287 deduplicated dip-onset
episodes across 112 distinct tickers): +3mo forward return mean
+21.3%/median +8.9%/73.2% hit rate at >=10 units/day volume - real
signal, not noise, but only ~0.10-0.24%/day, far below the 14-29%/day
marginal ROI this session's production builds found. Documented
prominently in the tool's own docstring and CLAUDE.md so it doesn't
get mistaken for a primary strategy - it's for excess idle capital
once better-yielding builds are exhausted, not before.

Promoted daily_prices() out of tools/history.py into puga/history.py
so both tools share it, per the self-improve rule.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 10:28:34 +02:00
co-authored by Claude Sonnet 5
parent affc65cd67
commit c4178fe779
7 changed files with 133 additions and 9 deletions
+5
View File
@@ -49,6 +49,11 @@ EOF
-> SystemId), `shortest_path(src, dst, graph=None)` (Dijkstra by straight-line ly over FIO's
`/systemstars` jump graph; returns jumps, distance_ly, path). Not a PRUNplanner feature, built
for this project since travel isn't modelled anywhere else. CLI: `tools/route.py`.
- **`puga.undervalued`** — `manufacturing_candidates()`, `current_margin(ticker, recipe, cx)`,
`scan_current(cx, min_vol=5.0)`: manufactured goods priced below implied production cost, for
a buy-and-hold-for-reversion trade, not a build decision. Backtested expected return is
~0.10-0.24%/day - far below production's 14-29%/day, only worth excess idle capital. CLI:
`tools/undervalued.py`. Shares `puga.history.daily_prices` with `tools/history.py`.
- **`puga.planet`** — `candidates(resource_ticker, min_factor=0.0)`: every planet with that
resource, sorted by extraction factor, each with temperature/pressure/gravity/fertility/faction
and `build_requirements` (FIO's own founding-cost materials for that specific planet — real