Getting Started
Prerequisites
- Rust toolchain (1.70+): rustup.rs
Installation
bash
git clone https://github.com/matchstick-trading/matchstick-cli.git
cd matchstick-cli
cargo build --releaseThe binary is at target/release/matchstick.
Create your first project
bash
matchstick init my-strategyThis creates:
my-strategy/
├── src/strategy.json # Mean reversion strategy spec
├── data/sample_data.csv # 1440 bars of generated OHLCV data
├── matchstick.config.json # Backtest and risk configuration
└── README.mdRun a backtest
bash
matchstick run \
--strategy my-strategy/src/strategy.json \
--data my-strategy/data/sample_data.csv \
--capital 100000Example output:
Backtest Results:
Final P&L: $1,234.56
Return: 1.2%
Total Trades: 18
Win Rate: 61.1%
Sharpe Ratio: 1.05
Max Drawdown: 2.3%Use your own data
Prepare a CSV with these columns:
timestamp,symbol,open,high,low,close,volume
2024-01-02 09:30:00,AAPL,185.50,186.20,185.10,185.80,1500000Supported timestamp formats:
- ISO 8601:
2024-01-02T09:30:00Z - DateTime:
2024-01-02 09:30:00 - Date only:
2024-01-02
Then run:
bash
matchstick run --strategy src/strategy.json --data path/to/your/data.csv