Automated Trading Bot
Product: Rules-based paper-trading bot for the S&P 500 (SPY)
Duration: 1 Week
Role: Designer & Developer
Background
Many people want their savings to grow but do not have time to watch the market every day. Emotion also gets in the way: people buy when prices are high and sell in a panic when prices drop.
Problem
Can a small set of clear, tested rules make steady trading decisions without emotion, and stay safe while doing it? The bot also has to be easy to stop and easy to understand.
Approach
I designed the bot around safety first and returns second. It trades only on a paper (simulated) account, and the code cannot switch to real money.
How it works
Once a day, about 25 minutes before the market closes:
Buy SPY after a short dip, but only when the long-term trend is up (price above its 200-day average and 2-day RSI below 10).
Sell when the price recovers above its 5-day average, after 5 trading days, or at a 3% loss.
Idle cash sits in a T-bill fund (BIL) so it earns interest between trades.
Safety by design
No new buys after a 2% loss in a day or a 5% loss in a week.
A one-switch kill switch pauses the bot and cancels open orders.
API keys stay in GitHub secrets, never in the code.
Discord alerts for every trade, large move, loss limit and error. Quiet days send nothing, so alerts stay meaningful.
Testing
Backtested on 10 years of SPY history, with 0.05% per side charged to account for slippage.
A comparison tool runs the strategy side by side with alternatives (other indexes, a trend mode, and plain buy-and-hold) and checks that results hold in both halves of the period.
Automated tests run on fake data, so no keys are needed.
Takeaways
Good automation design means honest limits. I documented the known gaps: the stop-loss is checked once a day, scheduled runs can start late, and paper fills skip slippage. Being clear about what a system cannot do is part of earning a user's trust.