June 2026
Stock Trading Bot
A self hosted Python trading bot that runs 24/7 against the live market on an Alpaca paper account, with several strategies, hard risk limits, a kill switch, and a read-only web dashboard.
Challenges
Building risk controls I actually trust, and figuring out how much to believe a strategy that did well last month. A backtest can look great and still lose money live, so most of the work is making the system honest with itself.
Skills used
- Python
- Financial APIs
- Backtesting
- Risk management logic
- Databases and migrations
Current status
Running on a paper account with real market data. No real money is at risk, and real money stays off until Phase 11. Several phases are built but still need proof on the server, and SEC filings is in progress.
Brief
A Python 3.12 trading system that runs several strategies on the US market through the Alpaca brokerage API. It runs 24/7 on a paper account on my own server, so it uses real live market data and places real orders in a simulator, but no real money is at risk. That was always the point. I wanted to find out whether the thing works before it could cost me anything. Moving to Robinhood comes later.
What it actually does
Several strategies at once. Short term ones, like an opening range breakout and a news strategy, run alongside slower ones built on SEC filings and long holds. They look for different things, so they tend to do well at different times. Each half of the account is capped at 50 percent, so the system is not betting everything on one idea being right.
No leverage. The bot always trades at 1x. That is a fixed rule in the risk gate, not a setting, and a strategy that wants to go over its half of the account needs my approval one buy at a time.
Competing bots that learn slowly. I run two or three paper bots, each with its own account and database, and they try different approaches. Each bot can tune its own entry thresholds and budget shares, but only inside bounds I set, one small step a week, and only after the change wins on replayed history and then in a shadow run. It is off by default, I can freeze or roll it back in one click, and no language model is involved anywhere in choosing or scoring.
Risk limits. Every order passes a risk gate that fails closed: if it cannot check, the order does not go out. There is a kill switch, and positions held a month or longer can use at most 10 percent of the money across all bots. That cap is hard-coded and no strategy or learner can change it. This is the layer I am most careful with, because it is the difference between a bad day and a disaster.
A dashboard. A web interface where I can see what each bot holds, what it did, and why, with candlestick charts and alerts pushed to my phone. The web side is read only and never holds broker keys, so the part that is exposed to the internet cannot place a trade.
Its own database. SQLite in write-ahead mode with hand-reviewed migrations, so the bot survives being killed at any moment without corrupting its record of orders and fills, and I can change the schema without losing history.
Why paper trading
Because a backtest is not proof. A strategy can look excellent against past data and still fall apart live, usually because the backtest was accidentally allowed to see something it would not have known at the time. Running on paper with live data catches that. It also catches the boring failures that matter just as much, like an order that never fills, a rate limit, or a scheduled job that quietly did not run.
What I learned
Being suspicious of good results. The moment a backtest looks amazing, my first assumption now is that I made a mistake somewhere.
Bugs that hide. A trade that silently never happened does not throw an error, it just makes the numbers slightly wrong. Several of my worst bugs were missing behavior, not crashes.
Scheduling is part of the system. A trading system is a set of things that must happen at specific times, like checking the market state before the open. If the schedule is wrong the strategy does not matter.
Writing software instead of scripts. Separate pieces for signals, strategy, risk, execution, and notification, so I can change one without breaking the rest.