Skip to content

bogdan-ciocoiu/systematic-strategy-research-platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quantitative Research Backtesting Framework

This repository holds a modular, research-grade quantitative backtesting engine designed for scalable hypothesis testing, deterministic execution modelling, and extensible strategy development. I built this project as part of an ongoing quantitative research initiative focused on clean architecture, reproducible research, and production-ready system design.

Purpose

Modern quantitative research demands:

  • Deterministic execution modelling
  • Clear separation of signal logic and execution logic
  • O(N) computational efficiency
  • Modular extensibility
  • Transparent assumptions
  • Reproducibility

I built this framework to support 100+ independent hypotheses within a scalable object-oriented architecture. It is not a toy backtester - it is a structured research engine.

Design philosophy

The system follows principles inspired by:

  • Object-Oriented Programming (OOP)
  • Domain-Driven Design (DDD)
  • MVC separation of concerns
  • Modular strategy injection via Protocol interface
  • Deterministic modelling to avoid look-ahead bias

Architectural goals

  • No iterrows()
  • No DataFrame concatenation inside loops
  • O(N) time complexity
  • Precomputed indicators
  • Strict bracket order modelling
  • Clean separation between:
  • Signal generation
  • Execution modelling
  • Performance analytics

Architecture overview

 ┌──────────────────────────────────────┐
 │ Strategy layer (EntryTrigger)        │
 │  - SMACrossover                      │
 │  - SMA + RSI                         │
 │  - (100+ WIP hypotheses)             │
 └──────────────────┬───────────────────┘
                    |
                    ▼
 ┌──────────────────────────────────────┐
 │ BracketBacktester (execution engine) │
 │  - Deterministic SL                  │
 │  - Deterministic TP                  │
 │  - Long/short logic                  │
 │  - O(N) evaluation                   │
 └──────────────────┬───────────────────┘
                    │
                    ▼
 ┌──────────────────────────────────────┐
 │ PerformanceReport (analytics engine) │
 │  - CAGR                              │
 │  - Sharpe                            │
 │  - Max drawdown                      │
 │  - Profit factor                     │
 │  - Holding period                    │ 
 │  - 30+ metrics (WIP)                 │
 └──────────────────────────────────────┘

Execution model

The execution engine (see backtester.py) follows strict deterministic assumptions:

  1. Signal generated at bar close.
  2. Entry occurs at the close of the signal bar.
  3. Stop-loss and take-profit set immediately.
  4. Exit evaluation begins from the next candle.
  5. If price action hits both SL and TP in the same candle, then SL is assumed first.

The above logic avoids:

  • Intrabar look-ahead bias
  • Unrealistic fill assumptions
  • Optimistic execution modelling

Modular strategy injection

Strategies implement the EntryTrigger Protocol:

class EntryTrigger(Protocol):
 def prepare(self, data: pd.DataFrame) -> None: ...
 def should_enter(self, index: int) -> Tuple[bool, str, str]: ...

Examples included:

  1. SMA crossover (see sma_crossover.py)
  2. SMA + RSI filter (see sma_rsi_trigger.py)

This engine allows scaling to:

  • 100+ independent hypotheses
  • Regime filters
  • Multi-indicator composites
  • Volatility filters
  • Market structure filters
  • Machine learning-driven signals

Performance analytics

The analytics module (performance) computes:

  1. CAGR
  2. Sharpe Ratio
  3. Max Drawdown
  4. Profit Factor
  5. Number of Trades
  6. Average Holding Period

The analytics layer is intentionally separated from execution logic to support:

  1. Alternative return aggregation methods
  2. Portfolio-level analysis
  3. Multi-asset aggregation
  4. Walk-forward testing

Example usage

from backtester import BracketBacktester
from sma_crossover import SMACrossoverTrigger

trigger = SMACrossoverTrigger(fast_window=5, slow_window=50)
BracketBacktester("AAPL").run(trigger)

See example runner: main.py

Scalability

I intentionally designed this framework to scale:

Strategy layer

  • Unlimited hypothesis classes
  • Clean injection interface
  • Indicator precomputation per strategy

Execution layer

  • Constant memory footprint
  • Numpy-based loop
  • No row iteration overhead

Future scalability targets

  • Multi-asset portfolio engine
  • Concurrent strategy evaluation
  • Cross-sectional signal ranking
  • Factor library integration
  • Walk-forward validation
  • Parameter sweep optimisation
  • Monte Carlo robustness testing

Roadmap (planned extensions)

This system is structured to support:

Risk management enhancements

  • Trailing stop-loss
  • Volatility-adjusted SL/TP
  • Multiple take-profit targets
  • Time-based exits
  • Position sizing models (Kelly, volatility parity)
  • Portfolio-level risk constraints

Execution improvements

  • Commission modelling
  • Intrabar interpolation modelling

Analytics enhancements

  • Sortino ratio
  • Calmar ratio
  • Omega ratio
  • Trade expectancy
  • Equity curve resampling
  • Bootstrap Sharpe confidence intervals

Research enhancements

  • Hyperparameter grid search
  • Bayesian parameter optimisation
  • Regime classification filters
  • Feature engineering pipeline
  • ORM integration for database storage
  • REST API interface layer
  • CLI interface

Software engineering standards

The system follows:

  • Strong OOP design
  • Strategy pattern via Protocol
  • Separation of concerns
  • Deterministic modelling
  • Clean domain boundaries
  • Reproducible research outputs
  • Timestamped logs and dataset snapshots

It is intentionally structured to support migration toward:

  • Full MVC architecture
  • ORM-backed persistence layer
  • Distributed compute execution
  • Cloud-native deployment

Assumptions

  • No slippage
  • No commissions
  • No partial fills
  • Single position at a time
  • Fully allocated capital per trade
  • Deterministic exit ordering

About

This framework is part of an ongoing quantitative research initiative.

Disclaimer

This software is provided for research and educational purposes only. It does not constitute financial advice.

Attribution and usage

This framework is released under the MIT License to encourage open research and systematic strategy development.

If you use, extend, or build upon this work in academic research, production systems, or derivative frameworks, citation of the original repository is appreciated:

Final note

This repository represents an evolving quantitative research engine built with scalability and production-grade architecture in mind. The objective is not simply to backtest strategies - but to build a structured, extensible research platform capable of supporting institutional-level systematic strategy development.

About

This repository holds a modular, research-grade quantitative backtesting engine designed for scalable hypothesis testing, deterministic execution modelling, and extensible strategy development. I built this project as part of an ongoing quantitative research initiative focused on clean architecture and production-ready system design.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages