canopy-lang

Canopy

A domain-specific language for trading strategy development and backtesting.

⚠️ Alpha release — data provider adapters coming soon.

pip install canopy-lang

What's in the box

Intuitive DSL

Express strategies in a clear, Python-like syntax.

Backtest Engine

Vectorized walk-forward with Sharpe, Sortino, MDD.

Portfolio Mode

Multi-asset backtesting and portfolio construction.

Optimizers

Bayesian, Genetic, and Grid Search parameter tuning.

alpha evaluation

Buyer readiness

Canopy is suitable for early commercial review when the buyer controls data sourcing, execution environment, and validation. The site is static and does not add forms, account workflows, backend services, or payment flows.

Buyer personas

Quant researchers, fintech product teams, and engineering leads can evaluate Canopy as a local DSL for strategy research and backtest experiments before committing to a hosted or regulated workflow.

Supported alpha workflows

Install from PyPI, run local backtests with synthetic or caller-provided OHLC data, compare strategy behavior, and review portfolio and optimization examples without setting up a market-data provider.

Compatibility expectations

The README, PyPI install path, and quickstart should stay aligned with the current alpha package. Breaking changes may happen before 1.0, so commercial adopters should review the upstream changelog and test against their own integration constraints.

Non-goals

This static site does not provide market data, hosted notebooks, brokerage access, live execution, managed analytics, compliance certification, support terms, checkout, or account administration.

Upgrade and support assumptions

Treat business adoption as a reviewed integration owned by the buyer. Use public GitHub issues for non-sensitive defects and the security reporting path for vulnerabilities. Commercial support ownership remains pending review; no response-time, uptime, or managed upgrade commitment is published.

Quickstart

Install canopy-lang and run a backtest with synthetic data — no data provider setup required. For commercial review, see the Data boundaries.

quickstart.py
import pandas as pd
import numpy as np
from canopy.domain.timeseries import TimeSeries
from canopy.domain.strategy import MACrossoverStrategy
from canopy.adapters.engines.simple_engine import SimpleBacktestEngine
from canopy.application.run_backtest import RunBacktestUseCase

# Synthetic OHLC
dates = pd.date_range("2024-01-01", periods=252, freq="D")
np.random.seed(42)
close = 100 + np.cumsum(np.random.randn(252) * 2)
ts = TimeSeries(
    open=pd.Series(close - 0.5, index=dates),
    high=pd.Series(close + 1, index=dates),
    low=pd.Series(close - 1, index=dates),
    close=pd.Series(close, index=dates),
    volume=pd.Series([1_000_000] * 252, index=dates),
)

strategy = MACrossoverStrategy(name="SMA 10/30", fast_period=10, slow_period=30)
engine = SimpleBacktestEngine()
use_case = RunBacktestUseCase(engine)
backtest, metrics = use_case.execute(strategy, ts, initial_capital=10000, commission=0.001)

print(f"Sharpe: {metrics.sharpe_ratio:.2f}")
print(f"Return: {metrics.total_return:.2f}%")
print(f"MDD:    {metrics.max_drawdown:.2f}%")

Trading risk

Canopy examples and backtests are for research workflows only. They are not financial advice, and historical or synthetic results do not guarantee live trading performance.