API reference

Author: Artur Sepp / First recorded: 2026-07-25.

Implemented in qis — Quantitative Investment Strategies. Software citation: CITATION.cff.

Public means exported from src/qis/__init__.py. This page is regenerated on every build, so it cannot drift from the exports.

The reference is in two parts. The core API is the documented surface: every symbol there carries an Args or Attributes block, and the boundary is drawn by measured usage - a symbol is core when a package that depends on qis, or qis’s own examples and documentation, call it. src/qis/tests/test_core_api.py enforces that. Also exported lists everything else that can be imported: usable, but with no prose promise and no stability guarantee beyond the CHANGELOG.

Grouping in the core section is by capability rather than by defining module, so moving a symbol between subpackages costs no documentation change.

Core API

Instrument portfolio stress

28 symbols.

Methodology: Instrument portfolios and standard stress reports, Stress testing with options.

qis.FactorGroupSpec

Named factor family with an explicit total-bump allocation.

qis.HoldingPayoff

Public extension for a composite valued in reference currency.

qis.InstrumentLeg

A signed primitive valued in its underlying's quote currency.

qis.InstrumentPortfolio

An absolute-position snapshot referencing the canonical QIS risk model.

qis.InstrumentType

Supported primitive payoffs.

qis.KinkPolicy

One-sided quote derivative used consistently across a holding's legs.

qis.PayoffContext

Read-only labelled market view for public composite payoff implementations.

qis.PortfolioHolding

Original position identity with an observed reference-currency mark.

qis.PortfolioStressResult

Computed report inputs, detached from live portfolio/model objects.

qis.PortfolioValuationResult

Evaluated scenario values with explicit source-mark and model anchors.

qis.ResponseBasis

Currency basis of the fitted response.

qis.ScenarioMode

Policy for factors which a request leaves unspecified.

qis.ShockConvention

Explicit units of requested factor or family bumps.

qis.StressScenarios

Requested factor/family anchors with explicit completion and return units.

qis.StressTestConfig

Numerical analysis settings with explicit covariance horizon.

qis.Underlying

An actual quote with a possibly shared fitted response.

qis.run_portfolio_stress_test

Revalue requested, conditional, historical and grid shocks through one portfolio.

qis.StressReportArtifacts

Paths written by a report operation; the numerical result remains reusable.

qis.StressReportConfig

Presentation options and caller-supplied estimation diagnostics.

qis.generate_portfolio_stress_report

Render a completed result without fitting or re-evaluating any payoff.

qis.PortfolioAccounting

Reconciled reference-currency account ledger, independent of fitted coverage.

qis.PositionRole

Declared accounting role; negative marks alone do not identify borrowing.

qis.ReportingBasis

Accounting meaning of the denominator used for report ratios.

qis.ResponseProvenance

Caller-owned response construction facts; reporting never alters the series.

qis.HistorySource

Declared origin of a fitted response history.

qis.ReturnBasis

Return convention of a supplied fitted response.

qis.HistoricalScenarioSelection

Select the worst monthly returns of a named factor and replay full vectors.

qis.AccountAssetClass

Caller-assigned account allocation buckets, separate from risk factors.

Performance statistics

19 symbols.

Methodology: The performance-statistic catalogue, Sharpe ratios: conventions and inference, Drawdowns and time under water, Alpha, beta and benchmark-relative performance, Returns, NAVs, excess returns, fees and leverage, Signal diagnostics: information coefficient and information ratio, Two-sided turnover conventions.

qis.PerfParams

sampling frequencies and conventions for risk-adjusted performance statistics.

qis.PerfStat

the column set of every performance table in qis.

qis.compute_ra_perf_table

Compute the full risk-adjusted performance table.

qis.get_ra_perf_columns

risk-adjusted performance statistics as a table of formatted strings, ready to render.

qis.compute_asset_returns_dict

Compute returns for assets grouped by frequency.

qis.to_returns

Convert prices to returns with specified methodology.

qis.returns_to_nav

Convert returns to NAV time series.

qis.delever_returns

Recover unlevered asset-level returns from levered portfolio returns.

qis.implied_leverage

Estimate the implicit leverage ratio between two return series via OLS.

qis.interpolate_infrequent_returns

backfill an infrequently reported series onto a frequent grid with a Brownian bridge.

qis.SignalDiagnosticsResult

Container for cross-sectional signal diagnostic outputs.

qis.estimate_ic_ir

IC information ratio per horizon — the time-series counterpart to the pooled IC in pooled_universe.

qis.estimate_signal_diagnostics

Cross-sectional predictive regression of forward returns on lagged signal.

qis.TurnoverComputationType

Select the holdings and denominator used to compute two-sided turnover.

qis.compute_turnover

Compute per-instrument two-sided turnover before resampling or rolling aggregation.

qis.SharpeDiffTest

Annualised arithmetic Sharpe difference and paired HAC inference.

qis.sharpe_difference_test

Test equal arithmetic Sharpe ratios on paired periodic returns with HAC.

qis.compute_sharpe_difference_table

Compare every non-base portfolio with one base on a common return sample.

qis.plot_sharpe_difference_table

Draw a two-decimal HAC Sharpe comparison table and return its numeric data.

Portfolio and backtesting

16 symbols.

Methodology: Portfolio backtesting: targets, held units, and implementation, Self-financed FX accounting, Portfolio risk and Euler contributions, Factor risk models, Tracking error and benchmark-relative risk, Portfolio breadth and allocation efficiency.

qis.FxAccountSpec

Explicit financing, collateral and sizing choices for an FX account.

qis.FxAccountData

Owned account histories and event receipts, in explicit monetary units.

qis.backtest_fx_account

Run a self-financed cash ledger for signed cash equities and cash-settled FX forwards.

qis.backtest_model_portfolio

simulate a rebalanced portfolio from prices and target weights.

qis.generate_static_weights_schedule

turn a fixed allocation into a rebalancing weight frame over the live universe.

qis.PortfolioData

the contract every portfolio in the stack satisfies, and the input to the factsheet layer.

qis.MultiPortfolioData

several portfolios reported together, against a common benchmark.

qis.RiskModel

Dated covariance matrices with an optional point-in-time factor block.

qis.FactorsData

tradable factor price levels, optionally validated against a factor-set descriptor.

qis.compute_portfolio_risk_contributions

Computes the risk contribution of each asset to the portfolio's total risk.

qis.compute_portfolio_risk_contribution_ratios

Compute normalized Euler risk contributions that sum to one.

qis.compute_group_portfolio_risk_contribution_ratios

Aggregate normalized Euler risk contributions over supplied groups.

qis.EwmLinearModel

linear factor model with exponentially weighted time-varying loadings.

qis.compute_ewma_realised_tracking_error

Compute annualised EWMA realised (ex-post) tracking error from NAVs.

qis.PortfolioBreadthResult

Container for portfolio-breadth statistics and their numerical audit trails.

qis.compute_portfolio_breadth

Compute point-in-time universe, capital and risk breadth on target-weight dates.

Factor stress testing

11 symbols.

Methodology: Factor stress testing: shocks, valuation and prediction bands.

qis.FactorScenarioProjection

Exact asset valuation and additive attribution of a log-factor scenario.

qis.ConditionalScenarioBand

Pointwise Gaussian prediction band with fixed baseline portfolio exposures.

qis.FactorSensitivityResult

Joint-anchor grid, exact valuation and analytical band.

qis.price_target_log_shock

Convert positive price endpoints to a log-return shock.

qis.return_log_shock

Convert a simple market return with fixed exposure to a factor log return.

qis.duration_log_shock

Convert a yield change using the first-order duration approximation.

qis.conditional_factor_shock

Condition free log-factor shocks on explicit anchors under a zero-mean model.

qis.conditional_factor_covariance

Compute a Schur complement, retaining full factor order and zero anchor rows.

qis.project_factor_scenarios

Value each asset through expm1 of its frozen log-factor exposure, then aggregate.

qis.compute_conditional_scenario_band

Compute analytical conditional-factor plus independent-residual prediction bounds.

qis.compute_factor_sensitivity

Run an explicit simple-return grid through joint conditioning, valuation and bands.

Factsheets and reporting

8 symbols.

Methodology: Factsheets and reporting, Performance statistics and reporting frequency.

qis.factsheet

Render the appropriate qis factsheet across a chosen reporting frequency in a single call.

qis.generate_strategy_factsheet

multi-page factsheet for one strategy against a benchmark.

qis.generate_strategy_benchmark_factsheet_plt

factsheet comparing one strategy against one benchmark, as a list of A4 figures.

qis.generate_multi_portfolio_factsheet

factsheet comparing several structurally different strategies, as a list of A4 figures.

qis.plot_exposures_strategy_vs_benchmark_stack

draw strategy and benchmark exposures as two stacked-area panels on a shared scale.

qis.ReportingFrequency

the grid a factsheet is computed on.

qis.fetch_default_report_kwargs

the report keyword arguments for a given reporting frequency and reported span.

qis.FACTSHEET_CONFIG_DAILY_DATA_SHORT_PERIOD

key parameters for report comps and visuals on different time period or data frequency.

EWM estimation

11 symbols.

Methodology: Exponentially weighted estimators, Covariance, correlation and principal components, Risk-adjusted returns and volatility targeting.

qis.MeanAdjType

which mean is subtracted before an EWM second moment is computed.

qis.NanBackfill

how the EWM recursion treats a missing observation.

qis.compute_ewm

exponentially weighted moving average of a t-by-n panel.

qis.compute_ewm_vol

exponentially weighted volatility, or variance when apply_sqrt is False.

qis.compute_ewm_trend_slope

Fit an exponentially weighted linear trend with an intercept, through each row.

qis.compute_ewm_covar_tensor

exponentially weighted covariance matrix at every date, as a 3-d tensor.

qis.compute_ewm_covar_tensor_vol_norm_returns

EWM covariance tensor computed on vol-normalised returns, with the vols returned alongside.

qis.compute_ewm_long_short_filtered_ra_returns

vol-normalise returns, then band-pass them with a long/short EWM filter.

qis.compute_masked_covar_corr

covariance or correlation of a returns panel, computed pairwise over the observed entries.

qis.estimate_rolling_ewma_covar

EWM covariance matrix sampled on a rebalancing schedule, ready for a rolling backtest.

qis.plot_corr_matrix_from_covar

Plot a correlation matrix heatmap with volatilities on the diagonal.

FX analytics

22 symbols.

Methodology: Return conventions and FX adjustments, FX hedging and market-data boundaries, Self-financed FX accounting.

qis.FxReturnType

Economic object, independently of its numerical coordinate.

qis.FxReturnCoordinate

Coordinate with a kind-dependent, explicitly validated meaning.

qis.FxCashAccrual

Cash measurement account, independent of return and hedge frequencies.

qis.FxCashPolicy

Cash accrual policy; quote provenance does not imply provider normalization.

qis.FxIndexNormalization

Explicit synthetic index normalization, not a self-financing account engine.

qis.compute_monthly_cash_index

Sample one ACT/365F cash index with calendar month-end opening resets.

qis.FxAssetReturnsRequest

Asset-panel request with one economic kind and one coordinate.

qis.FxCurrencyReturnsRequest

Currency-panel request, with no invented asset price panel.

qis.FxReturnsData

Owned return values and their economic/timing contract.

qis.compute_fx_returns

Compute typed FX analytics, grouped by cadence, without an automatic NAV.

qis.FxRatesData

FX spot rates and domestic short rates, aligned on a common index.

qis.load_fx_rates_data

read FX spots and domestic short rates from the saved CSV pair.

qis.get_aligned_fx_spots

The FX spot series belonging to each instrument, on the index of its prices.

qis.compute_local_and_fx_return

Decompose an asset's reference-currency return into its local and FX legs.

qis.compute_performance_of_local_ccy_asset_in_reference_ccy

Reference-currency NAV and return of a local-currency asset at a given hedge ratio.

qis.compute_fx_vol_beta

EWMA FX volatility and the asset's beta to the FX leg.

qis.compute_fx_optimal_hedge

Mean-variance optimal FX hedge ratios, plus the carry and beta references.

qis.compute_futures_fx_adjusted_returns

returns of a futures position in a foreign currency, converted to the quote currency.

qis.compute_cash_fx_adjusted_returns

returns of a cash position in a foreign currency, converted to the quote currency.

qis.compute_multi_asset_fx_hedging

Hedging performance metrics for a panel of local-currency assets in a reference ccy.

qis.run_asset_fx_hedging_report

Single-asset FX-hedging tearsheet for a local-currency asset in a reference ccy.

qis.plot_multi_asset_fx_hedging_report

Multi-asset FX-hedging comparison report (heatmap tables).

Regime reporting

1 symbols.

Methodology: Regime-conditional performance, The convexity premium and smart diversification.

qis.BenchmarkReturnsQuantilesRegime

Regime classifier based on benchmark return quantiles.

Bootstrap

5 symbols.

Methodology: Resampling and the bootstrap.

qis.BootstrapType

how observations are resampled.

qis.BootstrapOutput

the shape a bootstrap function returns, which follows from the shape of its input.

qis.generate_bootstrapped_indices

draw resampling indices, without touching any data.

qis.bootstrap_data

resample a series or panel with replacement, preserving the cross-section within each draw.

qis.bootstrap_price_data

resample price levels by resampling their returns and recompounding.

Unsmoothing

3 symbols.

Methodology: Private-asset unsmoothing and de-levering, Serial dependence and autocorrelation.

qis.compute_ar_unsmoothed_prices

Apply rolling EWMA AR(q) unsmoothing to a price panel, optionally mixed-frequency.

qis.unsmooth_returns_ar1_ewma

rolling AR(1) unsmoother; a shim over adjust_returns_with_ar with ar_order=1.

qis.unsmooth_returns_glm

Apply static AR(q) unsmoothing following Getmansky-Lo-Makarov (2004).

Plots

16 symbols.

qis.plot_time_series

plot columns of a DataFrame against its index, with summary statistics in the legend.

qis.plot_prices

plot price or NAV series with performance statistics in the legend.

qis.plot_prices_with_dd

plot price series above their running drawdown, on a shared date axis.

qis.plot_bars

plot columns of a DataFrame as bars, grouped or stacked, one group per index entry.

qis.plot_scatter

x-y scatter with a fitted relationship, optionally split by a grouping variable.

qis.plot_classification_scatter

x-y scatter with the sample split into buckets of x, and a fit within each bucket.

qis.plot_heatmap

draw a DataFrame as a colour-coded table.

qis.plot_qq

quantile-quantile plot of each column against the normal distribution.

qis.plot_df_table

render a DataFrame as a matplotlib table, with optional per-cell colouring.

qis.df_boxplot_by_classification_var

box plots of y within quantile buckets of x.

qis.df_boxplot_by_hue_var

box plots of a wide DataFrame melted into long form, one box per hue value.

qis.LegendStats

which summary statistics the legend prints beside each series name.

qis.set_suptitle

set the figure-level title above all its axes.

qis.plot_portfolio_breadth_history

Plot one portfolio's asset counts and breadth-efficiency ratios through time.

qis.plot_portfolio_breadth_current_comparison

Compare the latest breadth counts and efficiencies of named portfolio layers.

qis.plot_portfolio_breadth_concentration

Plot current cumulative absolute capital and risk-contribution concentration.

Dates, schedules and annualisation

11 symbols.

Methodology: Performance statistics and reporting frequency, Notation and conventions.

qis.TimePeriod

a start and end date, with the conversions and slicing every qis function expects.

qis.get_time_period

the TimePeriod spanned by a frame's index, or by an index directly.

qis.get_time_period_label

the date range of a frame's index, formatted for a chart title or a table header.

qis.generate_dates_schedule

tz-aware schedule of dates spanning a time period at a given frequency.

qis.generate_rebalancing_indicators

boolean rebalancing flags aligned to an observation index.

qis.generate_fixed_maturity_rolls

the roll schedule of a fixed-maturity instrument: for each observation time, the expiry held.

qis.find_upto_date_from_datetime_index

Finds the latest date in the index that is on or before the specified date.

qis.truncate_prior_to_start

slice from start, keeping the last observation before it when start is not an index entry.

qis.get_annualisation_conversion_factor

Get factor to convert between pandas frequencies.

qis.get_annualization_factor

Calculate annualization factor from pandas frequency string.

qis.infer_annualisation_factor_from_df

the number of periods per year implied by a frame's index frequency.

DataFrame utilities

24 symbols.

qis.df_abssum

sum of absolute values of finite entries along axis: sum |x_i|

qis.df_abssum_positive

sum of absolute values of strictly positive finite entries along axis

qis.df_abssum_negative

sum of absolute values of strictly negative finite entries along axis

qis.df_nansum

sum of finite entries along axis

qis.df_nansum_positive

sum of strictly positive finite entries along axis

qis.df_nansum_negative

sum of strictly negative finite entries along axis

qis.df_nansum_clip

sum of finite entries along axis, after clipping the data to [a_min, a_max]

qis.df_nanmean

mean of finite entries along axis

qis.df_nanmean_positive

mean of strictly positive finite entries along axis

qis.df_nanmean_clip

mean of finite entries along axis, after clipping the data to [a_min, a_max]

qis.df_nanmedian

median of finite entries along axis

qis.df_last_row

last row (axis=0) or last column (axis=1); is_nonan takes the last finite value per key.

qis.series_nansum_weighted

weighted sum of finite entries: sum_i w_i x_i, with non-finite terms skipped.

qis.get_group_dict

map each group label to the tickers belonging to it.

qis.set_group_loadings

one-hot loadings of instruments on groups.

qis.split_df_by_groups

split a panel's columns into one frame per group.

qis.df_to_cross_sectional_score

Compute cross-sectional standardized scores (z-scores) for DataFrame or Series.

qis.df_to_equal_weight_allocation

equal weights across the assets observed on each date.

qis.df_to_long_only_allocation_sum1

normalise each row to sum to one after setting negative values to zero.

qis.df_to_weight_allocation_sum1

normalise each row to sum to one.

qis.covar_to_corr

convert a covariance matrix to the corresponding correlation matrix.

qis.np_array_to_df_columns

broadcast a 1-d array down the columns of a frame-shaped array.

qis.fit_multivariate_ols

ordinary least squares of y on the columns of x, with a formatted summary of the fit.

qis.update_kwargs

merge two keyword dictionaries, with the second winning on collisions.

File and figure output

9 symbols.

qis.load_df_from_csv

read one DataFrame from a CSV under the managed path layout.

qis.load_df_dict_from_csv

read a dict of DataFrames, one CSV per key.

qis.load_df_from_excel

read one sheet of an Excel workbook into a DataFrame.

qis.save_df_to_csv

write one DataFrame to a CSV under the managed path layout.

qis.save_df_dict_to_csv

write a dict of DataFrames, one CSV per key.

qis.save_fig

write a matplotlib figure to an image or vector file.

qis.save_figs_to_pdf

write several matplotlib figures to one multi-page PDF, one figure per page.

qis.timer

decorator printing the wall-clock runtime of the decorated function.

qis.get_resource_path

Resolve the input/resource directory, without creating missing inputs by default.

Also exported

Exported and importable, not part of the documented core. Signatures may change without a migration path.

Enums

24 exported.

qis.AttributionMetric

input for computation of get_performance_attribution_data()

qis.ConvolutionType

qis.CorrMatrixOutput

which pairs of a correlation matrix compute_ewm_corr_df() returns as columns.

qis.CrossXyType

which cross statistic compute_ewm_cross_xy returns.

qis.DdLegendType

qis.DescTableType

which statistics compute_desc_table reports after the mean and standard deviation.

qis.EnumMap

abstract enum with a map function

qis.FileTypes

qis.InitType

how an EWM recursion is seeded when no explicit init_value is given.

qis.PdfType

qis.PerfStatsLabels

enumerate some combinations for perf stat labels can refer through value perf_stats_labels=qis.PerfStatsLabels.DETAILED_WITH_DD.value perf_stats_labels=qis.PerfStatsLabels.DETAILED_WITH_DDVOL.value perf_stats_labels=qis.PerfStatsLabels.TOTAL_DETAILED.value

qis.RegimeData

which statistic a regime-conditional table reports.

qis.ReplacementType

what a rejected observation becomes.

qis.ReturnTypes

how a price series is converted to a return.

qis.ReturnsTransform

qis.RollingPerfStat

enumerated tuple for name and format

qis.SharpeConvention

which Sharpe ratio numerator a statistic reports.

qis.SignalAggType

qis.SignalDiagnosticsColumns

Column-name constants for the regression result DataFrames.

qis.SignalMapType

shape of the signal-to-weight map in map_signal_to_weight.

qis.SnapshotPeriod

input for computation of get_performance_attribution_data()

qis.TrendLine

qis.UnsmoothingMethod

Return engine used by native-price reconstruction.

qis.ValueType

Dataclasses

14 exported.

qis.ColumnData

keep data for producing meta and aggregation

qis.EwmaAlphaBetaHacResult

Joint EWMA-WLS alpha/beta estimates with Bartlett-HAC inference.

qis.GaussianVarSpec

Settings for zero-drift linear Gaussian Monte Carlo VaR.

qis.HoldingsAlphaCoverage

Allow bounded missing-beta dust and explicitly supplied proxy histories.

qis.LinearModel

A linear factor model for analyzing asset returns using multiple factors.

qis.ModelFeatureAlphaBetaAttribution

Factorial and Shapley attribution of layered-model feature effects.

qis.ModelLayerAlphaBetaAttribution

Full-sample alpha/beta decomposition of model-layer NAVs.

qis.ModelLayerCumulativeAlphaAttribution

Post-warm-up cumulative realised alpha under point-in-time EWMA betas.

qis.ModelLayerEwmaAlphaAttribution

Point-in-time model-layer attribution under lagged EWMA betas.

qis.ModelLayerEwmaRegressionAttribution

Current exponentially weighted model-layer regression attribution.

qis.ModelLayerNavs

Benchmark and model-layer NAVs for one feature coalition or effect.

qis.PortfolioInput

define data inputs for portfolio construction

qis.SmartDiversificationReport

Diversification frontiers of candidate overlays stacked on a principal portfolio.

qis.StrategySignalData

data class instance applied for output of strategy backtest data

Classes

8 exported.

qis.BenchmarkReturnsPositiveNegativeRegime

Regime classifier based on positive vs negative benchmark returns.

qis.BenchmarkVolsQuantilesRegime

Regime classifier based on benchmark volatility quantiles.

qis.ColVar

variable characteristic for columns variable for table

qis.FactsheetConfig

key parameters for report comps and visuals on different time period or data frequency.

qis.GaussianMonteCarlo

Reusable antithetic normal draws for portfolio and benchmark marginal VaR.

qis.MultiAssetsReport

qis.OutlierPolicy

specify filtering policy params

qis.RegimeClassifier

Abstract base class for regime classification.

Functions

234 exported.

qis.add_bnb_regime_shadows

qis.adjust_component_navs_to_portfolio

Rescale component NAVs so their PA returns sum to the portfolio PA return.

qis.adjust_returns_with_ar

Unsmooth observed returns with a rolling EWMA AR(q) beta vector.

qis.adjust_returns_with_factor_lag

Unsmooth observed returns by shifting the lagged-factor response to contemporaneous.

qis.adjust_returns_with_joint_unsmoothing

Jointly EWMA-fit phi_1 (own-lag) and beta_1 (lagged factor) and unsmooth.

qis.align_weights_to_columns

align a weight specification to a set of instrument columns.

qis.append_df_to_feather

append csv file

qis.append_time_series

Append older history before newer data with newer values winning overlaps.

qis.apply_pca

eigen decomposition of a symmetric matrix, ordered from the largest eigenvalue down.

qis.assert_list_subset

qis.bfill_timeseries

Extend newer time series backward with older provider histories.

qis.bootstrap_ar_process

resample the residuals of a fitted AR(1) per column and rerun the recursion.

qis.bootstrap_price_fundamental_data

resample price panels and AR(1) fundamentals jointly with one shared index array.

qis.check_df_for_duplicated_columns_index

qis.compute_ar1_unsmoothed_prices

AR(1) price-level shim with the shared quarterly defaults.

qis.compute_ar_residuals

fit an AR(1) per column and return the residuals on complete lag pairs.

qis.compute_autocorr_df

lagged Pearson autocorrelation of each column, with the lag as the index.

qis.compute_autocorrelation_at_int_periods

lag-one Pearson autocorrelation of non-overlapping blocks of span rows, per column.

qis.compute_avg_max_dd

Compute summary statistics of a drawdown (or run-up) series.

qis.compute_benchmark_drawdown_events

Return simple peak-to-trough and peak-to-recovery returns on benchmark dates.

qis.compute_benchmark_portfolio_risk_contributions

Computes the Euler contributions of active positions to tracking error.

qis.compute_benchmarks_beta_attribution_from_prices

Split each period's portfolio return into benchmark contributions and a residual.

qis.compute_benchmarks_beta_attribution_from_returns

Split each period's portfolio return into benchmark contributions and a residual.

qis.compute_bnb_regimes_pa_perf_table

Compute benchmark regime performance attribution table.

qis.compute_brinson_attribution_table

Compute BHB attribution from weighted arithmetic return contributions.

qis.compute_cvar

Compute historical CVaR (expected shortfall) as a loss-positive quantity.

qis.compute_data_pca_r2

explained-variance shares through time, from an EWM correlation or covariance tensor.

qis.compute_desc_freq_table

Aggregate a time series at a given frequency and compute descriptive statistics.

qis.compute_desc_table

descriptive statistics per column, formatted for display.

qis.compute_drawdowns_stats_table

Compute a sorted table of drawdown episodes and their statistics.

qis.compute_eigen_portfolio_weights

Return ranked PCA portfolio weights scaled to unit variance.

qis.compute_ewm_alpha_r2_given_prediction

EWM alpha and R-squared of a given prediction.

qis.compute_ewm_beta_alpha_forecast

Compute one-factor EWMA beta, alpha, one-step-ahead prediction and diagnostics.

qis.compute_ewm_corr_df

uncentred EWM correlation of every requested pair of columns, one column per pair.

qis.compute_ewm_corr_single

uncentred EWM correlation path of a two-column return panel.

qis.compute_ewm_cross_xy

EWM cross moment, beta or correlation of y on x, pair by pair.

qis.compute_ewm_long_short_filter

Signal smoother (long/short EWM band-pass) for DataFrame / Series / ndarray.

qis.compute_ewm_matrix_autocorr_df

EWM lagged cross moments of a panel as two columns, diagonal and off-diag.

qis.compute_ewm_newey_west_vol

exponentially weighted Newey-West variance or volatility.

qis.compute_ewm_ra_returns_momentum

span = 1: daily ra returns

qis.compute_ewm_score

Contemporaneous EWM score (x_t - m_t) / max(sigma_t, c) of each column.

qis.compute_ewm_sharpe

Annualised EWM Sharpe-ratio paths of return columns.

qis.compute_ewm_sharpe_from_prices

qis.compute_ewm_std1_norm

smoothed, volatility-normalised signal with unit standard deviation for IID input.

qis.compute_ewm_vector_autocorr

EWM autocorrelation ratio of each column: EWM lagged moment over EWM second moment.

qis.compute_ewm_vector_autocorr_df

EWM autocorrelation ratio of each column after removing its EWM mean.

qis.compute_ewm_xy_beta_tensor

Compute an EWM beta tensor from factor and asset returns.

qis.compute_excess_return_navs

Compute NAVs for excess returns over risk-free rate.

qis.compute_excess_returns

Subtract the cash return accrued over each return period.

qis.compute_gaussian_portfolio_risk

Compute Monte Carlo VaR, benchmark beta and TE from supplied covariance.

qis.compute_ic_timeseries

Per-date IC series for every horizon in a diagnostic result.

qis.compute_info_ratio_table

Compute whole-sample TE and IR tables across return-differential panels.

qis.compute_lookthrough_exposures

Split weights or contributions using explicit fractions and ordinary labels.

qis.compute_max_current_drawdown

Compute the realised maximum drawdown and the current drawdown.

qis.compute_mean_freq_regimes

Compute mean returns and frequency for each regime.

qis.compute_model_feature_alpha_beta_attribution

Compute factorial and Shapley attribution for layered-model feature changes.

qis.compute_model_layer_alpha_beta_attribution

Compute a full-sample OLS decomposition of model-layer log returns.

qis.compute_model_layer_cumulative_alpha_after_warmup

Rebase cumulative lagged-beta alpha after a point-in-time warm-up.

qis.compute_model_layer_ewma_alpha_attribution

Estimate model-layer alpha using point-in-time, lagged EWMA betas.

qis.compute_model_layer_ewma_regression_attribution

Estimate a current model-layer decomposition by EWMA-WLS with joint HAC inference.

qis.compute_model_layer_ewma_sharpe_contributions

Compute additive current EWMA return-to-volatility contributions.

qis.compute_model_layer_ewma_stage_sharpes

Compute EWMA Sharpe paths after adding model-layer components sequentially.

qis.compute_model_layer_in_sample_sharpe_contributions

Compute additive full-sample return contributions over full-sample volatility.

qis.compute_model_layer_rolling_ewma_regression_alpha

Compute expanding-prefix EWMA-WLS annualised alpha paths.

qis.compute_net_navs_ex_perf_man_fees

Compute net NAVs after management and performance fees.

qis.compute_net_return_ex_perf_man_fees

Compute net returns after management and performance fees.

qis.compute_num_years

Compute number of years in price series.

qis.compute_one_factor_ewm_betas

EWM betas of every asset column on one factor.

qis.compute_pa_excess_compounded_returns

Compute annualized excess returns with geometric compounding.

qis.compute_pa_return

Compute annualized (per annum) return with geometric compounding.

qis.compute_pca_r2

explained-variance shares of the eigenvalues of a symmetric matrix.

qis.compute_per_asset_betas

Estimate one β per (asset, horizon) from the diagnostic pairs.

qis.compute_performance_table

Compute return-based performance metrics per asset.

qis.compute_periodic_returns

Compute simple periodic returns for a price panel.

qis.compute_periodic_returns_table

compute table for heatmap: columns are monthly returns, rows are years implemented only for single asset with price passed as series

qis.compute_portfolio_benchmark_ewm_beta_alpha_attribution

Compute portfolio beta-alpha attribution using benchmark decomposition.

qis.compute_portfolio_correlated_var_by_groups

Computes portfolio VaR accounting for correlations, optionally grouped by categories.

qis.compute_portfolio_ewm_benchmark_betas

Compute portfolio benchmark betas as weight-aggregated instrument betas.

qis.compute_portfolio_independent_var_by_ac

Computes the undiversified portfolio VaR: the sum of standalone instrument VaRs.

qis.compute_portfolio_vol

Computes portfolio volatility from a point-in-time EWM covariance of the returns.

qis.compute_ra_perf_table_with_benchmark

Compute the risk-adjusted performance table augmented with alpha/beta to a benchmark.

qis.compute_ra_returns

divide returns by a lagged EWM volatility: ra_t = vol_target * r_t / sigma_(t - weight_lag).

qis.compute_regime_avg

Compute conditional means and annualized contributions by regime.

qis.compute_regimes_pa_perf_table_from_sampled_returns

Compute comprehensive regime-conditional performance table.

qis.compute_returns_dict

Compute comprehensive dictionary of return metrics.

qis.compute_returns_transform

apply the returns transform selected by returns_transform.

qis.compute_risk_table

Compute risk metrics (vol, drawdown, skew/kurtosis) per asset using vectorised ops.

qis.compute_roll_mean

mean path of each column under a mean-adjustment convention, same shape as the input.

qis.compute_rolling_drawdown_time_under_water

Compute joint drawdown and time-under-water series.

qis.compute_rolling_drawdowns

Compute the running drawdown series from peak.

qis.compute_rolling_mean_adj

observations minus their mean path under mean_adj_type; see compute_roll_mean().

qis.compute_rolling_perf_stat

compute rolling performance default stats is 1y rolling for prices with roll_freq = 'B' for monthly returns anf 5y rolling use roll_freq='ME' and roll_periods=5*12

qis.compute_rolling_ra_returns

span = 1: daily ra returns otherwise compute sum of returns and then their vols interpretation: voltargeting for returns over span ewm_lambda is vol over the span too

qis.compute_sampled_vols

Compute annualized realized volatility from sampled returns.

qis.compute_sum_freq_ra_returns

sum risk-adjusted returns within non-overlapping calendar periods of freq.

qis.compute_sum_rolling_ra_returns

span = 1: daily ra returns otherwise compute sum of daily ra-returns interpretation: pnl of daily voltargeting returns over span

qis.compute_te_ir_errors

Compute whole-sample tracking error and information ratio from return differentials.

qis.compute_total_return

Compute total return from first to last price.

qis.compute_unsmoothed_price_panel

Unsmooth supplied native marks per cadence and align reconstructed NAVs to their grid.

qis.corr_to_pivot_row

compute correlation row between pivot row of returns and return columns in data pivot returns are row data (r1,r2) data columns are column data ([c1, c2]) output is correlation row of pivot to columns columns may have nans but pivot must be non-nan

qis.create_overlay_portfolio_curve

Navs of the principal portfolio mixed with one overlay at eleven overlay weights.

qis.create_rebalancing_indicators_from_freqs

rebalancing_freq are series with data of type {'SPY': 'QE', 'TLT': 'ME'}

qis.df_asfreq

Wrapper to asfreq with closed period.

qis.df_boxplot_by_columns

plot boxplot using data by columns x-axis will be colum names

qis.df_boxplot_by_index

plot data frame by aggregating by columns xvar is the index appropriate when y data is uniform conditional n regimes

qis.df_dict_boxplot_by_classification_var

get dict of dfs and add regime vars, key = (x_column, y_column) use x as classification var and plod box plot relative to quatiles of x is_value_labels will be same across different df and x

qis.df_dict_boxplot_by_columns

dict keys are added as hue plot boxplot using data by columns x-axis will be colum names

qis.df_nanmean_negative

mean of strictly negative finite entries along axis

qis.df_nanmean_weighted

weighted average across axis, with weights rescaled at each line to sum to one over the finite entries only: mu_t = sum_i w_i x_ti / sum_i w_i 1{x_ti finite}.

qis.df_to_str

Format a DataFrame as strings, with per-column format overrides.

qis.estimate_acf_from_path

standard sample autocorrelations and partial autocorrelations of one series.

qis.estimate_acf_from_paths

partial (default) or ordinary sample autocorrelations of many paths, one column per path.

qis.estimate_dimson_beta

estimate the Dimson aggregated-coefficient beta to detect return smoothing.

qis.estimate_ewm_factor_model

Estimate linear factor model from price data.

qis.estimate_ewma_alpha_beta_hac

Fit joint EWMA-weighted alpha/beta regressions with Bartlett-HAC inference.

qis.estimate_vol

Estimate volatility from return samples.

qis.ewm_insample_winsorising

Winsorise each column at full-sample quantiles of its EWM score.

qis.ewm_xy_convolution

EWM correlation or beta of rolling h-row returns with their own lag or with a signal.

qis.fetch_default_perf_params

Build the default (PerfParams, BenchmarkReturnsQuantilesRegime) pair used outside the factsheet-config path.

qis.fetch_factsheet_config_kwargs

Expand a FactsheetConfig into the keyword arguments consumed by the generate_*_factsheet(...) functions.

qis.filter_outliers

Remove outliers by the cuts of an OutlierPolicy, applied in a fixed order.

qis.flatten_group_attribution

Flatten nested group attribution into one DataFrame per group.

qis.generate_current_signal_report

qis.generate_lookthrough_exposures_factsheet

Compare average and final realised sleeve exposures with grouped horizontal bars.

qis.generate_multi_asset_factsheet

one-page cross-sectional factsheet comparing instruments against a benchmark.

qis.generate_price_history_report

qis.generate_strategy_benchmark_active_perf_plt

display 2*2 plot with nav and Brinson attribution

qis.generate_strategy_signal_factsheet_by_instrument

Plot signal, volatility, leverage and weight histories for each instrument.

qis.generate_weight_change_report

qis.get_all_folder_files

qis.get_excess_returns_nav

Compute excess return NAV after funding costs.

qis.get_local_file_path

file data management is organised as: file_path = RESOURCE_PATH/folder_name/file_name+file_type.value default value without optional arguments will be: file_path = RESOURCE_PATH/file_name.file_type.value

qis.get_nonnan_index

Get the first or last non-NaN index for each column/series.

qis.get_output_path

Resolve the output directory through YAML, creating missing parents by default.

qis.get_paired_rareturns_signals

pair normalised sums of risk-adjusted returns with the signal known before each window.

qis.get_paths

Read YAML configuration, with private entries overriding packaged defaults.

qis.get_pdf_path

qis.get_time_period_shifted_by_years

qis.get_time_to_maturity

return annualised difference between mat_date and value_time

qis.get_ytd_time_period

qis.idx_to_alphabet

Map a 1-based index to an alphabet character (1 -> A, 26 -> Z).

qis.join_file_name_parts

set standard for joining parts of file name

qis.lever_returns

Apply constant leverage to an unlevered asset return series.

qis.load_df_dict_from_excel

loag Excel sheets to pandas dict dataset_keys = None, it will read all sheets

qis.load_df_dict_from_feather

pandas dict from csv files

qis.load_df_dict_from_parquet

pandas dict from parquet files

qis.load_df_from_feather

load dfs from feather files

qis.load_df_from_parquet

pandas from parquet

qis.log_returns_to_nav

Convert log returns to NAV using exponential compounding.

qis.long_short_to_relative_nav

Compute NAV for long-short strategy.

qis.map_signal_to_weight

map a signal to a bounded weight through the shape selected by signal_map_type.

qis.matrix_regularization

eigenvalue clipping of a symmetric matrix: eigenvalues at or below cut are set to zero.

qis.melt_scatter_data_with_xvar

column with xvar_str will be repeated to melted y_column index is ignored

qis.mult_df_columns_with_vector

multiply data set with vector column-wise and normalize accounting for nans in data data can be indicators data with False/True

qis.np_array_to_df_index

in case operation of np array is needed to apply to pandas row wise, the numpy array is broadcast to pandas index the lenth = pandas.index

qis.plot_best_worst_returns

qis.plot_box

plot boxplot of df[[x, y]] original_index use for melted df in term of original index

qis.plot_brinson_attribution_table

Create comprehensive visualization of Brinson attribution results.

qis.plot_brinson_totals_table

Create formatted table visualization of Brinson attribution summary.

qis.plot_clusters

Render supplied trees and membership with automatic or caller-owned axes.

qis.plot_contour

qis.plot_data_timeseries

define plot time series

qis.plot_dendrogram

Plot an existing full linkage with optional cluster-cutoff annotation.

qis.plot_desc_freq_table

qis.plot_df_table_with_ci

table with ci

qis.plot_errorbar

Plot labelled point estimates with optional error and reference values.

qis.plot_histogram

Plot each input series as a density or histogram.

qis.plot_histplot2d

qis.plot_line

line plot wrapper for sns, lineplot plot df using index x: str = None: x column y: str = None: y column hue: str = None: hue

qis.plot_lines_list

qis.plot_model_layer_ewma_return_bridge

Plot the current annualised EWMA return bridge with Bartlett-HAC intervals.

qis.plot_model_layer_ewma_sharpe_bridge

Plot additive current EWMA log-return Sharpe contributions.

qis.plot_model_layer_in_sample_sharpe_bridge

Plot full-sample return contributions over full-sample volatility.

qis.plot_model_layer_rolling_ewma_regression_alpha

Plot expanding-prefix EWMA-WLS annualised alpha paths.

qis.plot_multivariate_scatter_with_prediction

qis.plot_overlay_allocation_frontier

Stacked portfolios by group and an optional solved coverage-floor frontier.

qis.plot_periodic_returns_table

plot returns at specified frequency for datadrfame columns are periods, rows are prices.columns

qis.plot_pie

qis.plot_price_history

qis.plot_prices_2ax

qis.plot_prices_with_fundamentals

qis.plot_quantile_class_table

qis.plot_ra_perf_annual_matrix

compute annual matrix of performance var for a dict of strat end periods

qis.plot_ra_perf_bars

qis.plot_ra_perf_by_dates

compute table of performance var for a dict of strat end periods

qis.plot_ra_perf_scatter

scatter plot of performance stats

qis.plot_ra_perf_table

plot ra perf table columns

qis.plot_ra_perf_table_benchmark

plot ra perf table and get ra performance columns with data as string for tables

qis.plot_regime_boxplot

qis.plot_regime_data

plot regime-conditional data of the classifier as stacked bars with regime colors.

qis.plot_regime_pdf

qis.plot_returns_corr_matrix_time_series

plot time series of returns correlations infered from prices

qis.plot_returns_corr_table

plot corr table of prices

qis.plot_returns_ewm_corr_table

Plot the last EWM return correlation matrix or its time average.

qis.plot_returns_heatmap

Plot periodic returns as a colour-coded calendar table.

qis.plot_returns_scatter

qis.plot_returns_table

plot returns at specified dates dict

qis.plot_rolling_drawdowns

qis.plot_rolling_perf_stat

plot rolling performance

qis.plot_rolling_time_under_water

qis.plot_scatter_regression

Plot scatter regression with regime-conditional betas.

qis.plot_signal_diagnostics

Two-row diagnostic figure for a signal panel.

qis.plot_signal_diagnostics_beta_boxplot

Boxplot of per-asset β across horizons.

qis.plot_signal_diagnostics_boxplot

Distribution of cross-sectional returns conditional on the signal.

qis.plot_signal_diagnostics_for_returns

Run the predictive regression and render the composite figure.

qis.plot_signal_diagnostics_group_boxplot

Per-group β distribution as boxplots, with regression t-stat annotation.

qis.plot_sorted_periodic_returns

plot returns at specified frequency

qis.plot_stack

Plot DataFrame columns as stacked areas or stacked bars.

qis.plot_time_series_2ax

qis.plot_top_bottom_performers

qis.plot_top_drawdowns_paths

overlay the deepest drawdown episodes, each re-indexed to the number of grid steps since its start.

qis.plot_vbars

Plot signed, stacked horizontal bars without relabeling caller data.

qis.plot_xy_qq

qis.portfolio_navs_to_additive

Adjust asset NAVs to make PA returns additive to portfolio total.

qis.portfolio_returns_to_nav

Aggregate portfolio returns across assets to single NAV.

qis.prediction_r_squared

Score aligned predictions without clipping negative out-of-sample R-squared.

qis.prices_at_freq

Resample prices to specified frequency.

qis.prices_to_scaled_nav

Scale price returns by constant factor.

qis.save_df_dict_to_excel

dictionary of pandas to same Excel with dfs as separate sheets w adds/replaces with new excel; a appends to exisiting

qis.save_df_dict_to_feather

pandas dict to csv files

qis.save_df_dict_to_parquet

pandas dict to parquet files

qis.save_df_to_excel

pandas or list of pandas to one excel if_sheet_exists only for append mode mode = w: write new file mode = a: append to existing file

qis.save_df_to_feather

save df to feather files index_col stands for the index: needs to be reset when saving and put back when loading

qis.save_df_to_parquet

pandas to parquet

qis.save_figs

save matplotlib figures dict

qis.to_factor_returns

Transform each factor in its declared units using the standard return kernel.

qis.to_finite_reciprocal

finite repciprocal with inf fills

qis.to_flat_list

qis.to_portfolio_returns

Compute portfolio returns from asset weights and returns.

qis.to_quarterly_returns

Compound returns to quarter-end via NAV round-trip.

qis.to_total_returns

Compute total returns over entire price history.

qis.to_zero_first_nonnan_returns

Set first non-NaN return(s) to zero for NAV initialization.

qis.update_df_in_csv

update csv file with new rows: if the file exists, load the existing data, concatenate with df, optionally drop duplicate index entries via keep, and rewrite the file.

qis.weights_tracking_error_report_by_ac_subac

Build weights and tracking-error panels for a strategy and benchmark.

Explicitly imported modules

Not exported from qis: import these names from their module, for example from qis.regimes import compute_regime_premium_table. They carry Args blocks and are covered by the handbook chapters linked under each module.

qis.regimes

21 documented.

Methodology: The convexity premium and smart diversification.

qis.regimes.calibrate_student_t_nu

Student-t degrees of freedom matching a sample excess kurtosis, nu = 4 + 6 / kurt.

qis.regimes.compute_convexity_premium

Convexity premium, the realised Bear contribution less its null p SR - kappa rho.

qis.regimes.compute_gaussian_regime_moments

Regime means and second moments of a Gaussian benchmark, from its periodic volatility.

qis.regimes.compute_null_regime_contributions

Null regime contributions p_s SR + rho k_s of an asset, which sum to its Sharpe ratio.

qis.regimes.compute_overlay_blend_frontier

Closed-form frontier of the blends (1 - x) benchmark plus x overlay.

qis.regimes.compute_portfolio_bear_sharpe

Bear contribution of a portfolio by the aggregation identity.

qis.regimes.compute_regime_betas

Per-regime OLS betas of every asset on the benchmark, with the intercepts discarded.

qis.regimes.compute_regime_betas_bootstrap

Regime betas of a panel with their stationary block-bootstrap standard errors.

qis.regimes.compute_regime_ewm_avg

EWMA conditional means with the span applied within each regime's own return stream.

qis.regimes.compute_regime_ewm_betas

EWMA-weighted per-regime betas on the benchmark and the calendar-time residual variances.

qis.regimes.compute_regime_kappa

Kappa of the symmetric three-bucket partition, the Sharpe cost of one unit of correlation.

qis.regimes.compute_regime_mixture_covar

Annualised regime-mixture covariance by the law of total covariance.

qis.regimes.compute_regime_mixture_covar_from_sample

Annualised regime-mixture covariance of one complete classified panel.

qis.regimes.compute_regime_null_loadings

Correlation loading of each regime contribution under the Gaussian or Student-t null.

qis.regimes.compute_regime_premium_bootstrap

Stationary block-bootstrap standard error and interval of each asset's convexity premium.

qis.regimes.compute_regime_premium_table

Regime decomposition, null and convexity premium of every asset of a sampled frame.

qis.regimes.compute_sample_regime_moments

Per-period empirical regime moments of the benchmark on a supplied classification.

qis.regimes.create_sampled_returns_with_regime_id

Periodic returns with the benchmark-quantile regime of each period, from returns.

qis.regimes.get_partition_quantiles

Validated partition probabilities, the one-sigma cut when none are given.

qis.regimes.get_regime_ids

Ordered regime ids of a partition, from the lowest benchmark bucket up.

qis.regimes.get_regime_probabilities

Population probability of each bucket, the width of its probability interval.

qis.plots.derived.regime_premium

2 documented.

Methodology: The convexity premium and smart diversification.

qis.plots.derived.regime_premium.plot_regime_beta_profiles

Group-mean regime betas with the members' range, mean standard errors and total beta.

qis.plots.derived.regime_premium.plot_regime_sharpe_decomposition

Horizontal stacked regime contributions per row, with the total and the tail null.

qis.utils.quantile_buckets

7 documented.

Methodology: Regime-conditional performance, The convexity premium and smart diversification.

qis.utils.quantile_buckets.EmptyQuantileBucketError

Raised when estimated quantile edges leave a bucket without observations.

qis.utils.quantile_buckets.assign_bucket_codes

Bucket of each observation for given interior edges, closed on the right with open ends.

qis.utils.quantile_buckets.classify_quantile_buckets

Quantile bucket of each observation as an ordered categorical.

qis.utils.quantile_buckets.compute_bucket_codes

Quantile bucket of each observation, with the edges estimated from the observations.

qis.utils.quantile_buckets.compute_quantile_edges

Interior quantile edges of the finite observations.

qis.utils.quantile_buckets.compute_sample_quantiles

Sample quantiles of the finite observations by the rule of this module.

qis.utils.quantile_buckets.get_quantile_probabilities

Probabilities of a partition, from 0 to 1.