Skip to content

Repository files navigation

Crypto Backtesting & Paper-Trading Engine

A modular research and execution environment for testing cryptocurrency strategies before any real capital is involved.

The project combines chronological backtesting, shared-capital portfolio simulation, explicit execution costs, paper trading, and a separate risk layer behind a common strategy interface.

The problem

A strategy can look profitable when each symbol receives its own capital, fills are assumed to be free, or risk controls are mixed into signal logic. Those assumptions make backtests difficult to trust and difficult to reproduce in paper trading.

This engine separates the major responsibilities:

Market data -> Strategy signals -> Risk checks -> Broker execution
                                      |
                                      v
                      Position sizing and portfolio caps
                                      |
                                      v
                      Reports, storage, and monitoring

What is included

  • Chronological single-symbol and multi-symbol backtesting
  • Shared-capital portfolio simulation from one cash pool
  • Explicit fees, slippage, and execution assumptions
  • Strategy interface shared by backtest and paper-trading flows
  • Independent risk engine for sizing, exposure caps, and kill-switch controls
  • Binance spot market-data integration
  • SQLite persistence for orders, trades, portfolio state, and system events
  • Read-only terminal dashboard and structured run-level logging
  • YAML configuration validated before execution

Design priorities

  • No look-ahead: decisions are made only from information available at that point in time.
  • Shared capital: symbols compete for one portfolio rather than receiving artificial independent balances.
  • Explicit costs: execution assumptions are visible in the simulation.
  • Risk separation: signal generation does not silently bypass portfolio constraints.
  • Safe default: live trading is outside the current MVP and disabled by configuration.

Quick start

py -m venv .venv
.venv\Scripts\python -m pip install -e .[dev]

.venv\Scripts\python scripts\download_market_data.py
.venv\Scripts\python scripts\run_backtest.py
.venv\Scripts\python scripts\run_portfolio_backtest.py
.venv\Scripts\python scripts\run_paper_trading.py --once

This project is research software, not financial advice. No profitability claim is made.

Stack

Python, pandas, Pydantic, SQLite, Binance REST APIs, YAML, Rich, and pytest.

Documentation

About

Modular crypto backtesting and paper-trading engine with shared-capital simulation, explicit execution costs, and independent risk controls.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages