qis documentation¶
Author: Artur Sepp / First recorded: 2026-07-25
Implemented in qis — Quantitative Investment Strategies. Software citation: CITATION.cff.
qis is for quantitative portfolio managers, researchers and investors who analyse portfolio
performance and backtest investment strategies. Reported results can differ when return
frequency, risk-free-rate treatment and rebalancing conventions are left unstated. The library
makes those conventions explicit and uses shared calculations across analytics, backtests and
reports.
qis — Quantitative Investment Strategies is a Python library for performance analytics, portfolio backtesting, risk analysis and factsheet reporting. It works with price and NAV time series and externally constructed portfolio weights. These guides explain the methods, calculation conventions and runnable examples behind its reports.
Versions and compatibility¶
Use stable documentation for a released package and latest documentation for main. Stable can lag the newest PyPI release: compare the site’s build version with your installed version. Latest can describe unreleased work. Channel links lead to the home page because an individual page may not exist in both versions.
The core chart, backtest, factsheet and risk examples below support qis>=5.37.0.
Native factor-unit and observed-index stress workflows require qis>=5.38.1.
The current FX workflow uses qis>=6.0.0: the qis.fx namespace, typed returns,
exact notional payoffs, monthly cash measurement and explicit account financing. Factor-price
inputs live in qis.portfolio.risk.factors_data. The holdings-alpha coverage example also
requires qis>=6.0.0. See the
FX migration guide
for removed interfaces and saved-checkpoint migration.
These are verified support floors, not claims about when each API first appeared. Obtain repository-only scripts from the matching release or the source revision cited by a guide; main may contain later additions.
Capability |
Minimum supported release for these examples |
|---|---|
Offline charts, held-unit backtests and factsheets |
|
Ex-ante/ex-post risk and tracking-error workflows |
|
Native factor-unit and observed-index stress workflows |
|
Current FX workflow, common monthly cash and holdings-alpha coverage |
|
The PyPI classifier remains Beta. It does not promise that every exported helper has a frozen signature. The generated API reference distinguishes the core API from other exports. The compatibility policy requires changelog and version treatment for public API/default changes, introduces replacements when practical, and documents urgent corrections. It promises no fixed deprecation period.
QIS source is MIT licensed. Optional dependencies retain their own licences; installing an extra does not change them.
Each successful HTML build also emits llms.txt and llms-api.txt. The page notice links
them. They are generated by the existing Sphinx indexing extension from discovered canonical
pages and the API producer’s verified export contract; no second API list is maintained.
Start here¶
Install qis. The core installation command is
python -m pip install qis.Follow the offline quickstart for a first chart, portfolio backtest, performance table and benchmark-relative results.
Browse the factsheet gallery to choose a report, and read Notation and conventions before interpreting or comparing results.
How reliable is a strategy’s performance? The default Performance confidence and stability page shows 95% confidence intervals for the Sharpe ratio and for holdings-weighted alpha relative to the first supplied benchmark. Strategy-versus-benchmark reports show the paired difference in Sharpe ratios and marginal alpha. Multi-strategy reports compare each alternative with a base portfolio and report Holm-adjusted p-values for those comparisons.
After installation, the quickstart calculations use fixed synthetic data without network access
or optional extras. The complete portfolio workflow lives in
examples/getting_started/offline_quickstart.py.
The quickstart page includes that source and provides links for Markdown viewers.
The qis analytics handbook¶
The methodology chapters form one book. Each chapter defines its method with formulas and concise proofs, states its conventions in a seven-row convention card, works a small example whose numbers the test suite checks, and links to the functions that implement it. Symbols keep one meaning throughout; see Notation and conventions and the bibliography.
Part I: Foundations¶
Notation and conventions: reserved symbols, simple and log returns, per-annum returns, annualisation, excess returns and timing.
Returns, NAVs, excess returns, fees and leverage: from prices to returns and back, cash-rate deduction, fee crystallisation and levered returns.
Reporting frequency and annualisation: sampling grids, the variance ratio and interpretation of reported statistics.
Incomplete and mixed-frequency data: missing observations, instrument lifetimes and differing reporting schedules.
Part II: Performance measurement¶
The performance-statistic catalogue: one formula for every column of the performance table.
Sharpe ratios: conventions and inference: the Sharpe conventions of qis, the volatility drag between them and their sampling error.
Drawdowns and time under water: running and maximum drawdowns, episodes, Calmar ratios and the strategy’s return during benchmark drawdowns.
Alpha, beta and benchmark-relative performance: the single-index regression, alpha inference, EWMA betas and beta attribution.
Regime-conditional performance: benchmark regimes and the additive decomposition of the Sharpe ratio.
The convexity premium and smart diversification: Gaussian and Student-t nulls of the regime contributions, the convexity premium, its aggregation across a portfolio, overlay frontiers and regime betas.
Part III: Estimation¶
Exponentially weighted estimators: spans, half-lives, effective sample sizes, initialisation and EWM volatility and covariance.
Covariance, correlation and principal components: estimation, masking, eigen-decomposition and the noise floor.
Serial dependence and autocorrelation: autocorrelation functions, their standard errors and lagged betas.
Regression and HAC inference: OLS and EWMA regressions with heteroskedasticity- and autocorrelation-consistent standard errors.
Factor and backtest significance: the catalogue of hypothesis tests in qis; mean, alpha and paired Sharpe families, Holm/BHY corrections, bootstrap p-values and qualification limits.
Resampling and the bootstrap: IID, block and stationary bootstraps, and what an unstated sampling convention costs.
Private-asset unsmoothing: serial correlation, return reconstruction and de-levering.
Part IV: Portfolios¶
Self-financed FX accounting: local debt, collateral cash, hedge rolls, fixing, settlement and exact monetary reconciliation. The liquidity example follows free cash through a margin call and a delayed asset sale.
Portfolio backtesting: decisions, execution timing, held units and portfolio histories.
Turnover conventions: traded notional, transaction costs and turnover reporting.
Risk-adjusted returns and volatility targeting: scaling returns by lagged volatility estimates and what targeting does to realised risk.
Signal diagnostics: information coefficient and information ratio: rank correlations of signals with forward returns and their aggregation.
Part V: Risk¶
The risk monitoring guide maps everyday monitoring questions to the chapters below and computes a point-in-time risk snapshot of one portfolio.
Portfolio risk and Euler contributions: marginal, total and relative risk contributions and their grouping.
Gaussian Monte Carlo VaR and benchmark risk: supplied-covariance loss quantiles, VaR ratios, beta and tracking error, including the one-year tail-risk Appendix.
Factor risk models: EWMA factor models, betas, residual risk and the model covariance.
Tracking error and benchmark-relative risk: ex-ante risk estimates and realised tracking error and information ratio.
Portfolio breadth: effective instrument counts and concentration.
Factor stress testing: specified factor shocks, valuation changes and prediction bands.
Instrument portfolios and stress reports: funded assets, options and futures in one stress interface.
Stress testing with options: five stocks, ten short VOP-priced options and a four-ETF EWMA risk model.
Part VI: Currency returns, hedging and accounting¶
Multi-currency portfolio P&L in Python: an offline workflow covering four return views, common monthly cash, signed local financing, hedge resets and settlement.
Return conventions and FX adjustments: typed return coordinates, dated cash/hedge metadata and optional index normalization.
Self-financed FX accounting: signed holdings, financing balances, contract fixing and cash settlement.
FX hedging and market data: currency conversion, hedging assumptions and data contracts.
Reference-currency conversion and excess returns: multi-currency universes, partial hedges and log-excess inputs for MATF estimation.
Cash rate timing and FX adjustments: separate spot, hedge-carry and excess-return timing, with an empirical cash-index comparison.
Hedged index replication: observed CHF, EUR and GBP index comparisons, distinguishing close monthly fit from persistent compounded-return differences.
Unhedged index replication: paired scatterplots using supplied spot FX and different-family index-implied FX, with explicit diagnostic limitations.
Part VII: Attribution¶
Brinson attribution: allocation, selection and interaction effects against a benchmark. The factsheet reconciliation shows how merging interaction into selection preserves the total active return.
Model-layer attribution: risk, signal and integration layers, with factor and feature contribution methods.
Reporting guides¶
Factsheets and reporting: inputs, report types and the calculation conventions used by the reporting workflow.
Factsheet reference: call patterns, configuration, output objects and PDF saving.
Factsheet gallery: the four report types on fixed synthetic data.
Reference¶
API reference: function and class documentation. Public API source catalog.
Bibliography: every work cited by the handbook, in one style.
Software design: module ownership, public API and dependency boundaries.
Package comparison: documented workflows in qis and related libraries.
Migrating from pyfolio-reloaded and migrating from QuantStats: tear sheets, statistics and plots mapped to qis, with the conventions that make the numbers agree or differ.
API migration history: renamed and removed symbols, with current module imports.
Documentation standard: article, equation, citation and figure rules.
The following compact notes also ship with the Python package. Site builds render them alongside the articles; the source links remain usable when reading this page in a checkout.
Convention |
Site note |
Packaged source |
|---|---|---|
Sharpe ratios |
||
Reporting grids |
||
Plot styling |