# cbbtc mean reversion backtest

> Backtest a long-only BTC mean-reversion strategy against Coinbase API data with realistic trading cost modeling.

cbbtc mean reversion backtest is a paid AI agent skill on Agensi by lugasprahara, in Trading & Investing. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $10 (one-time purchase)
- Creator: [lugasprahara](https://www.agensi.io/creators/lugasprahara)
- Category: [Trading & Investing](https://www.agensi.io/skills/trading-investing)
- Version: 1.0
- Last updated: 2026-11-24
- Security: scan passed (2026-11-24); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/cbbtc-mean-reversion-backtest
- Tags: trading, python, backtesting, bitcoin, coinbase

## About this skill

Most "buy the dip" strategies look great until you factor in trading friction. This skill backtests a long-only Bitcoin mean-reversion strategy against live Coinbase API data using a realistic 35 bps round-trip cost model.

### What it does
- **AnchorLadder Strategy** simulation using a simple moving average anchor to identify price dislocations.
- **Cost Modeling** including fees, slippage, and price-impact allowances for every fill.
- **Performance Benchmarking** comparing strategy net PnL directly against a buy-and-hold yardstick.
- **Risk Metrics** reporting max drawdown, win rate, and specific exit reasons for every trade.
- **Parameter Tuning** allowing users to adjust dip thresholds, stop-loss percentages, and anchor spans.

### How it works
1. **Fetch Data** via the Coinbase public API for the specified historical window and granularity.
2. **Calculate Anchor** using a simple mean of closes over the defined span.
3. **Execute Trades** based on deviation thresholds, managing two tranches of equity.
4. **Log Results** by generating a per-trade report with entry/exit timestamps and effective prices.

### Frameworks & tools
This tool uses Python 3 and the Coinbase Exchange public candle API. It requires no external libraries, API keys, or credentials.

### Why this beats prompting it yourself
Prompting an LLM to "write a backtester" often results in cherry-picked data or missing cost logic like price impact. This skill uses the exact AnchorLadder logic from the make.fun race, ensuring fees and slippage aren't ignored in the PnL calculation.

### Use cases
- Evaluate how a dip-buying strategy performs in high-volatility markets.
- Stress-test stop-loss sensitivity during sharp Bitcoin price drops.
- Compare mean-reversion returns versus holding BTC over 7, 14, or 30 days.

### Known limitations
Limited to historical Coinbase data. No support for live order execution or real-time signals. Decisions are made on bar closes and filled at the next bar's open.

## Requires

- Python

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the cbbtc mean reversion backtest skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does this skill handle trading fees and slippage during the backtest?

This skill accounts for a realistic 35 bps round-trip cost (including fees and slippage), preventing the 'perfect' results seen in basic simulations that ignore the friction of real-world trading.

### Does this skill require my Coinbase API keys or account access?

No, this skill is designed for safety and research; it uses Coinbase's public API to fetch historical data and does not require API keys or the ability to execute live trades.

### Which AI agents or environments can I use to run this backtester?

The skill is built in Python 3 and is compatible with any AI agent capable of executing code in a sandboxed environment or on a local machine with internet access.

### What specific strategy parameters can I adjust before running a test?

You can customize the Simple Moving Average (SMA) anchor span, the specific percentage threshold for entering a 'dip,' and your stop-loss and take-profit exit conditions.

### What is included in the purchase of this skill?

You will receive the complete Python logic for the AnchorLadder strategy, the data fetching module for Coinbase, and a reporting engine that generates PnL and risk metrics.

### Can I use this for high-frequency or intra-candle scalping simulations?

The skill operates on historical 'bar' data, meaning it simulates entries and exits based on candle closes and opens rather than sub-second tick movements.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
