Works with the AI Agents you already use

    easy backtest

    by Kavin Ravi

    1

    Testing trading ideas shouldn't require complex boilerplate or heavy infrastructure.

    Free

    Security scanned
    easy backtest

    easy backtest

    Example session with this skill installed

    Backtest a 50/200 SMA crossover strategy for AAPL from 2020 to 2023. Assume a 2 basis point trading cost and show me how it compares to just holding the stock.

    • Read your context and instructions
    • Compiled the easy backtest
    • Generated the data export

    I have executed the backtest for AAPL using the SMA crossover strategy (50-day fast, 200-day slow) with a 2 bps trading cost.

    AAPL SMA Crossover Backtest Results (2020-01-02 to 2023-12-29)

    MetricSMA Crossover (50/200)Buy & Hold (Benchmark)
    Total Return104.22%158.45%
    CAGR19.55%26.82%
    Annual Volatility22.10%34.50%
    Sharpe Ratio0.880.78
    Max Drawdown-18.45%-31.22%
    Trade Count62
    Win Rate54.20%N/A

    Backtest Configuration:

    • Ticker: AAPL
    • Interval: 1d
    • Initial Cash: $10,000
    • Trading Cost: 2 bps per trade
    • Date Range: 2020-01-02 to 2023-12-29 (986 bars)

    The SMA 50/200 strategy significantly underperformed the buy-and-hold benchmark in total return. However, it achieved a higher Sharpe ratio and a much lower maximum drawdown (-18.45% vs -31.22%), suggesting better risk-adjusted returns and lower volatility during this period. The win rate of 54.20% represents the percentage of bars where the strategy held a position that yielded a positive return.

    Next steps

    • Run a sma_suite sweep to see if different windows (e.g., 20/50 or 10/30) capture the trend more effectively.
    • Export the full bar-by-bar data to bars.csv to inspect specific trade entry and exit points.
    • Increase the --cost-bps to 5 to see how higher friction impacts the crossover performance.

    Disclaimer: These are historical simulations based on simplified assumptions and do not predict future returns.

    bars.csv

    CSV · data export

    Generated

    Example file from a real run - the skill writes it into your workspace.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Testing trading ideas shouldn't require complex boilerplate or heavy infrastructure. This skill provides a streamlined Python environment for backtesting simple moving average (SMA) strategies and buy-and-hold baselines with realistic cost assumptions.

    What it does

    • Multi-strategy testing Executes buy-and-hold, SMA crossover, or multi-pair SMA sweeps.
    • Metric calculation Computes CAGR, Sharpe ratio, volatility, and max drawdown.
    • Benchmarking Automatically compares strategy performance against a no-cost buy-and-hold baseline.
    • Cost modeling Applies basis-point trading costs to every position change to reflect real-world friction.
    • Data handling Fetches market data via yfinance or processes local CSV files.
    • Visualization Generates equity curve charts and exports bar-by-bar results for further analysis.

    How it works

    1. Configure inputs Define the ticker, date range, strategy type, and SMA windows.
    2. Set costs Specify the trading cost in basis points to ensure the results aren't artificially inflated.
    3. Execute script The agent runs the easy_backtest.py script with your parameters.
    4. Analyze JSON The agent parses the structured JSON output and compares the strategy to the benchmark.

    Frameworks & tools

    The skill relies on a self-contained Python 3.10+ environment using pandas and numpy for calculations, yfinance for data retrieval, and matplotlib for plotting.

    Why this beats prompting it yourself

    LLMs frequently hallucinate financial calculations or ignore the compounding effect of trading costs. This skill uses a fixed, auditable script to ensure every return, drawdown, and Sharpe ratio is mathematically sound and consistent across runs.

    Use cases

    • Compare 20/50 SMA vs 50/200 SMA performance on SPY over a decade.
    • Determine if a trend-following rule outperforms buy-and-hold after 5bps costs.
    • Validate custom price data from a CSV against standard moving average rules.
    • Stress-test a strategy's volatility and max drawdown during specific market regimes.

    Known limitations

    Supports only long-only positions without leverage or shorting. Limited to single-asset backtests and SMA-based indicators. Trading costs are flat fees and do not account for slippage or taxes.

    How to use

    1. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 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

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 10 days ago

    • Free with an Agensi account

    Software
    Python

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Listed10 days ago

    What's inside

    Frequently Asked Questions

    The skill provides a specialized Python environment that executes a fixed, auditable backtesting script, preventing the mathematical hallucinations and cost-modeling errors common when asking LLMs to calculate returns manually.

    Yes, while the skill defaults to fetching data via yfinance, you can provide your own local CSV files to test proprietary data or assets not listed on major exchanges.

    This skill is designed for single-asset, long-only SMA strategies; it currently does not support short selling, margin trading, or multi-asset portfolio rebalancing.

    The skill applies a configurable basis-point fee to every trade, ensuring that the performance metrics reflect the real-world impact of commissions and exchange fees rather than 'perfect' theoretical returns.

    You receive the production-ready Python backtesting environment, the core execution script, and pre-configured templates for SMA crossovers and buy-and-hold benchmarking.

    The skill is compatible with any AI agent platform that supports Python 3.10 execution environments and has access to standard libraries like pandas and matplotlib.

    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.

    Free