Sitemap
Alvalen Shafel

Alvalen Shafel

Automating Rationality: Why I Built an AI Sentinel for My IDX Portfolio

4 min readApr 5, 2026

--

Between scaling startups and writing code, I don’t have the bandwidth to watch the news cycle 24/7. So, I engineered a system to do it for me.

If you are investing in the Indonesian Stock Exchange (IDX) while managing a demanding day job, you know the exact anxiety I am talking about. You buy solid fundamentals, you set your targets, but then geopolitics happen.

A few months ago, amidst rising tensions in the Middle East, I knew energy stocks would react. I bought MEDC and quickly saw a 10% floating profit. But while I was deep in a coding sprint, the news cycle shifted. The US announced de-escalation efforts. By the time I checked my portfolio after work, the market had fully reacted. That +10% had eroded into a -9% loss.

I didn’t lose because my thesis was wrong; I lost because of latency. Humans get tired, we get distracted, and we cannot refresh financial terminals every 15 minutes while deploying infrastructure.

I realized I didn’t need a better trading strategy. I needed an optimizer. I needed a sentinel.

Enter Quanta.

Press enter or click to view image in full size
Press enter or click to view image in full size

The Philosophy: Timing Advisor, Not Trigger

I am not a day trader. I am a long-term investor who believes in Dollar-Cost Averaging (DCA). The goal of Quanta was never to build an auto-trading bot that blindly fires API requests to a broker.

The goal was to build a Personal Quant Intelligence platform. It had to be self-hosted, fiercely private, and aware of exactly what I owned and how much “dry powder” (unallocated budget) I had sitting in cash.

Most importantly, it had to follow strict, hardcoded rationality.

The Architecture: Dual-LLM Orchestration

Quanta runs autonomously on my VPS, executing a multi-phase “Agent Cycle” several times a day (pre-market, midday, post-close). Instead of searching for static, hardcoded keywords, it operates dynamically using a dual-LLM architecture:

Press enter or click to view image in full size
  1. The Scout (Gemini 2.5 Flash): It ingests the last 12 hours of global and local RSS feeds alongside my current portfolio (BBRI, BMRI, ANTM, etc.). Its only job is fast, lightweight parsing: “What is happening right now, and what specific IDX tickers does this impact?”
  2. The Hard Data: AI is brilliant at sentiment, but it hallucinates math. Once the Scout identifies a sector in play, the Node.js backend pulls the exact, live financial metrics — PBV, PER, RSI, and 52-week ranges — using real-time endpoints.
  3. The Brain (Gemini 2.5 Pro): All of this context — the macro news, the exact stock valuation, my average buy price, and my unallocated budget — is fed into the analyzer for deep reasoning.

Hardcoded Guardrails: Protecting the AI from Itself

AI can be reactionary. If bad news hits, a vanilla LLM might panic and tell you to liquidate your entire portfolio. To prevent this, I built strict risk rules directly into Quanta’s DNA.

  • Never sell blue-chips at a loss: If BBRI drops heavily due to foreign outflow, the AI cannot suggest RISK_SELL. It must analyze the RSI and macro conditions and decide between DCA_WAIT (don't catch a falling knife) or OPPORTUNITY_BUY (sentiment is stabilizing, time to average down).
  • The Noise Filter: The agent scores its own confidence. If a catalyst doesn’t reach a 70% confidence threshold, the agent stays completely silent.

When a true catalyst aligns with a technical opportunity, Quanta bypasses the noise and pushes a color-coded Rich Embed directly to my private Discord server. It tells me the ticker, the action, the target, and the exact reasoning.

The Ultimate Feedback Loop

The most critical feature of Quanta isn’t what it predicts today, but how it grades itself tomorrow.

At midnight, a cron job silently reviews the agent’s recommendations from 7, 14, and 30 days ago. It checks the receipts. Did the OPPORTUNITY_BUY actually go up? Did the RISK_SELL actually drop?

It tracks its own accuracy on a performance dashboard, forcing the AI’s logic to be backed by empirical data. It is a system that learns from the market’s reality, not just its own generated text.

The Automation of reality

I built Quanta to eliminate the cognitive friction of investing. I no longer have to endlessly scroll through financial news, wondering if an article actually matters to my specific average price on ASII or DMAS.

Alvalen Shafelbilyunazra is the CTO and founder of Intervyou (https://intervyou.me) an AI-powered career preparation platform backed by the Google for Startups Cloud Program and NVIDIA Inception Program. You can find more of his work at https://www.alvalens.my.id

--

--