u/AdDull1803

I built an open-source AI system to track whether my PSX investment theses are still intact — free to use
▲ 38 r/developersPak+1 crossposts

I built an open-source AI system to track whether my PSX investment theses are still intact — free to use

Been a long-term PSX investor for a few years. My portfolio is concentrated: MEBL, SAZEW, FATIMA, SYS, LUCK, MARI, DCR.

The problem I kept running into: by the 6th quarterly result, I'd completely forgotten the specific reasons I bought each stock. I'd look at "profit up 8%" and have no framework to judge whether that was good, bad, or irrelevant. That's not investing — that's reacting to numbers without context.

So I built a system to fix it.

What it does

Every quarter when results drop, you feed it the PDF. It uses Gemini 1.5 Pro to extract financials and thesis-specific KPIs, then Claude Sonnet to reason against your pre-written investment thesis and produce a structured verdict:

  • Thesis Intact ✅ / Partial ⚠️ / No ❌
  • A red flag list where the data contradicts what you originally believed
  • A "Watch Next Quarter" metric to monitor

Nothing about price targets. Nothing about where the stock is going. Just: is the business still the business you bought?

The part most relevant to FIRE

It runs a daily Equity Risk Premium check:

Market ERP = KSE-100 Earnings Yield (100 / Forward PE) − KIBOR 6m
Dividend Gap = Portfolio Blended Yield − KIBOR 6m

GREEN → full equity allocation
YELLOW → hold, stop fresh deployment
RED → rotate gradually to deposits

When KIBOR hit 23% in 2024 and equities were yielding ~15% in earnings terms, the system was RED — the risk-free rate was genuinely eating your equity returns. For a FIRE portfolio where you're living off yield, this signal is the difference between staying fully invested at the wrong time and parking capital in a MEBL Islamic COI at 20%+.

It tells you when a bank deposit is mathematically better than equities — not based on feelings but on the spread.

What it tracks automatically

  • Daily prices + KIBOR + PKR/USD
  • Monthly PAMA vehicle sales (proxy for LMC performance in LUCK)
  • Monthly APCMA cement dispatches
  • OGRA gas price notifications (FATIMA's entire cost moat depends on this one)
  • SBP FX reserves, Brent crude, CPI — composite macro stress score
  • Dividend history from SCS Trade (for yield calculations)

It's fully open source

The theses are all in a CLAUDE.md file. Rewrite them for your own holdings entirely. Define your own sell triggers, your own KPIs. The system works for whatever you put in.

Runs in manual mode by default — you paste prompts into Gemini and Claude web, zero API cost. Flip a .env flag to auto when you're ready.

https://github.com/RoadtoFire/Investment-Thesis

If you find it useful, a ⭐ on the repo helps others find it.

Happy to answer questions about setup, the LLM workflow, or the ERP framework logic.

P.S. I am not a financial advisor nor an expert. I am sure people in this community will be much better at guiding me at making better theses or better yet, telling me where I can get better quality data. We can work together to make this open source project easier to understand and helpful for all. All helpful contributions are welcome ❤️

u/AdDull1803 — 1 day ago