trading-bot
An Alpaca paper-trading bot built to answer one question — can a retail momentum system beat the market? — and the measurement work that showed the answer is no. Over 2020–2024 the best validated strategy returned +16.3% against SPY's +95.3%.

The constraint
The first backtests said +646%, then +53%, then +42.9%. Every one was a measurement bug rather than an edge, and a backtest that flatters you is more dangerous than one that fails, because it is the one you trade.
The approach
Fix the measurement first. The four defects behind those numbers — exits that could never fire, a strategy blind to its own positions, short sales that booked no liability, and sizing off idle cash — were fixed, then turned into mechanical checks in a separate tool, backtest-audit, which now audits every committed result.
- 1Make exits reachable
Found that the signal generator never emitted a sell and the engine never called the method holding exit logic, so every early run measured enter-and-hold.
- 2Book every liability
Fixed position detection and naked shorts, which together had invented tens of thousands of dollars of cash in the backtest.
- 3A/B the filter
Turned the Bollinger filter off to reach a statistically meaningful trade count, and found the unfiltered signal loses money.
- 4Make the lesson mechanical
Extracted the four defects into backtest-audit so they are checked on every result instead of remembered.
Outcomes
- An honest headline: +16.3% (Sharpe 0.16) for the best validated strategy against +95.3% (0.75) for SPY buy-and-hold, 2020–2024
- Strategy and benchmark compared at matched gross exposure, so the comparison is like-for-like
- Superseded runs still audit as NOT TRUSTWORTHY, reconstructing their defects from the trade log alone
- Unvalidated research moved off main to an archive branch rather than left looking finished
- Revisit pairs trading, the one archived research thread with a case for a second look.
- Push trade counts past the 50-trade significance bar before quoting any new result.
Built an Alpaca paper-trading bot in async Python with a backtest engine modelling slippage and spread, a risk manager (VaR, correlation, sizing) and a daily-loss circuit breaker.
Traced three inflated backtest results (+646%, +53%, +42.9%) to measurement bugs, published the honest result that the strategy does not beat buy-and-hold, and extracted the defects into an audit tool.
Related projects
- Read
Cocoon
A privacy-first Chrome extension that lowers sensory load online: it softens algorithmic feeds, reduces motion, and keeps a grounding exercise one click away. No accounts, no analytics, nothing leaves the device.
- Read
unlinkd
Get yourself removed from the internet — and keep the proof. A local-first, fully encrypted workspace for data-broker removal requests and the tamper-evident paper trail a GDPR or CCPA escalation actually needs.
- Read
FraudStream
A production-grade streaming pipeline that scores financial transactions for fraud in milliseconds rather than hours, built on Kafka, Spark Structured Streaming, and a Snowflake medallion warehouse.