alpaca-trading-backtest

Runs reproducible historical trading backtests using the Alpaca CLI and generated workspace scripts.

4|Updated Aug 28, 2026
One-click install
npx skills add https://github.com/alan-d-smith/synthetix-alpha --skill alpaca-trading-backtest-alan-d-smith
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: alpaca-trading-backtest
Source: https://github.com/alan-d-smith/synthetix-alpha/tree/main/.agents/skills/alpaca-trading-backtest
Command: npx skills add https://github.com/alan-d-smith/synthetix-alpha --skill alpaca-trading-backtest-alan-d-smith

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? It turns a freeform trading idea into a deterministic, auditable historical backtest with formalized rules, saved raw data, and reproducible artifacts instead of ad-hoc, unverifiable simulations. ## Core Features & Use Cases - Strategy formalization: Translates a plain-language strategy concept into precise mathematical rules (indicators, entry/exit triggers, sizing, fill model) and confirms the interpretation with you before writing code. - Alpaca CLI data acquisition: Fetches bars, quotes, trades, calendar, and corporate actions through the Alpaca CLI, saves raw outputs, and computes data fingerprints for reproducibility. - Standardized artifacts and reporting: Produces a self-contained run folder with notes.md, strategy_spec.json, config.json, run.py, trades.csv, equity.csv, summary.json, and a report.md leading with a Performance vs Benchmarks table. - Use Case: Ask your agent to backtest an SMA(50)/SMA(200) crossover on SPY daily bars from 2020 to 2025; it confirms the interpretation, fetches data via the Alpaca CLI, runs a single-file simulation, and returns the Teaching Five metrics plus artifact paths. ## Quick Start Ask your agent to backtest a specific strategy idea with a start date, end date, and symbol, for example: run a backtest of a 50/200 day moving average crossover on SPY from 2020-01-01 to 2025-12-31 using daily bars.

Frequently Asked Questions about alpaca-trading-backtest

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I backtest a trading strategy with the Alpaca CLI?▼

Provide a start date, end date, and strategy concept; the agent formalizes the rules, confirms the interpretation, fetches bars and quotes via the Alpaca CLI, and runs a single-file simulation script. Results include trades.csv, equity.csv, summary.json, and a report.md with benchmark comparison.

What fill models does this backtesting workflow support?▼

It supports next_open (signal on bar close, fill at next bar open), time_based fills at a confirmed time of day, and same_bar fills only when explicitly requested with a documented look-ahead warning. Quote-based fills use ask for buys and bid for sells plus slippage.

Does the backtest support options or mixed asset portfolios?▼

V1 supports one asset family per run: stocks or crypto, with multiple symbols allowed within the same family. Options require explicit contract selection and fill logic, and mixed-family portfolios are out of scope unless the generated code explicitly models them.

How are trading fees and slippage modeled in the backtest?▼

Execution friction combines spread and slippage in basis points, while trading-activity fees are modeled from Alpaca's Brokerage Fee Schedule PDF covering SEC, FINRA TAF, CAT, ORF, and related categories. Modeled and excluded fee categories are recorded in fee_source.json.

Why does my backtest report no trades?▼

A no-trade result is reported directly with the cause: indicator warmup, no signal triggered, insufficient cash, missing data, or calendar filtering. The agent explains which condition applied rather than silently returning empty results.

What happens if the Alpaca CLI authentication fails?▼

The agent runs alpaca doctor before any backtest and stops the run if authentication fails, showing the alpaca profile login options. API keys can also be supplied via ALPACA_API_KEY and ALPACA_SECRET_KEY environment variables without writing secrets into generated code.