#!/usr/bin/env python3 """Manufactured goods currently selling below their implied production cost (output price minus live input cost) - candidates to buy and hold for a price-reversion bounce, not to build. EXPECTED ROI IS MUCH LOWER THAN THIS PROJECT'S PRODUCTION BUILDS. Backtest (2026-10-09, 326 output tickers, 287 independent dip-onset episodes across 112 distinct tickers, >=10 units/day volume): +3 months forward price return mean +21.3%, median +8.9%, 73.2% of episodes positive. That's ~0.10-0.24%/day, or very roughly ~41%/year if you could always immediately redeploy into a new dip (optimistic) - versus 14-29%/day marginal ROI on the production buildings this toolkit has been recommending. Gross price return only, no spread/freight/storage-fee/capital-lockup cost subtracted. Only deploy EXCESS capital here once better-yielding builds are exhausted - this is not a primary strategy. tools/undervalued.py # AI1, min 5 units/day traded tools/undervalued.py --cx AI1 --min-vol 10 --top 10 """ import argparse, sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) from puga import config, undervalued def main(): ap = argparse.ArgumentParser() ap.add_argument("--cx", default=config.DEFAULT_CX) ap.add_argument("--min-vol", type=float, default=5.0, help="min units/day traded (noise filter, thin markets won't revert reliably)") ap.add_argument("--top", type=int, default=20) a = ap.parse_args() rows = undervalued.scan_current(a.cx, a.min_vol) if not rows: print(f"nothing currently priced below production cost at {a.cx} with volume >= {a.min_vol}/day") return print(f"# {a.cx} min-vol>={a.min_vol}/day (gross price return only - see docstring for backtest caveats)") print(f"{'ticker':6} {'margin%':>8} {'price':>10} {'vol/d':>7} bld") for r in rows[:a.top]: print(f"{r['ticker']:6} {r['margin_pct']:8.1f} {r['price']:10.1f} {r['volume']:7.1f} {r['building']}") if __name__ == "__main__": main()