Migrating from pyfolio-reloaded to qis¶
Author: Artur Sepp / First recorded: 2026-10-07
Implemented in qis — Quantitative Investment Strategies. Software citation: CITATION.cff.
This guide maps a pyfolio-reloaded workflow
onto qis: the tear sheets, the rows of perf_stats and the individual plots. For each statistic it
states whether the two packages agree on the same input and, where they do not, which convention
differs. Some pyfolio analyses, such as round trips and capacity, have no qis counterpart; the
last section lists them.
The mappings were checked on 6 October 2026 with qis 5.33.3, pyfolio-reloaded 0.9.9 and empyrical-reloaded 0.5.12, on the frozen synthetic series used below. Check the release you install before relying on an exact signature.
Tear sheets¶
pyfolio-reloaded |
qis |
Notes |
|---|---|---|
|
|
A multi-asset report on the strategy and benchmark NAVs. |
|
|
Choose the reporting grid explicitly; see Factsheets and reporting. |
|
|
Needs instrument prices and weights; see below. |
|
The strategy report from a |
Weights, exposures and attribution panels. |
|
|
Turnover uses the qis turnover conventions, not pyfolio’s |
|
No direct counterpart |
Regime-conditional performance answers a related question. |
|
No direct counterpart |
See factor risk models and Brinson attribution. |
The returns tear sheet becomes one call. The facade returns a list of matplotlib figures; pass
them to qis.save_figs_to_pdf to write a PDF.
figures = qis.factsheet(
navs,
benchmark='benchmark',
reporting_frequency='monthly',
factsheet_name='Strategy versus benchmark',
)
qis.factsheet also accepts the returns themselves with data_is_returns=True. In qis releases
after 5.33.3 that path adds the same base observation, one period of the inferred native
frequency before a non-zero first return, so it renders the same report as the NAVs above. In
qis 5.33.3 and earlier it compounds through qis.returns_to_nav without a base and drops the
first return, so pass the NAVs above instead.
perf_stats rows and qis columns¶
pyfolio.timeseries.perf_stats reports daily simple-return statistics annualised with 252 periods.
qis states its conventions in PerfParams. These parameters select the same daily simple-return
grid:
daily = qis.PerfParams(freq='B', freq_skewness='B', return_type=qis.ReturnTypes.RELATIVE)
performance = qis.compute_ra_perf_table_with_benchmark(
prices=navs, benchmark='benchmark', perf_params=daily
)
moments = qis.compute_risk_table(prices=navs, perf_params=daily)
freq='B' sets the volatility, regression and excess-return grids to business days, and
ReturnTypes.RELATIVE computes volatility from simple rather than log returns. freq does not
set the skewness grid, which keeps its monthly default unless freq_skewness is given.
On the synthetic strategy above, with the NAV base observation:
pyfolio row |
pyfolio |
qis column |
qis |
Agree? |
|---|---|---|---|---|
Cumulative returns |
0.5594 |
|
0.5594 |
Yes |
Annual volatility |
0.1636 |
|
0.1636 |
Yes, with |
Sharpe ratio |
0.4098 |
|
0.4098 |
Yes |
Max drawdown |
−0.2869 |
|
−0.2869 |
Yes, with the base observation |
Beta |
1.6636 |
|
1.6636 |
Yes, on the daily regression grid |
Annual return |
0.0551 |
|
0.0571 |
No: year count |
Calmar ratio |
0.1922 |
|
0.1992 |
No: annual return in the numerator |
Sortino ratio |
0.6021 |
|
0.6154 |
No: different definition |
Alpha |
0.005940 |
|
0.005923 |
No: compounded versus arithmetic annualisation |
Skew |
0.1468 |
|
0.1469 |
Nearly: bias correction |
Kurtosis |
0.0646 |
|
0.0676 |
Nearly: bias correction |
The differences come from a few conventions:
Annual return. pyfolio counts years as the number of daily returns divided by 252. qis counts calendar days divided by 365.25 between the first and last NAV dates. The statistic catalogue gives every qis formula.
Two Sharpe ratios. pyfolio’s Sharpe ratio is the arithmetic one, \(\sqrt{252}\,\bar r/s(r)\), which is
SHARPE_ARITH. The qis column labelledSharpe (rf=0),SHARPE_RF0, divides the per-annum compounded return by volatility; on this series it is 0.349. See the three table conventions.Sortino ratio. pyfolio divides the annualised arithmetic mean by the root mean square of the negative returns over all observations. qis divides the per-annum excess return by the standard deviation of the negative returns only.
Alpha. pyfolio compounds the daily regression alpha as \((1+\alpha)^{252}-1\);
ALPHA_ANis \(252\,\alpha\). The betas agree.Skew and kurtosis. pyfolio uses the biased
scipy.statsmoments; qis reports the bias-corrected \(G_1\) and excess \(G_2\).
pyfolio’s Stability, Omega ratio, Tail ratio and Daily value at risk (the mean minus two standard deviations) have no column in the qis tables.
Plots¶
pyfolio-reloaded |
qis |
Notes |
|---|---|---|
|
|
Cumulative NAV, optionally with the drawdown panel. |
|
|
|
|
|
The table lists start, trough, end, depth and recovery days. |
|
|
qis rolls over log returns; values differ from pyfolio’s simple-return version. |
|
|
|
|
|
An exponentially weighted beta rather than fixed 6- and 12-month windows. |
|
|
Years by months, with an annual column. |
|
|
|
|
|
pyfolio’s default rolling window is 126 business days (six months); qis defaults to 260, so pass
roll_periods to compare like with like:
strategy_nav = navs['strategy']
underwater = qis.plot_rolling_drawdowns(prices=strategy_nav)
worst_drawdowns = qis.compute_drawdowns_stats_table(price=strategy_nav, max_num=5)
rolling_sharpe = qis.plot_rolling_perf_stat(
prices=strategy_nav, rolling_perf_stat=qis.RollingPerfStat.SHARPE,
roll_periods=126, roll_freq='B',
)
rolling_beta = qis.compute_one_factor_ewm_betas(
x=benchmark_rets, y=returns.to_frame(), span=126
)
heatmap = qis.plot_returns_heatmap(prices=strategy_nav)
annual_returns = qis.compute_periodic_returns(prices=navs, freq='YE')
Positions and the strategy report¶
pyfolio’s positions frame holds the dollar value of each holding plus a cash column, so its rows
sum to the portfolio value. Dividing by that sum gives weights:
def positions_to_weights(positions: pd.DataFrame) -> pd.DataFrame:
"""Turn pyfolio positions, dollar values with a cash column, into weights of portfolio value."""
return positions.drop(columns='cash').div(positions.sum(axis=1), axis=0)
qis builds its strategy report from a PortfolioData object. qis.backtest_model_portfolio
creates one from instrument prices and target weights: it converts the targets into held units,
applies costs and records the weights, turnover and attribution the report shows. This re-runs
the allocation under qis accounting. It does not replay pyfolio’s recorded transactions, so the
NAV can differ from the original record through execution timing and costs. The
backtesting guide defines the accounting.
asset_prices = universe.prices[['SEQ_US', 'SBD_TSY', 'SCM_GLD']]
weights = qis.generate_static_weights_schedule(
prices=asset_prices,
weights={'SEQ_US': 0.6, 'SBD_TSY': 0.3, 'SCM_GLD': 0.1},
rebalancing_freq='ME',
)
portfolio_data = qis.backtest_model_portfolio(
prices=asset_prices, weights=weights, rebalancing_freq=None, ticker='Strategy'
)
strategy_report = qis.factsheet(portfolio_data, benchmark_prices=navs['benchmark'])
Replace the static schedule with the weights from positions_to_weights on the dates your
strategy rebalanced.
What has no counterpart in qis¶
These pyfolio analyses have no qis equivalent:
Round-trip analysis and its statistics (
create_round_trip_tear_sheet).Capacity and liquidity analysis (
create_capacity_tear_sheet).Slippage sweeps and transaction-level diagnostics beyond turnover and costs.
Event-window performance (
create_interesting_times_tear_sheet).In-sample and out-of-sample splits by
live_start_date. In qis, compute the tables on eachTimePeriodseparately.
qis in turn adds explicit return, grid and annualisation conventions, excess returns over a supplied rate series, Sharpe inference, regime-conditional performance and covariance-based risk and tracking error.
See also¶
References¶
pyfolio-reloaded contributors. Repository, including tears.py and timeseries.py.
empyrical-reloaded contributors. stats.py.
Sepp, A. qis: Performance analytics, portfolio backtesting, risk analysis, and factsheet reporting in Python. Software citation metadata.