backtesting-frameworks

Build event-driven and vectorized backtesting systems for trading strategies in Python.

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill backtesting-frameworks-sanketadlak
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backtesting-frameworks
Source: https://github.com/SanketAdlak/PDMProjectDesign/tree/main/.agents/skills/backtesting-frameworks
Command: npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill backtesting-frameworks-sanketadlak

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pandas, numpy.

What problem does it solve? Trading strategies often fail in live markets because backtests suffer from look-ahead bias, survivorship bias, overfitting, and unrealistic transaction cost assumptions. This Skill provides implementation patterns for building backtesting systems that produce trustworthy performance estimates. ## Core Features & Use Cases - Event-Driven Backtester: Full order, fill, position, and portfolio simulation with slippage and commission modeling using Decimal precision. - Vectorized Backtester: Fast pandas/NumPy-based backtesting for simple signal strategies with automatic cost deduction and metrics. - Walk-Forward Optimization: Anchored or rolling train/test splits with grid search to prevent overfitting. - Monte Carlo Analysis: Bootstrap resampling to estimate drawdown distributions, probability of loss, and return confidence intervals. - Use Case: You have a momentum strategy idea. Use the vectorized backtester for a quick sanity check, then validate it with walk-forward optimization and Monte Carlo drawdown analysis before committing capital. ## Quick Start Ask the AI to build a walk-forward backtest for a moving-average crossover strategy on your OHLCV price data with realistic transaction costs.

Frequently Asked Questions about backtesting-frameworks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I backtest a trading strategy in Python?

Use a vectorized backtester with pandas for fast signal-based strategies, or an event-driven backtester for realistic order and fill simulation. Always shift signals by one bar to avoid look-ahead bias and deduct commission plus slippage from returns.

What is walk-forward analysis in backtesting?

Walk-forward analysis splits historical data into sequential train and test windows, optimizing parameters on each training window and validating on the following unseen test window. It prevents overfitting better than a single train/test split by simulating realistic re-optimization over time.

How do I avoid look-ahead bias in a backtest?

Avoid look-ahead bias by using point-in-time data and shifting signals so trades execute on the bar after the signal is generated. In vectorized backtests, apply .shift(1) to signals before multiplying by returns.

Event-driven vs vectorized backtesting, which should I use?

Vectorized backtesting is fast and suits simple signal-based strategies on a single instrument. Event-driven backtesting is slower but models orders, fills, positions, and cash accurately, making it better for multi-asset portfolios and complex order types.

Why does my backtest show great returns but fail in live trading?

Common causes include overfitting parameters to historical data, ignoring transaction costs and slippage, and survivorship bias from testing only on securities that still exist. Use out-of-sample testing, Monte Carlo simulation, and realistic cost models to detect these issues.

How do I estimate maximum drawdown risk with Monte Carlo simulation?

Monte Carlo drawdown analysis bootstraps historical returns by resampling them with replacement across thousands of simulations, then computes the maximum drawdown of each simulated equity curve. The result is a distribution showing expected, median, and worst-case drawdowns.