Basis: case study

A paper-trading research system for stocks, options and crypto. Designed, built and tested by Arun Sella.

arunsella.com/desk
The Basis stock desk: account, positions, SPY chart, trade blotter and engine log
The live stock desk. Prices are real; the money is a paper account.

Overview

Basis reads live market prices, decides on its own when to trade, places orders in Alpaca paper accounts, and publishes every decision and every test result on two public desks.

It started as a question: can a simple, written-down rule beat the market once fees and real fills are counted? Answering that honestly took more engineering than the trading rules themselves. Basis has to run unattended, protect itself when something fails, and test its own rules on months it has never seen. This page covers how it's built, how it decides, and what the evidence says so far, including the parts that don't work.

  • StatusLive, paper trading only (simulated orders and fills at live prices)
  • MarketsS&P 500, Nasdaq-100 and Dow Jones funds and options; Bitcoin, Ethereum, Solana and Dogecoin
  • Built withTypeScript, Netlify scheduled and background functions, Netlify Blobs storage, Alpaca's paper-trading and market-data APIs
  • RunsStocks every minute in market hours; crypto every 5 minutes, all day
  • BuilderArun Sella

Architecture

Alpaca market datalive and historical prices Alpaca paper accountssimulated orders and fills Stock engineevery minute, 9:30 AM to 4 PM ET Crypto engineevery 5 minutes, all day Test jobsdaily backtests, weekly walk-forward Storage (Netlify Blobs)trades, logs, test results Read-only API → deskscannot place or cancel orders

Two scheduled engines do the trading, and each has its own Alpaca paper account, so a crypto bug can never touch a stock position. The crypto engine refuses to start if it's given the stock account's keys. Test jobs run in the background, and the slowest one, the walk-forward test, saves its progress and restarts itself until it's done. The public pages read from a separate API that has no way to place an order.

A real trade decision

On November 6, 2026 at 3:48 PM, the stock engine logged this, word for word:

Shorted 135 SPY at market (last 737.37), risk $162. Why: Trend down on both timeframes. 1-minute: price 737.26 below the 9-bar average 737.29, which is below the 21-bar average 737.45, and the 21-bar is falling. Price is below today's VWAP 738.46. 5-minute: 9-bar 737.69 below 21-bar 737.86, close 737.17 below VWAP. Stop is 1.5x the 5-minute range (0.80) away, target 3x.

Every order goes through the same checks, in this order:

  1. Signal. The 1-minute and 5-minute trends must agree (9-bar average vs 21-bar, slope, and price vs VWAP), or a breakout or candle-streak rule must fire.
  2. Risk gates. Inside the trading window, under the $1,500 daily loss limit, fewer than 3 positions open, and a price no older than 5 minutes.
  3. Size. About $1,000 of risk per stock trade from the stop distance; options are capped at $1,000 of premium and 6 a day.
  4. Order. Sent with its stop and target attached, under a unique order ID so a retry can't double it.
  5. Exit and record. Stop, target, a trend flip, or the close. The reason is saved with the trade and shown on the desk.

That trade also exposed a bug. The 3:56 PM close-everything request failed quietly, and the engine never checked, so the short stayed open overnight. The fix closes each position separately, confirms with Alpaca that it's gone, and retries every minute until the bell. A second check at the next morning's open closes anything left over from an earlier day.

Test results

Every number here is from Basis's own tests, after costs, as of November 6, 2026. The desks re-run the backtests daily and the walk-forward weekly, so the live numbers there may differ.

TestResult after costsVerdict
Stock trend backtest
SPY, QQQ, DIA
Sep 25 to Nov 5, 2026 · 30 trading days · 265 trades · costs: $0.02 a share
+$6,061
profit factor 1.22 · worst stretch −$3,012
Same days the rules were built on
Stock walk-forward
settings chosen from the prior 3 months
Dec 2025 to Nov 2026 · 12 unseen months · 1,506 trades · costs: $0.02 a share
+$2,910
profit factor 1.02 · worst stretch −$14,289 · 8 of 12 months up
Roughly break-even
Options replay
real SPY, QQQ, DIA option prices
Sep 25 to Nov 5, 2026 · 179 option trades · costs: 2% spread each way + $0.03 a contract
+$4,391
profit factor 1.12 · worst stretch −$4,822
Short window
Options walk-forward
signals chosen from the prior 2 months
Jun to Nov 2026 · 6 months of real option prices · costs: 2% spread each way + $0.03 a contract
−$11,475 over 4 unseen months
today's rule: −$15,447 over 6 months · 1 of 4 months up
Loses money
Crypto trend
BTC and ETH, 50-day average
Two years to Nov 6, 2026 · 36 trades · picked on year one, judged on year two · costs: 0.25% each way
+$3,530
buy and hold: −$22 · profit factor 3.27 · worst stretch −$829
Held up on unseen data
Crypto short-term rules
5-minute, hourly, dip buying, breakouts, micro trades
30 days to 2 years · more than 40 versions · costs: 0.15% to 0.25% each way
Every version lostFees exceed the moves

What the evidence says. The stock trend rule doesn't lose money, but its edge is thin next to its swings. The options layer lost money once six months of real option prices were counted, even though the last 30 days looked profitable; that gap is exactly why the walk-forward test exists. The crypto trend rule is the only part that held up on data it hadn't seen. None of this is enough to call Basis profitable, and the desks say so.

Engineering challenges

  • Testing options with real pricesThe first stock backtest couldn't say anything about options. The replay matches each signal to the exact contract Basis would have bought and loads that contract's real 1-minute prices, a few thousand data requests per run, paced to stay under Alpaca's rate limits.
  • Jobs longer than the platform allowsNetlify background jobs stop after 15 minutes, and the walk-forward test needs more. It saves its progress after each month and starts itself again until every month is scored.
  • Results that depend on the order of tradesTurning off breakout options flipped trend options from +$2,467 to −$817, because the 6-a-day cap let different trades in. That's a warning sign that an edge isn't real, so settings are now judged only on unseen months.
  • Fees vs small movesAlpaca's roughly 0.25% crypto fee is bigger than most 5-minute moves. Every short-term crypto rule lost for that reason, which led to the daily trend rule.
  • Running within a hosting budgetBasis once used up the site's monthly hosting allowance. The engine now skips hours when the market is closed, the pages poll less when the market is closed or the tab is hidden, and results are cached.
  • Failing safelyUnique order IDs prevent duplicate orders, stale prices block new trades, the end-of-day close confirms and retries, and a morning check catches anything left over.

Milestones

  • Fall 2026First version: a two-timeframe trend rule on SPY and QQQ, with stops, targets, a daily loss limit, and a public terminal.
  • Nov 5, 2026Tried seven blue-chip stocks and options on every signal. Every blue-chip trade hit its stop, so they were cut and options were paused.
  • Nov 6, 2026Added the Dow Jones fund, S&P 500 index options, the candle-streak rule and the 10,000-run Monte Carlo outlook. The loss limit stopped trading after a −$1,462 day.
  • Nov 6, 2026Fresh paper account. Launched Basis Crypto on its own account. Built the options replay and the walk-forward test, switched breakout options off, and fixed the overnight-position bug.
  • NextMonths of forward paper trading, and pausing options until an options rule passes the walk-forward test.

Disclaimer

Basis is a learning and research project. All trading is simulated in paper accounts using live market prices; no real money or real orders are involved, and nothing here is investment advice. Past and simulated results don't predict future results.

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