A self-directed quantitative finance research project
What happens when an idea meets the market?
I am building this lab to apply my software engineering, machine learning,
statistics, and data systems background to questions in quantitative finance. Its
strategy lab tests simple rules against historical prices and asks what the evidence
can—and cannot—support. A separate options calculator examines theoretical prices
under stated assumptions.
A short field guide · No finance background needed
OBJECT 001 THE RESEARCH CYCLE
01 Question02 Data03 Rule04 Evidence
A REPEATABLE INVESTIGATION
Begin with a testable idea. Follow the data, inspect the assumptions, and keep the
limitations in view.
Research process, not a performance chart.
01 THE IDEA
A time machine for a trading rule.
A backtest asks: “What would have happened if I had followed this
rule in the past?”
You choose a period, a starting amount of imaginary money, and a rule. The lab walks
through historical prices in order, simulates buying or selling, and tracks the
portfolio’s value.
Quantitative research simply means using numbers and repeatable
rules to investigate an idea. Here, you can inspect the decisions, compare the
outcome, and keep a record of what you tested.
WHY I BUILT THIS
My background is primarily in computer science and software engineering. I built
Orion to develop the mathematical, statistical, and financial research skills that
quantitative finance requires, through small experiments I can explain and repeat.
02 THE RULES
Three ways to travel through the same history.
The lab starts with SPY, an exchange-traded fund: a basket of investments that trades
like a stock. SPY tracks the S&P 500, an index of large U.S. companies.
RULE A / THE REFERENCE POINT
Buy and hold.
Buy at the first selected closing price. Keep the investment until the experiment
ends.
“What if I simply stayed invested?”
This is the benchmark—the simple alternative your idea is
compared against. It receives the same starting capital, dates, asset, and cost
assumptions.
RULE B / THE QUESTION
Follow the momentum.
Own the asset when its previous closing price is higher than its close a chosen
number of sessions earlier. Otherwise, hold cash.
“Does a recent rise tend to continue?”
The lookback is that number of trading sessions. A 30-day
lookback means 30 market observations, not 30 calendar days. This rule can miss
recoveries or trade repeatedly in a choppy market.
RULE C / A DIFFERENT TREND TEST
Compare with the recent average.
The moving-average filter owns the asset when yesterday’s close is strictly above
the average of the previous N closes, including yesterday. Otherwise it holds
cash. The decision uses only earlier prices and takes effect at today’s close.
“Is the latest close above its recent trend?”
This gives a second, testable definition of a trend. It shares the same asset,
benchmark, transaction-cost setting, and limitations as the momentum rule.
You can also import your own daily CSV. The benchmark then holds that same imported
asset, rather than SPY.
03 THE MACHINERY
The past arrives one day at a time.
The engine must only use information that was already available. Seeing tomorrow’s
price today would make the experiment unfair.
OBSERVE
Read yesterday’s prices.
Momentum compares yesterday’s close with one lookback earlier; the moving-average
filter compares it with a recent average. Earlier data warms up either rule before
your selected test window.
DECIDE
Trade at today’s close.
If the rule changes from cash to invested, buy. If it changes back, sell. Deduct
the selected cost on each transaction.
MEASURE
Count what happens next.
A purchase at today’s close first earns the return from today to tomorrow. Each
day’s cash plus investment value becomes a point on the chart.
From hypothesis to a credible result
IN THE LAB TODAY
State a hypothesis and choose a historical window before changing the rule.
Prepare daily adjusted prices or validate an imported CSV.
Implement the rule without using future prices, then run the backtest.
Compare with buy and hold under the same dates, capital, and modeled trade
costs.
Examine returns, volatility, drawdown, Sharpe ratio, and the trade record.
VALIDATION STILL TO BUILD
Reserve unseen data for out-of-sample testing.
Study how trying many settings can overfit the historical sample.
Test sensitivity to costs and add a separate slippage model.
A small example: why timing matters
Suppose Monday closes at $100 and Tuesday at $110. A one-session momentum rule sees
that rise and buys at Wednesday’s close. It cannot claim the gain from Monday to
Tuesday—or any movement earlier on Wednesday—because it did not own the asset then.
Where the history comes from
Daily SPY prices come from Yahoo Finance. A weekday refresh is scheduled for 23:30
UTC: 7:30 p.m. Eastern in summer and 6:30 p.m. in winter. Today’s prices are
excluded until 6 p.m. Eastern. The lab displays the latest available date and
warns when data is old.
Prices are adjusted for dividends and stock splits so comparisons
use a consistent basis. They are research values, not the exact historical prices
at which you could have traded.
What the model assumes
You can own fractional units or hold cash. Cash earns no interest. The model has
no borrowing, taxes, or separate estimate for the difference between expected and
actual trade prices. Open holdings are valued at the final close without a forced
sale.
Calculations run in your browser. The data source is unofficial; a failed refresh
keeps the last published dataset available. “Check for data update” checks that
published snapshot, not live quotes.
04 THE EVIDENCE
Read the journey. Not just the finish.
The portfolio chart shows how your imaginary money changed over time. The solid line
follows your rule; the dashed line follows buy and hold.
Total return
How much did the portfolio gain or lose?
Starting with $100 and ending with $120 means a 20% return. The lab includes
modeled trading costs.
Maximum drawdown
How far did it fall from an earlier peak?
If the portfolio reaches $120, then falls to $90, that decline is 25%. A later
recovery does not erase the experience of that fall.
Volatility
How uneven was the ride?
This measures the variation in daily returns, scaled to a year. It counts both
upward and downward movement; it is not a worst-case loss.
Sharpe ratio
How much return came with that variation?
This compares average daily return with daily volatility, scaled to a year. Here
the cash reference rate is zero. Higher values indicate more return per unit of
variation in this sample, not a guarantee of a better strategy.
For the curious: the calculations
Total return = final value ÷ starting capital − 1. Volatility = sample standard
deviation of daily returns × √252. Sharpe = mean daily return ÷ that daily standard
deviation × √252. The lab assumes 252 trading sessions per year and reports Sharpe
as N/A when variation is zero. Drawdown compares each value with the highest value
reached so far, including starting capital.
05 YOUR FIRST EXPERIMENT
Begin with a question. Leave with evidence.
Try this: “How does a 30-session momentum rule compare with simply holding SPY?”
Keep SPY and choose momentum.
Use the default dataset and “Time-series momentum.” Start with a lookback of 30.
For your first run, the default dates provide enough earlier history to warm up
the rule.
Set the terms of the experiment.
Start with $100,000 of simulated capital and 5 basis points per trade. A
basis point is 0.01%, so 5 bps means a $5 cost for every $10,000
bought or sold.
Run it. Look at both lines.
Click “Run backtest.” Compare return and drawdown with the benchmark. Then inspect
Trade history to see when the rule bought, sold, or stayed in cash.
Change one thing and ask why.
Try a 60-session lookback, keeping everything else the same. Did trading become
less frequent? Did the portfolio miss a recovery? Changing one setting makes the
comparison easier to understand.
Keep your evidence.
“Save experiment” keeps a run in this browser on this device, up to the latest 10.
“Export experiment JSON” downloads the data, settings, and results. “Export equity
CSV” downloads daily values you can open in a spreadsheet. Clearing browser
storage removes local saves.
Bring your own dataset
Choose “Import daily CSV,” enter an asset label, and select a file with
date,close columns. Use dates like 2026-01-02, positive
decimal prices, and one row per daily observation, oldest first. Dates must be
unique. Use a consistent adjustment basis and include enough observations before
your start date for the momentum lookback.
The lab accepts 3–20,000 rows in a file smaller than 2 MB. It validates the format
but cannot independently verify your provider’s prices or trading calendar.
06 RESEARCH RECORD
What is built. What comes next.
Orion is a working learning project, not a record of live trading. Its current scope
is deliberately narrow so that each calculation and assumption can be inspected.
WORKING NOW
Historical experiments
SPY daily adjusted-price snapshot and validated daily CSV import.
Time-series momentum, moving-average trend filter, and buy-and-hold backtests
with configurable dates, capital, lookback, and proportional trade costs.
Same-asset benchmark; equity and drawdown charts; return, annualized return,
volatility, Sharpe ratio, and maximum drawdown.
Trade history, browser-local saved experiments, and JSON or equity CSV exports.
Import saved experiments and compare runs side by side.
Train/test separation, then walk-forward validation and checks for parameter
overfitting.
A separate slippage model and sensitivity analysis for trading costs.
Only after the validation foundation: factor research, portfolio optimization,
Monte Carlo methods, and historical options research when suitable data exists.
IMPLEMENTED ARCHITECTURE
A static HTML/CSS and browser JavaScript interface runs separate JavaScript backtest
and options-pricing engines. Python scripts validate and refresh the published daily
dataset. GitHub Actions checks the lab; the portfolio's scheduled workflow refreshes
the published data. The portfolio serves the reviewed lab build from a Dockerized
Nginx site.
The current code does not use a server API, database, React, or a machine-learning
model. Those would be separate future design decisions, not existing capabilities.
THE NEXT EXHIBIT IS YOURS
You have the question. Now run the experiment.
The lab is a place to learn how an idea behaves—and where it breaks.