← All writing

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:

  1. 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.
  2. Testing before trusting. A rule gets replayed on past prices to see how it would have done, including the losers.
  3. 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

Watch the market every minuteFrom the open to the close, every weekday, it rebuilds 1-minute and 5-minute charts for the S&P 500 and Nasdaq-100 funds and checks its rules.
Trade two different setupsA trend-following setup that trades all day, and an opening-range breakout that trades the first big move of the morning.
Buy and shortIt makes money when the market goes up or down, as long as it picks the right direction.
An options module, including the S&P 500 indexIt can buy calls and puts on its signals, including SPX index options, with a stop at half the price paid and a target at double. Options were paused in early November and switched back on for trend and candle-streak signals on November 6; see the update at the end.
Protect itselfEvery trade goes in with a stop-loss and a profit target already attached. It sizes every position by risk and shuts down for the day after a set loss.
Test itselfIt replays its own rules on the last 30 days of real 1-minute prices every morning and shows the result next to its live trading.
Report everythingA live terminal shows the account, every position and fill, the reason for each trade, and the engine's own log.

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.

  1. 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)?
  2. Confirm on the 5-minute chart. Is the 9-bar average above the 21-bar average there too, and price above VWAP?
  3. 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.
  4. 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.
  5. 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.

  1. Mark the range. The high and low of the first 15-minute candle, 9:30 to 9:45 am ET, become the opening range.
  2. 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.
  3. 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.
  4. 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.

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. A daily circuit breaker. If the account is down $1,500 on the day, it closes everything and stops trading until tomorrow.
  6. 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.
  7. 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:

  1. checks the market clock, so it knows about holidays and early closes,
  2. pulls the latest 1-minute prices for SPY and QQQ,
  3. rebuilds the 1-minute and 5-minute charts and its indicators: moving averages, VWAP and the recent price range,
  4. checks the opening range and both setups,
  5. sends any new orders, with their stops and targets attached,
  6. checks open options against their exits,
  7. 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:

What the numbers say

I'd rather show the real numbers, good and bad, than a highlight reel.

TestTradesWonProfit factorResult
First rule: buy dips, short bounces (Sep 23 to Nov 3)8133%0.72−$3,376
Trend rule (Sep 23 to Nov 3)16436%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:

Day 1 · Nov 4+$381
Day 2 · Nov 5+$2,633
Account after day 2~$103,000

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

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.

Watch it trade

The terminal shows the agent's account, today's trades and every panel described above, updated through the trading day.

Open the trading terminal →
Not financial advice. Basis is a learning project. Every trade is simulated in a paper account using live market prices, so no real money is at risk, and nothing here is a recommendation to buy or sell anything. Options are risky and can lose their entire value.

Sources

  1. Options Clearing Corporation, Characteristics and Risks of Standardized Options (the options disclosure document; the buyer's maximum loss is the premium paid)
  2. Cboe, S&P 500 Index Options (SPX): cash-settled, $100 multiplier; XSP is one-tenth of SPX
  3. 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.

Have an idea, a project, or a question for Arun?

Let's talk
Based in Madison, Wisconsinhello@arunsella.comLinkedInInstagramX

Arun Sella

Entrepreneur in Madison, Wisconsin, building free tools for money, small business and everyday life.

Pages