Backtest Engine#
A professional-grade portfolio backtesting framework built on PyArrow for high-performance columnar data processing. Designed for quantitative analysts, portfolio managers, and researchers who need realistic, reproducible simulations of portfolio strategies with institutional-level cost modeling.
Configurable via Excel or programmatic dict/YAML
Flexible data ingestion — reads CSV and Parquet market data with user-defined column names
Dates in ``YYYY-MM-DD`` format — rebalancing runs on the exact date listed in the portfolio file (not t+1), using that day’s prices
Realistic cost modeling — separate prices for execution, commission calculation, and mark-to-market valuation
Multi-variation testing — run parameter sweeps (commission, capital, cash reserve, date windows) loading data once
Batch testing — auto-discover and backtest every portfolio in a directory with a shared market data pool
Comprehensive reporting — Excel reports with CAGR, Sharpe, Sortino, Alpha, VaR, CVaR, Max Drawdown, annual returns, drawdown analysis, and portfolio weights
Interactive dashboard — cumulative returns vs. benchmark, composition charts, drawdown visualization, and returns distribution
Installation#
pip install kaxanuk-backtest-engine --extra-index-url https://license:{YOUR_LICENSE_KEY}@{SERVER}/simple/
Note
The full command with your license key is included ready to copy in the welcome email you receive after purchase.
You can acquire your license here.
Interested in collaborating on a custom project? Get in touch at software@kaxanuk.mx.
Check the official release on PyPI for the latest version.
What’s new in 0.58.x#
Headlines from the recent 0.58.x release line:
Breaking. Environment variable renamed from
KNPC_API_KEY_KAXANUKtoKNBE_API_KEY_KAXANUK. UpdateConfig/.envafter upgrading.New.
arrow_to_pandas_for_analysis()helper converts apyarrow.Tablereturned by the backtester into apandas.DataFramewith plot- and analysis-friendly dtypes (float64/datetime64[ns]), bypassing theobject-dtype surprises of rawdecimal/date32columns.Fixed. Embedded benchmark charts no longer show a spurious vertical line at 1970-01-01; the issue was traced to a
RangeIndexbeing coerced as nanoseconds-since-epoch.Fixed.
MultiPortfolioBacktester.generate_individual_reportsnow sets the benchmarkDatetimeIndexfrom the canonical date column instead of a literal that did not exist, fixing the Max Drawdown Date and the annual-returns table of the benchmark.Fixed. Clearer errors when
portfolio_directoryresolves to zero portfolios, and whenexecution_price(removed in v0.57.0) still appears in a batch config — both surface now instead of failing silently.
See the Changelog for the full changelog.
Discover the fundamentals of the Backtest Engine, learn how to configure your environment, and explore the essential features to get started quickly.
Dive into the comprehensive API documentation, including modules, components, execution models, and public interfaces.
Understand the assumptions and calculations behind the engine: price roles, execution model, cash reserve logic, daily valuation, and performance metrics.
Browse the full history of changes, improvements, fixes, and new features across releases.