Skip to main content

Production-ready event-driven backtesting framework with institutional-grade analytics

Project description

Simulor

Simulor is a sophisticated backtesting framework designed for quantitative traders and researchers who demand institutional-grade realism and performance. Built on an event-driven architecture with pluggable components, it seamlessly transitions from historical backtesting to paper trading and live execution.

Key Features

  • Event-Driven Architecture: True event-driven simulation with point-in-time data delivery, multiple resolutions (tick/minute/hour/daily), and compositional data structures
  • Pluggable Strategy Components: Modular alpha models, portfolio construction, risk management, execution models, and universe selection. Swap components without rewriting strategy logic
  • Institutional-Grade Execution: Realistic fill models, transaction costs (commissions, spreads, slippage, market impact), T+0 settlement, and corporate actions handling
  • Comprehensive Analytics: Performance metrics (Sharpe, Sortino, Calmar), risk analysis (VaR, CVaR, beta), trade statistics, and interactive Plotly visualizations
  • Environment Parity: Same strategy code runs in backtest, paper trading, and live execution modes. Seamless transition from research to production

Installation

pip install simulor

Quick Start

from decimal import Decimal
from pathlib import Path
from simulor import (
    Strategy, Engine, Fund,
    MovingAverageCrossover, EqualWeight, PositionLimit, Immediate, Static,
    CsvFeed, SimulatedBroker, Resolution, Instrument, Tearsheet
)

# Define strategy with pluggable components
# Workflow: Universe Selection -> Alpha Model -> Portfolio Construction -> Risk Management -> Execution
strategy = Strategy(
    name='MA_Crossover',
    universe=Static([
        Instrument.stock('SPY'),
        Instrument.stock('QQQ'),
        Instrument.stock('IWM')
    ]),
    alpha=MovingAverageCrossover(fast_period=10, slow_period=20),
    construction=EqualWeight(),
    risk=PositionLimit(max_position=Decimal('0.1')),
    execution=Immediate()
)

# Run backtest
engine = Engine(
    data=CsvFeed(path=Path('data/bars.csv'), resolution=Resolution.DAILY),
    fund=Fund(
        strategies=[strategy],  # Add more strategies as needed
        capital=Decimal('100000')
    ),
    broker=SimulatedBroker()
)
results = engine.run(
    start='2020-01-01',
    end='2025-12-31',
    mode='backtest'
)

# Analyze results
print(f"Total Return: {results.total_return:.2%}")
print(f"Sharpe Ratio: {results.sharpe_ratio:.2f}")
print(f"Max Drawdown: {results.max_drawdown:.2%}")

# Generate tearsheet
tearsheet = Tearsheet(results)
tearsheet.save('tearsheet.html')

Roadmap

v0.1.0

  • Event-driven engine with CSV data provider
  • Pluggable strategy framework
  • Basic execution (InstantFill, SpreadFill)
  • Core analytics (returns, Sharpe, drawdown)
  • Simple transaction costs

v0.2.0+ (Planned)

  • Parquet data provider and advanced data layer features
  • History API with type-safe lookback
  • Advanced fill models (L2 matching, probabilistic)
  • T+2 settlement and realistic cash management
  • Overfitting detection (WFA, PBO, CSCV)
  • Advanced analytics (execution quality, attribution)
  • ML integration and model registry
  • Broker integrations for live trading

Acknowledgments

Simulor implements the industry-standard modular pipeline architecture (Universe Selection → Alpha Generation → Portfolio Construction → Risk Management → Execution). This separation of concerns allows for maximum flexibility, testability, and maintainability, similar to the architecture found in institutional quantitative systems and platforms like Lean.

Contributing

Contributions are welcome!

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simulor-0.1.0a1.tar.gz (78.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simulor-0.1.0a1-py3-none-any.whl (94.5 kB view details)

Uploaded Python 3

File details

Details for the file simulor-0.1.0a1.tar.gz.

File metadata

  • Download URL: simulor-0.1.0a1.tar.gz
  • Upload date:
  • Size: 78.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for simulor-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 e3cf64ee76ee6717a368908d599d55c1d04519f1dce0fc6c27d54bf00883f45c
MD5 35a25ec955ffc9bcce9ec02a702e30db
BLAKE2b-256 082ef379c8a668fac8549c7bdc85d2d8fe8a4164035cbaf402110673400277ae

See more details on using hashes here.

File details

Details for the file simulor-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: simulor-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 94.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for simulor-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a10f9867afdfb78ab1632341a823a14a7d848f41ddf9ec37ba53cfd8f4b29ba
MD5 85b45afb0dca78872c6ed3e6ee21e285
BLAKE2b-256 7ec198359f368fa88d2ce203e596aba879df344757075a6f2f997cf2eea3dbb6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page