I built a working quant trading system
I'm a founder in Madison, Wisconsin. This fall I built Basis, a quantitative trading system that watches the stock market every minute of the trading day, decides on its own when to buy and when to short, trades S&P 500 and Nasdaq funds and options, protects itself with hard risk limits, and reports every trade on a live terminal anyone can watch. It trades in a paper account: the prices come from the live US market, while the orders and fills are simulated by Alpaca's paper-trading system, so no money and no orders ever reach the real market. Having a working quant system make its own decisions on live prices every day is something else. Here is exactly what it does and why I built it.
Why I built it
I day trade, and the hardest part has never been finding ideas. It's knowing whether an idea actually works or whether I just remember the days it did. Every trader has a story about the setup that "always works." Very few of them have written the setup down precisely enough to test it.
That's the part of trading I wanted to understand. Quantitative finance takes the guesswork out of the question "does this work?" You write the idea down so precisely that a computer can follow it, you test it on real price history, and then you let it trade live and see whether the results hold up. There's no room to remember the good days and forget the bad ones, because every trade is recorded.
I'm studying accounting, and accounting trains you to care about the real number: what actually came in, what actually went out, after every fee. Trading is full of numbers that look good and aren't real. Building a system that records every fill and every loss was a way to bring that accounting habit into trading.
And I learn best by building. I've built and run several websites, and every one of them taught me more than reading about it would have. So instead of reading another book on quant trading, I built one.
What "quant" means, in plain words
A quant, short for quantitative, makes trading decisions with math and data instead of gut feeling. In practice that means three things:
- Rules instead of opinions. "Buy when it looks strong" isn't a rule. "Buy when the 9-minute average crosses above the 21-minute average and price is above the day's average price" is.
- Testing before trusting. A rule gets replayed on past prices to see how it would have done, including the losers.
- Measuring everything. Win rate, average win against average loss, worst losing streak, and whether live results match the test.
Big firms do this with teams of PhDs and expensive data. I did it with free market data, a paper trading account and a system I built myself, which is exactly what made it interesting.
What Basis can do
Setup 1: trading with the trend
The first setup reads the market the way I would by eye, only faster and without second-guessing. It trades SPY, which tracks the S&P 500, and QQQ, which tracks the Nasdaq-100.
- Check the 1-minute chart. Is price above its 9-bar average, that average above the 21-bar average, the 21-bar still rising, and price above today's VWAP (the average price paid so far today)?
- Confirm on the 5-minute chart. Is the 9-bar average above the 21-bar average there too, and price above VWAP?
- Buy when both say up; short when both say down. It enters at the moment they first line up, not after the move is already stretched.
- Flip when the trend flips. If it's holding a short and both trends turn up, it closes the short right away and buys, and the reverse when they turn down, instead of waiting for the stop.
- Attach the exits immediately. The stop sits 1.5 times the recent 5-minute range away and the target 3 times, so one winner pays for two losers.
Why two timeframes? The 1-minute chart sees moves early but gets fooled by noise. The 5-minute chart is slower but harder to fool. Requiring both to agree filters out a lot of the fake moves.
This wasn't my first version. My first rule did the opposite: it bought dips and shorted bounces. When I tested it on 30 days of real prices it lost money, and then I watched the market rally all afternoon while it sat on the sidelines. Fighting the trend kept getting it stopped out. So I rebuilt it to trade with the trend instead. That rebuild is the most useful thing I learned on this project.
Setup 2: the opening-range breakout
The first 15 minutes of the trading day are when overnight news gets priced in, and they often set the tone for the morning. The second setup is built around that.
- Mark the range. The high and low of the first 15-minute candle, 9:30 to 9:45 am ET, become the opening range.
- Wait for a break. From 9:45 am until 2:30 pm it watches 5-minute candles. If one closes above the range, that's a breakout up; below the range, a breakout down.
- Trade the stock. It buys or shorts the fund with the stop at the middle of the range and a target twice as far away as the risk.
- Trade an option on the same signal. More on that next.
It takes one breakout per fund per day. If the trend setup already has a position open in the same fund, the breakout skips the stock trade so the agent never doubles up.
Options, including the S&P 500 index
An option gives you the right to buy (a call) or sell (a put) at a set price before a set date. Buying one is a leveraged bet with a built-in limit: you can't lose more than you paid for it [1]. That makes options a good fit for a breakout or a fresh trend, where a fast move can pay off quickly. Whenever Basis takes a trend or breakout signal during the day, it can also buy an option in the same direction.
- S&P 500: on an S&P 500 signal, Basis buys an SPX index option, a call when the signal is up and a put when it is down. SPX is the S&P 500 index itself. It can't be bought like a stock, but you can trade options on it, and it's one of the most traded option markets in the world. [2] SPX contracts are large, so if one contract costs more than $2,000 it buys XSP instead, a mini version of the same index at one tenth the size, and if neither is available it uses SPY options.
- Nasdaq-100: my broker, Alpaca, doesn't offer Nasdaq-100 index options (NDX), so on a Nasdaq signal it buys QQQ options, which track the same index.
- Picking the contract: it uses the nearest expiration, often the same day, and the at-the-money strike. My broker doesn't provide the S&P 500 index price directly, so Basis finds the at-the-money strike from the options themselves: it's the strike where the call and the put cost about the same.
- Limits: it spends up to about $1,000 per option trade (up to $2,000 for a single SPX contract), which is also the most that trade can lose. It buys at most 6 options a day, holds only one option per symbol at a time, and buys none after 2:30 pm. Every option has a stop and a target in two forms: on its own price (half and double what it paid) and on the index itself, using the same 2:1 levels as the stock trade, for example "stop SPX 7,421, target SPX 7,310". It sells at whichever comes first, or by 3:45 pm.
The risk rules
The part of trading that matters most is the part nobody posts about: how much you lose when you're wrong. Basis has hard limits written into the code:
- Every stock trade risks about $1,000 or less. Position size is calculated from the distance to the stop, and no single position can be bigger than $100,000.
- Every trade has a stop and a target before it fills. The broker holds both as one bracket order, so they work even if the program stops.
- At most 3 trend trades per symbol per day, one position per symbol, at least 20 minutes apart unless it's flipping, entries until 3:50 pm, and no more than 2 stock positions open at once.
- Flat by the close. Stocks close out by 3:56 pm ET (earlier on half days) and options by 3:45 pm. Nothing is held overnight.
- A daily circuit breaker. If the account is down $1,500 on the day, it closes everything and stops trading until tomorrow.
- Protect winning days. Once the day is up $1,000 or more, if it gives back half of its best level, it closes everything and keeps the rest of the profit.
- Paper only, by design. The code only talks to the broker's paper-trading environment and refuses real-money keys, so it can't touch real money even by mistake.
How it runs
Basis is a small program that runs in the cloud every minute of every weekday. Each minute it:
- checks the market clock, so it knows about holidays and early closes,
- pulls the latest 1-minute prices for SPY and QQQ,
- rebuilds the 1-minute and 5-minute charts and its indicators: moving averages, VWAP and the recent price range,
- checks the opening range and both setups,
- sends any new orders, with their stops and targets attached,
- checks open options against their exits,
- and writes what it did to a log that the terminal shows.
Every morning it also replays its own rules on the last 30 trading days of real 1-minute prices, the same code it trades with, so the backtest is testing exactly what's live. It's written in TypeScript, runs on Netlify, and the trades go through Alpaca's paper-trading account, which simulates fills at real market prices.
The terminal
I wanted anyone to be able to watch it work, so I built a trading terminal at arunsella.com/desk. It shows:
- The account: balance, today's profit or loss, trades, win rate, open P&L and the loss limit.
- Live charts: 5-minute candles with VWAP, the opening range, and the stop, entry and target of any open trade.
- A trade blotter: every position and closed trade with its entry, exit, result and P&L, labeled trend, breakout or option, and a plain-English reason for each one with the actual numbers: the averages, VWAP or opening range that triggered it.
- The engine log: every decision with a timestamp, in plain sentences.
- Research panels: a Monte Carlo simulation of possible outcomes, a matcher that finds past markets that looked like this one, a Bayesian estimate of the win rate that updates as trades close, buy and sell pressure, and volatility across time windows.
What the numbers say
I'd rather show the real numbers, good and bad, than a highlight reel.
| Test | Trades | Won | Profit factor | Result |
|---|---|---|---|---|
| First rule: buy dips, short bounces (Sep 23 to Nov 3) | 81 | 33% | 0.72 | −$3,376 |
| Trend rule (Sep 23 to Nov 3) | 164 | 36% | 0.94 | −$1,223 |
Both tests replay 30 trading days of real prices. The terminal reruns the test every morning on the latest 30 days, so its numbers move as the window moves. Profit factor is total winnings divided by total losses; above 1 makes money. The first rule clearly lost. The trend rule came close to break-even in testing: it wins about a third of the time, but its winners are about twice the size of its losers, so it needs only a slightly better hit rate to turn a profit.
Then it went live in the paper account:
On November 5 the market fell, and the agent shorted it six times as both trends pointed down. Four trades hit their target and two hit their stop. That's a great start, and it's also only two days. Two good days don't prove a system works any more than two bad days would prove it doesn't. The real test is the next few months, and the terminal will show every one of those days.
What I tried, and turned off
On November 5 I expanded Basis to seven blue-chip stocks (Apple, Microsoft, Nvidia, Amazon, Meta, Tesla and Google) and turned on options on every signal. By that afternoon, every blue-chip trade had hit its stop and all four option trades had lost, while the original SPY and QQQ trend trades were up about $3,000. Two of the four options were puts bought after the market had already fallen 4 to 6 percent, right before it bounced. So I cut back to SPY and QQQ and paused options. The options code stays ready for when there's evidence it helps. Knowing when to turn something off is part of the system too.
Update, November 6, 2026. Options are back on for trend and candle-streak signals (breakout options stay off), and the Dow Jones fund (DIA) joined SPY and QQQ. I then built two tougher tests: an options backtest that replays every signal with the real option contract's prices, and a walk-forward test that picks settings only from past months and scores the months after. Over six months of real option prices, every options version lost money, so the options layer is an experiment, not a proven edge. The full numbers, with dates, sample sizes and costs, are in the Basis case study and live on the desk.
What it can't do yet
- It isn't real money. Paper fills are simulated against real quotes, but Alpaca's documentation says paper accounts don't model liquidity, volatility or price improvement the way live trading does, so real fills can differ, especially in fast markets [3].
- The sample is small. Thirty days of backtest and a few days of live trading are a start, not a verdict.
- The options aren't backtested. Historical option prices aren't part of the free data I use, so the option trades are tested only by trading them live.
- No Nasdaq-100 index options. My broker doesn't offer NDX yet, so Nasdaq trades use QQQ.
- It only knows price. It doesn't read news, earnings or the economic calendar, so a surprise headline can hit it like anyone else.
What building it taught me
The biggest lesson is that a strategy that sounds smart can lose money, and you only find out by testing it. My first rule sounded reasonable, and the data said no. Being willing to throw out an idea I liked and rebuild it was more valuable than any single indicator.
The second lesson is that risk management is most of the job. The entries get all the attention, but the stops, the position sizing, the daily limit and closing out before the bell are what keep one bad day from erasing a good month.
The third is how much you can build on your own now. A few years ago, a system that reads the market every minute, trades stocks and S&P 500 index options, tests itself on real data and publishes a live terminal would have taken a team. I built it myself. Watching it place its first trade on its own, with the stop and target already set, was something else.
Next, I'm watching whether the live results match the backtest over a longer stretch, tightening the rules where they don't, and only then thinking about what it would take to trust a system like this with real money.
The terminal shows the agent's account, today's trades and every panel described above, updated through the trading day.
Open the trading terminal →Sources
- Options Clearing Corporation, Characteristics and Risks of Standardized Options (the options disclosure document; the buyer's maximum loss is the premium paid)
- Cboe, S&P 500 Index Options (SPX): cash-settled, $100 multiplier; XSP is one-tenth of SPX
- Alpaca, Paper Trading documentation (paper fills are simulated against real-time quotes and are an approximation of live trading)
The performance tables, backtests and terminal figures are the author's own results, from the code and logs published with this article. The Alpaca forum posts I checked describe fill delays that Alpaca staff disputed, so I have not relied on them.