sam9s
Well-Known Member
- Joined
- Aug 25, 2009
- Messages
- 5,256
- Points
- 113
Hey everyone! Some of you might remember my earlier post about Raven — my AI-powered media server assistant that manages my entire self-hosted media stack via Telegram. That post got a great response, and a lot of you were interested in the OpenClaw framework I used.
Well, I've been busy. This time, I built something even crazier.
Raven Trader is an AI system that trades stocks on the NSE/BSE autonomously. No human intervention required.
It runs 24/5 on my VPS, connects to Angel One (my brokerage) via their SmartAPI, and makes its own buy/sell decisions based on multi-agent AI research. Every morning at 7 AM, it sends me a Telegram briefing with what it did, what it's holding, and how the portfolio is performing.
I don't approve trades. I don't pick stocks. I just read the report.
The important context: I have literally zero trading experience. Never traded a stock in my life before this project. This entire system was designed and architected using AI (Claude as my solution architect), and coded by AI (Claude Code as my developer). I acted as the project manager.
I watched a YouTube experiment where two guys (Nate Herk and Samin) each gave $10,000 to their AI trading bots and let them compete for 30 days. The S&P 500 dropped 8.5% during that period. Nate's bot lost only $19. Samin's lost about $375. Both outperformed the market.
The kicker? Nate's winning bot had the simplest prompt: "You are a wealth adviser. Spin up a team. Do your best." No complex strategy. Just AI autonomy with guardrails.
That's when I decided to build one for the Indian market.
Raven Trader is a Python application running as a systemd service on my Hostinger VPS (the same one running my media server Raven).
The Architecture:
The bot has 6 AI sub-agents, each analyzing the market from a different perspective:
Technical Analyst — Reads price action, moving averages, RSI, MACD, Bollinger Bands, volume patterns. Pure chart analysis.
Fundamental Analyst — Evaluates company health: PE ratios, debt levels, revenue growth, sector outlook. Uses GPT-4o for analysis.
Sentiment Analyst — Scrapes financial news via Google News RSS and runs sentiment analysis through an LLM. Gauges whether news is bullish or bearish.
Smart Money Tracker — Monitors FII/DII flows (Foreign and Domestic Institutional Investor activity), bulk/block deals on NSE, and SEBI insider trade disclosures. When the big money is buying, this agent notices.
Risk Officer — The gatekeeper. Validates every trade recommendation against strict rules: position size limits, cash reserve requirements, daily loss limits, sector concentration caps. If a trade violates any rule, it's rejected.
Chief Strategist — The orchestrator. Collects signals from all 5 agents, weighs them (Technical 25%, Fundamental 25%, Sentiment 20%, Smart Money 20%, Market Regime 10%), and makes the final call. Only trades with 70%+ aggregate confidence get executed.
The Execution Loop:
Every hour during market hours (9:30 AM to 2:30 PM IST):
Every 5 minutes: update all holding prices and check stop losses.
Risk Management (the most important part):
Brokerage:Angel One SmartAPI — free API access, zero brokerage on equity delivery trades. The bot's VPS static IP is registered with Angel One for API compliance (required since April 2026 per SEBI/NSE guidelines).
Database:PostgreSQL (via self-hosted Supabase on my VPS) with a dedicated raven_trader schema. Tracks every order, every signal, every portfolio snapshot. Complete audit trail.
Notifications:Telegram bot sends:
What it bought on Day 1:
The bot picked infrastructure/power stocks — which makes sense given the current market conditions and FII flows into that sector. I didn't tell it to do that. It figured it out on its own.
Here's what my Telegram looks like:
Well, I've been busy. This time, I built something even crazier.
I built a fully autonomous AI trading bot for the Indian stock market.
What is Raven Trader?
Raven Trader is an AI system that trades stocks on the NSE/BSE autonomously. No human intervention required.
It runs 24/5 on my VPS, connects to Angel One (my brokerage) via their SmartAPI, and makes its own buy/sell decisions based on multi-agent AI research. Every morning at 7 AM, it sends me a Telegram briefing with what it did, what it's holding, and how the portfolio is performing.
I don't approve trades. I don't pick stocks. I just read the report.
The important context: I have literally zero trading experience. Never traded a stock in my life before this project. This entire system was designed and architected using AI (Claude as my solution architect), and coded by AI (Claude Code as my developer). I acted as the project manager.
Why I Built It
I watched a YouTube experiment where two guys (Nate Herk and Samin) each gave $10,000 to their AI trading bots and let them compete for 30 days. The S&P 500 dropped 8.5% during that period. Nate's bot lost only $19. Samin's lost about $375. Both outperformed the market.
The kicker? Nate's winning bot had the simplest prompt: "You are a wealth adviser. Spin up a team. Do your best." No complex strategy. Just AI autonomy with guardrails.
That's when I decided to build one for the Indian market.
How It Works (Under the Hood)
Raven Trader is a Python application running as a systemd service on my Hostinger VPS (the same one running my media server Raven).
The Architecture:
The bot has 6 AI sub-agents, each analyzing the market from a different perspective:
The Execution Loop:
Every hour during market hours (9:30 AM to 2:30 PM IST):
- Screen Nifty 100 stocks through liquidity and quality filters
- Run all 6 agents on the top candidates
- Aggregate signals and calculate confidence scores
- Risk Officer validates approved trades
- Execute trades via Angel One SmartAPI
Every 5 minutes: update all holding prices and check stop losses.
Risk Management (the most important part):
- 7% hard stop loss per position (non-negotiable — if a stock drops 7%, sell it)
- Trailing stop activates at +10% gain, trails at 5% below peak
- 15% of portfolio always in cash reserve
- Max 7 open positions at any time
- Max 20% of portfolio in any single stock
- 3% daily loss limit (trading halts if breached)
- 5% weekly loss limit (enters "defensive mode" — no new trades for 48 hours)
Brokerage:Angel One SmartAPI — free API access, zero brokerage on equity delivery trades. The bot's VPS static IP is registered with Angel One for API compliance (required since April 2026 per SEBI/NSE guidelines).
Database:PostgreSQL (via self-hosted Supabase on my VPS) with a dedicated raven_trader schema. Tracks every order, every signal, every portfolio snapshot. Complete audit trail.
Notifications:Telegram bot sends:
- Trade execution alerts (real-time)
- "Position in the green" celebrations

- Daily briefing at 7:00 AM
- Weekly deep-dive report on Sundays at 7:00 PM
- Critical alerts (loss limits breached, auth failures)
Day 1 Results (Paper Trading)
I'm running in paper trading mode for 30 days — real market data, simulated money, zero risk. The bot started with ₹10,000.What it bought on Day 1:
- POWERGRID: 24 shares @ ₹312.83 avg → Already profitable (+0.6%)
- NTPC: 3 shares @ ₹389.44 → In the green (+0.5%)
- SBIN: 1 share @ ₹1,067.68 → Slight dip (-0.1%)
The bot picked infrastructure/power stocks — which makes sense given the current market conditions and FII flows into that sector. I didn't tell it to do that. It figured it out on its own.
Here's what my Telegram looks like:
