alpaca-trading-backtest

alpaca-trading-backtest is a skill for Claude Code, Codex from alpacahq/alpaca-skills. It costs 63 tokens per session (3,384 once invoked), scanned A, original, Apache-2.0.

A repeatable process for testing an investment strategy against historical market data using Alpaca and local code.

In plain words
What is it for?
Use it to run date-bounded backtests, simulate trades, inspect diagnostics, and save the code and reports needed to reproduce each run.
Why use it?
It turns an informal strategy idea into explicit rules and saved results that can be checked and reproduced, while keeping historical simulation separate from live performance.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to run date-bounded backtests, simulate trades, inspect diagnostics, and save the code and reports needed to reproduce each run.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/alpacahq/alpaca-skills/backtest
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add alpacahq/alpaca-skills --skill backtest
Clone the repo
git clone --depth 1 https://github.com/alpacahq/alpaca-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for alpaca-trading-backtest

README.md
[![agentmods](https://agentmods.dev/badge/skills/alpacahq/alpaca-skills/backtest/github.svg)](https://agentmods.dev/skills/alpacahq/alpaca-skills/backtest)
Your own site
<a href="https://agentmods.dev/skills/alpacahq/alpaca-skills/backtest"><img src="https://agentmods.dev/badge/skills/alpacahq/alpaca-skills/backtest/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for alpaca-trading-backtest

Your own site · 80×15
<a href="https://agentmods.dev/skills/alpacahq/alpaca-skills/backtest"><img src="https://agentmods.dev/badge/skills/alpacahq/alpaca-skills/backtest.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,384 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 2 findings, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Output Handling · line 351
    Output size or generation rate is not bounded. Unbounded output enables denial-of-service through resource exhaustion, log flooding, or context-window stuffing.
    Fix: Set explicit limits on output length, generation count, and rate. Use max_tokens and truncation to prevent unbounded output.
  • medium Output Handling · line 354
    Output size or generation rate is not bounded. Unbounded output enables denial-of-service through resource exhaustion, log flooding, or context-window stuffing.
    Fix: Set explicit limits on output length, generation count, and rate. Use max_tokens and truncation to prevent unbounded output.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00063 $0.03384
Opus 5 $0.00032 $0.01692
Sonnet 5 $0.00013 $0.00677
Haiku 4.5 $0.00006 $0.00338

Measured 10d ago against content hash 830db169959a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

alpaca-trading-backtest scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/trading-api/backtest/SKILL.md · 422 lines

How it starts

The opening of the file, as written. The whole thing — 422 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Trading API Backtesting

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.

Required disclosures

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.

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.

Read the full file on GitHub · 422 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 422 lines · 63 tokens per session scan A 830db169959a

Subscribe to this mod's changes

alpaca-trading-backtest is a skill published in the GitHub repository alpacahq/alpaca-skills (146 stars, last pushed yesterday), licensed Apache-2.0. It adds 63 tokens to every session and 3,384 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.