Redditor builds hybrid Python+LLM trading bot, shares full rules
Elfwood86 · reddit · 2026-09-30
A Redditor documented a hybrid "script + AI" stock trading bot built in Python (roughly 40 cells, thousands of lines, one full day of work):
- Universe: S&P 500 minus Real Estate, Utilities, Materials and Consumer Discretionary, leaving 370 stocks; data cached for 30 days, cutting runtime from 5 minutes to 1.
- Portfolio: Alpaca account holds max 5 stocks, max 10 distinct tickers per 4 months (for tax simplicity), same stock tradeable repeatedly.
- Buying: The AI picks stocks and estimates intrinsic value via Graham formula + Buffett-style DCF divided by 2, only buying below value; the script executes tiered buys — $10 at -1%, up to $50 at -5%, no buy beyond -6%, $50/day per stock cap.
- Selling: At +1–4% the AI sells at its discretion; +5% through +9% map to selling $50–$90; the AI can also cut losses.
- Ops: Manually triggered in Google Colab, wired to Alpaca and OpenAI APIs; paper trading starts tomorrow. The script itself was generated with ChatGPT for $20.
More from coding & agent
- Agentic AI turns CPUs into the overlooked bottleneck as CPU:GPU ratios shift upward — AccBalanced · 2026-09-30
- Claude Opus 5.5 plays Final Fantasy X in new Reddit AI companion series — CH33SYP00FSS · 2026-09-30
- Claude spins up 90 agents just to rename a variable in viral coding-agent rant — tetsuoai · 2026-09-30
- AI agents leak 13,000+ internal screenshots from 343 tech companies to public GitHub repos — AccBalanced · 2026-09-30
- 45,000 lines of code: making a music video with Opus 5.5, Suno v6 and three.js — phira · 2026-09-30
- Ultracode update: tab toggle, works at any effort level by spinning up a Claude swarm — daniel_mac8 · 2026-09-30