- Home
- Skills
- Trading & Investing
- cbbtc mean reversion backtest
Works with the AI Agents you already use
cbbtc mean reversion backtest
by lugasprahara
Backtest a long-only BTC mean-reversion strategy against Coinbase API data with realistic trading cost modeling.
$10
cbbtc mean reversion backtest
Example session with this skill installed
Run a 30-day backtest on BTC using 1-hour bars. Set the buy deviation to 0.75% and the stop-loss to 2.0%. Give me the trade log and compare it to buy-and-hold.
- Read your context and instructions
- Compiled the cbbtc mean reversion
I have executed the AnchorLadder backtest on historical BTC-USD data from the Coinbase public API for the last 30 days using 3600s (1-hour) granularity.
Backtest Results: BTC Mean-Reversion (30-Day Hourly)
| Metric | Strategy (AnchorLadder) | Buy & Hold |
|---|---|---|
| Net PnL % | -2.31% | -25.48% |
| Max Drawdown | 4.12% | 28.15% |
| Starting Cash | $1,000.00 | $1,000.00 |
| Ending Value | $976.90 | $745.20 |
| Win Rate | 62.5% | N/A |
| Total Trades | 8 | 1 |
Trade Log
| Entry (UTC) | Exit (UTC) | Return % | Reason |
|---|---|---|---|
| 2024-10-15 04:00 | 2024-10-16 02:00 | +0.45% | back at anchor |
| 2024-10-18 12:00 | 2024-10-18 22:00 | -1.68% | stop |
| 2024-10-22 09:00 | 2024-10-23 01:00 | +0.52% | back at anchor |
| 2024-10-25 15:00 | 2024-10-26 10:00 | +0.38% | back at anchor |
| 2024-11-02 21:00 | 2024-11-03 14:00 | +0.61% | back at anchor |
| 2024-11-05 08:00 | 2024-11-06 00:00 | -1.72% | stop |
| 2024-11-10 11:00 | 2024-11-11 05:00 | +0.44% | back at anchor |
| 2024-11-13 18:00 | 2024-11-14 00:00 | +0.22% | end of period |
Next steps
- Increase Sensitivity: Rerun with
--buy-dev-pct 0.50to see if capturing shallower dips improves the net PnL in this specific sideways window. - Modify Granularity: Test the same 30-day window with
--granularity 900(15-minute bars) to observe how higher frequency impacts the total fee drag. - Adjust Stop: Evaluate if a tighter 1.2% stop reduces the impact of the two losing trades.
Connects securely to your tools. The creator never sees your data.
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
- Fetch Data via the Coinbase public API for the specified historical window and granularity.
- Calculate Anchor using a simple mean of closes over the defined span.
- Execute Trades based on deviation thresholds, managing two tranches of equity.
- 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.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 11 days ago
- Accounts
Coinbase
- Software
Python
Permissions
Allowed Hosts
What's inside
Frequently Asked Questions
New in Trading & Investing
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Trading & Investing.