account-onboarding
Open and manage brokerage accounts via the Alpaca Broker API — account creation, KYC/CIP, identity & disclosures, agreements,…
Execute deterministic, reproducible historical backtests from a start date, end date, and strategy concept using the Alpaca CLI plus agent-written workspace code. Use when the user wants to backtest a strategy, simulate historical trades, or return trades, diagnostics, and
$ npx -y skills add alpacahq/alpaca-skills --skill backtest --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/backtestContext preview
The summary Claude sees to decide when to auto-load this skill.
Execute deterministic, reproducible historical backtests from a start date, end date, and strategy concept using the Alpaca CLI plus agent-written workspace code. Use when the user wants to backtest a strategy, simulate historical trades, or return trades, diagnostics, and
name: alpaca-trading-backtest description: > Execute deterministic, reproducible historical backtests from a start date, end date, and strategy concept using the Alpaca CLI plus agent-written workspace code. Use when the user wants to backtest a strategy, simulate historical trades, or return trades, diagnostics, and reproducibility artifacts.
Use this skill when you want your AI agent to run a specific historical backtest with the Alpaca CLI and local workspace code. This version is optimized for run-specific execution: your agent writes the minimum readable code needed for the confirmed strategy, stores the exact artifacts, and reports the results back to you.
This skill is written for you, the person invoking it through your AI agent. **You** means the trader, developer, researcher, or operator asking your agent to run the backtest. Your agent should address you directly, restate assumptions clearly, and make every interpretation choice visible.
strategy idea -> formalized rules -> confirmed assumptions -> CLI data fetch -> local script -> artifacts -> report
It is not a promise that a strategy will work in live markets. It is a reproducible research workflow.
Every report, `notes.md`, `report.md`, notebook, dashboard, or exported result should include:
> **Important disclosure** > This backtest is a hypothetical historical simulation and does not represent actual trading performance. Backtested results do not guarantee future results. Results depend on market-data quality, data feed selection, corporate-action handling, fees, slippage, liquidity, taxes, execution assumptions, and implementation details. This material is for research and educational purposes only and is not investment advice, a recommendation, an offer, or a solicitation to buy or sell securities, options, cryptocurrencies, or any other financial product. All investments involve risk and may lose value. Review Alpaca's disclosures and agreements at [alpaca.markets/disclosures](https://alpaca.markets/disclosures).
When paper trading appears in the workflow, add:
> Paper trading is a simulated environment. It does not involve real money or actual securities transactions. Paper results may differ from live trading because of fill assumptions, market impact, liquidity, latency, data differences, order handling, fees, and other market conditions.
When the backtest models Alpaca securities trading-activity fees, `notes.md`, `summary.json`, and `report.md` should link to the Alpaca Brokerage Fee Schedule PDF:
https://files.alpaca.markets/disclosures/library/BrokFeeSched.pdf
Record the PDF revision date, extraction timestamp, modeled fee categories, and any fee items intentionally excluded.
Your agent should use the Alpaca CLI for market-data access.
Check whether it is installed:
alpaca version
Install with Go when needed:
go install github.com/alpacahq/cli/cmd/alpaca@latest
On macOS or Linux with Homebrew:
brew install alpacahq/tap/cli
Make sure the binary directory is on `PATH`, commonly `~/go/bin` for Go installs.
Alpaca CLI commands should run in your local workspace where your Alpaca profile, environment variables, network access, and saved artifacts are available. Some agent runtimes express this as:
required_permissions: ["all"]
Use the equivalent permission model in your agent environment so the CLI can access local auth/config and write run artifacts.
Before any backtest run, verify the CLI and credentials:
alpaca doctor
If authentication fails, your agent should stop the run and show you the available login/help command:
alpaca profile login --help
For interactive paper setup:
alpaca profile login
For API-key setup:
alpaca profile login --api-key
For automation, environment variables are preferred because secrets do not need to be written into generated code:
export ALPACA_API_KEY=PK... export ALPACA_SECRET_KEY=... export ALPACA_QUIET=1
Your agent should never print your secret key, commit it to files, include it in reports, or pass it in a way that exposes it to shell history.
Use `--quiet` for commands whose output will be parsed by code:
alpaca account get --quiet alpaca data bars --symbol SPY --start 2024-01-01 --end 2024-12-31 --timeframe 1Day --quiet
Use installed CLI help and schemas as the source of truth for flags and response fields:
alpaca --help-all alpaca data bars --help alpaca data bars --schema alpaca data quotes --schema
Because the CLI is generated from API specifications and may evolve, your agent should prefer current `--help`, `--schema`, and `alpaca doctor` output over stale examples.
Your agent should follow this workflow:
1. Gather required inputs: start date, end date, strategy concept or strategy file. 2. Gather or infer the rest: asset class, symbols or universe, timeframe, initial cash, position sizing, feed, adjustment mode, execution assumptions, benchmark. 3. Work through [run considerations](#run-considerations-checklist): order simulation, indicators, dividends, splits, fees, slippage, spread, market hours, calendar handling, and validation. 4. Translate your freeform idea into precise mathematical rules. 5. Present the formalized interpretation to you before writing code unless your request was already mathematically precise. 6. Check the workspace for reusable data, prior runs, and existing utilities. 7. Create a self-contained run folder. 8. Write `notes.md`, `strategy_spec.json`, `config.json`, and a readable run-specific script. 9. Fetch historical data through the Alpaca CLI, save raw CLI outputs, filter to the chosen market hours, and compute data finge
Open agent skills for Alpaca's Trading API and Broker API. Each skill is a SKILL.md file with step-by-step instructions your AI coding assistant follows when you ask it to complete a task, such as running a historical backtest, onboarding Broker API accounts,
Open and manage brokerage accounts via the Alpaca Broker API — account creation, KYC/CIP, identity & disclosures, agreements,…
Move money between an Alpaca brokerage account and the EXTERNAL banking world via the Broker API — ACH relationships, wire…
Entry point for integrating with the Alpaca Broker API (plus Market Data and Trading APIs) in any programming language. Use when…
Move cash (JNLC) and securities (JNLS) BETWEEN accounts inside your own Alpaca omnibus via the Broker API — single, batch, and…
Pull and stream US stock market data from Alpaca — REST snapshots/bars/trades/quotes, historical bars with timeframes and feeds…
Handle money and numeric precision correctly with the Alpaca API — numbers-as-strings on the wire, decimals vs floats,…