Artur Sepp Blog on Quantitative Investment Strategies

  • Blog
  • Research
  • About
  • Category: Asset Allocation

    • All-weather or 60/40? A portfolio backtest with qis

      Posted at 8:58 pm by artursepp, on November 11, 2026

      Artur Sepp · 11 November 2026

      My paper qis: reproducible performance analytics and portfolio backtesting in Python was published in the Journal of Open Source Software on 18 October 2026. qis is the Python package behind the analytics of my research papers, and it has been downloaded 244K times from PyPI as of 11 November 2026. Download history

      Contents:

      1. Why qis: the problem I built it for, and what it covers today.
      2. An example: is an all-weather portfolio better than the classic 60/40, and when?
      3. qis in the era of Gen AI: what a package is for when an AI writes the code.

      Why qis

      I started to develop qis and made it open source around 2022, for the reason that many times I faced a simple research problem. I was using public and private packages for exploring and developing quant strategies that generate position weights for me. What I found missing was a simple portfolio backtester that will reconstruct the P&L from the weights and prices I provide. That backtester should work uniformly whether the underlying strategies cover a universe of several thousand stocks with long-short self-financing weights, a universe of a dozen self-financing futures positions, DeFi staking strategies with cash flows, or simple long-only ETFs.

      One function for generating the net asset value or the equity curve of the portfolio serves the four cases because it assumes little. The weights do not have to sum to one, and the cash balance is explicit. Between rebalancings the backtester holds units, not weights, so the realised weights drift with prices and the reported turnover is the traded one. Its accounting is 460 lines of code.

      For all these cases I wanted to have a simple mechanism:

      • My algo produces position weights for the provided universe along with estimated trading costs at rebalancing times
      • The universe has valid prices accounting for total returns
      • Leverage / balances are funded / accrued at the specified rate

      Each requirement is an argument of qis.backtest_model_portfolio:

      RequirementArgument
      Position weightsweights: a dict for a static allocation, a dated DataFrame for a strategy; weight_implementation_lag delays the trade of a dated weight
      Trading costsrebalancing_costs: one number, a series by instrument, or a DataFrame of dates by instruments
      Total-return pricesprices; instruments_carry for a carry that is not in the price, such as a staking yield or borrow costs
      Fundingfunding_rate on positive and negative cash, management_fee on the net asset value

      The backtester then provides the net asset value of the trading account along with the different performance measures, turnover and risk analysis, comparison to benchmarks, regime-conditional performance etc.

      The output is a PortfolioData object with the net asset value, the units, the realised weights, the P&L of each instrument and the realised costs. The tables and charts of the example below are read from it.

      Along with that I wanted to have different visualisation methods. For example, a scatter plot of strategy returns vs benchmark returns. It may be a trivial task to generate the code by prompting an AI these days, but in the pre-AI days you had to know the matplotlib settings at length to make a proper scatter plot and to display the estimated regression coefficient on it. What I did is to create API-like interfaces for the core plots that I need for reporting of financial data: time series, stack plots, scatter plots, box plots, bar charts with uniform styling and labelling. These APIs are linked to factsheet generation.

      The functions are qis.plot_time_series, qis.plot_stack, qis.plot_scatter, qis.df_boxplot_by_classification_var, qis.plot_bars and qis.plot_heatmap. Each draws on a matplotlib axis passed as ax=. The scatter plot of my example is the right panel of Figure 3 below: its legend prints the fitted quadratic and its R2.

      With time I also developed backtest reporting factsheets focused on core analyses such as:

      • strategy factsheet: when I think of presenting the strategy as a stand-alone: its risk, turnover, performance heatmap, diagnostics of the Sharpe ratio and alpha, etc.
      • strategy-benchmark factsheet: when I analyse a new strategy feature vs the base strategy: what this feature provides marginally, Brinson decomposition, etc.
      • multi-strategy factsheet: when I analyse a block of strategies or the sensitivity to a specific parameter
      • multi-asset factsheet: a simple report for a multi-asset universe where strategy weights are not analysed and only a cross-sectional measure of performance is requested.

      Each report answers one question:

      FactsheetThe question it answersWhat it shows
      StrategyHow did I earn this return?Exposures, turnover and trading costs next to the net asset value. A page of inference adds intervals for the Sharpe ratio and for the alpha to the benchmark
      Strategy-benchmarkWhat did my change contribute?The two pages of the example below: the outcomes of both portfolios, the paired Sharpe difference and the marginal alpha
      Multi-strategyDoes the conclusion survive a change of parameters?Several variants against one base portfolio, with p-values adjusted for multiple comparisons
      Multi-assetWhat can I learn before choosing weights?From a price panel alone: performance, drawdowns, correlations and the behaviour in the regimes of a benchmark

      Tracking error is reported before and after the fact. Before trading, the active weights and a dated covariance matrix give an ex-ante tracking error, through qis.RiskModel. After trading, the realised return differences show how far the strategy moved from its benchmark, through qis.compute_ewma_realised_tracking_error.

      The four reports share one entry point. qis.factsheet(...) selects the report from the type of its input and sets the rolling windows and the annualisation from the reporting frequency, and each panel prints the frequency it was computed at. The reports also cover risk contributions, value at risk, stress tests and signal diagnostics. I list them with their calls in the section “What else the reports cover” below.

      With time I also added some features to qis that I constantly re-use in signal and portfolio construction and for which I wanted to have a common interface: exponentially weighted moving average (EWMA) filters, risk model, bootstrap, and FX adjustments among the key features.

      The entry points are qis.compute_ewm_vol and qis.estimate_rolling_ewma_covar for the EWMA estimators, qis.RiskModel for exposures and tracking error from dated covariance matrices, qis.bootstrap_price_data for stationary and block bootstraps, and qis.FxRatesData for returns and hedges in a reference currency. The same group holds the unsmoothing of appraisal-based returns and the regime classifier that shades the charts of this post.

      This makes qis a building tool for designing and reporting of quant strategies by delegating the reporting and tooling to a public method while keeping the focus on developing proprietary features for signal and portfolio construction that ultimately matter for the performance.

      The boundary is deliberate: qis ships no optimiser and no signal library. The weights come from the researcher’s own code or from the other packages of my stack, such as optimalportfolios.

      Example of using qis for all-weather portfolio analysis

      I do not summarise the paper further – read the paper further for my motivation, comparison to peer packages and other details. I use the package the way I use it every day: to answer a question about portfolios. For this post I choose an interesting one: is an all-weather portfolio better than the classic 60/40, and if so, when? I will not dwell on the details of how to construct an all-weather portfolio – let’s pick a proxy using a static weights portfolio. Mine is a simplification with equal capital in each ETF: the all-weather portfolio holds 25% each in US equities (SPY), long-term Treasuries (TLT), inflation-linked Treasuries (TIP) and gold (GLD). It follows the idea of Bridgewater’s All Weather approach, to hold assets for rising and falling growth and inflation (The All Weather Story), without its risk balancing and its leverage. The 60/40 portfolio holds 60% in SPY and 40% in 7-10 year Treasuries (IEF). Both are rebalanced quarterly and pay 10 basis points on each trade.

      This is a typical problem an investor or an advisor faces. Good luck solving it with AI and getting all the details right.

      The details are the launch dates of the ETFs, the drift of the weights between rebalancings, the trading costs, the return frequency behind a volatility and the definition of a Sharpe ratio.

      Here, every panel below comes from one line of code, printed above it. Changing the question costs one line. I use 10-point text for the standalone charts.

      Two portfolios in fifteen lines

      import matplotlib.pyplot as plt
      import yfinance as yf
      import qis
      
      tickers = ['SPY', 'TLT', 'TIP', 'GLD', 'IEF']
      prices = yf.download(tickers, start='2002-07-31', end='2026-10-01', ignore_tz=True, auto_adjust=True)['Close'][tickers]
      prices = prices.asfreq('B', method='ffill')  # an ETF stays empty before its launch
      
      def backtest(weights, ticker, funding_rate=None):
          px = prices[list(weights)]
          schedule = qis.generate_static_weights_schedule(prices=px, weights=weights, rebalancing_freq='QE')
          return qis.backtest_model_portfolio(prices=px, weights=schedule, rebalancing_freq=None,
                                              rebalancing_costs=0.0010,  # fractional units: 10 bp
                                              funding_rate=funding_rate, ticker=ticker)
      
      all_weather = backtest({'SPY': 0.25, 'TLT': 0.25, 'TIP': 0.25, 'GLD': 0.25}, 'All weather')
      balanced = backtest({'SPY': 0.60, 'IEF': 0.40}, '60/40')
      portfolios = qis.MultiPortfolioData(portfolio_datas=[all_weather, balanced], benchmark_prices=prices['SPY'])
      perf_params = qis.PerfParams(freq='ME')  # statistics on monthly returns
      

      TIP started trading in December 2003 and GLD in November 2004. I do not cut the history to the date when all four ETFs exist. generate_static_weights_schedule spreads the target over the ETFs that have a price at each rebalancing date: half each in SPY and TLT from July 2002, a third in each of three ETFs from December 2003, and a quarter in each of four from December 2004. Both portfolios start on 31 July 2002.

      The last two lines matter most. MultiPortfolioData holds the two backtests with their prices, weights, trades and costs, and each question below is one call on this object.

      The backtester holds units between the rebalancing dates, so the trades are the ones that return the drifted weights to their targets. Over the 21 complete years from 2005 through 2025, the annual sum of buys and sells averaged 16.20% of NAV for all weather and 14.30% for 60/40. At 10 basis points per dollar traded, that cost 1.62 and 1.43 basis points of NAV a year. I sum each trade relative to that day’s NAV and then average the calendar-year totals. Annual turnover and costs

      fig, ax = plt.subplots()
      qis.plot_stack(df=all_weather.get_weights(freq='ME'), use_bar_plot=True,
                     var_format='{:.0%}', fontsize=10, ax=ax)
      
      Realised month-end weights in SPY, TLT, TIP and GLD
      Opening allocation. Monthly holdings drift between quarterly trades. TIP enters in December 2003 and GLD in December 2004.

      Which one did better?

      portfolios.plot_nav(regime_benchmark='SPY', perf_params=perf_params, fontsize=10, ax=ax)
      portfolios.plot_drawdowns(regime_benchmark='SPY', fontsize=10, ax=ax)
      
      Net asset values and daily drawdowns of all weather and 60/40
      Figure 1. Net asset values and running drawdowns, 31 July 2002 to 30 September 2026. The pink and the dark green bands are the bear and the bull quarters of SPY.

      Over 24 years the 60/40 portfolio returns 8.5% p.a. and all weather 7.8%, with volatilities of 8.9% and 8.2%. The Sharpe ratio is 0.95 for both. The deepest drawdown is -32% for 60/40 and -21% for all weather.

      So the two portfolios earn the same return per unit of risk. Figure 1 already shows that they do not earn it in the same years: all weather is ahead in cumulative wealth at every year-end from 2005 through 2016, and 60/40 pulls away after 2020.

      • View the two-page backtest factsheet (PDF) for the rolling returns, exposures and trading costs.
      • Download the Python backtest script to reproduce Figure 1 with the data and run instructions.
      • Read the qis paper in JOSS for the design of the backtester.

      The same Sharpe ratio does not make them the same portfolio. Regressed on SPY with monthly returns, the 60/40 portfolio has a beta of 0.58 and an R2 of 91%, and all weather a beta of 0.29 and an R2 of 27%. Both are columns of qis.compute_ra_perf_table_with_benchmark.

      In which years?

      portfolios.plot_periodic_returns(fontsize=10, ax=ax)
      
      Calendar-year return heatmap for both portfolios
      Figure 2. Calendar-year returns. 2002 starts on 31 July and 2026 ends on 30 September.

      All weather is ahead in 10 of the 23 complete years, and in two of them, 2018 and 2022, by less than one point. The large gaps go both ways. In 2008 all weather loses 1% and 60/40 loses 17%. In 2013 all weather loses 6% while 60/40 gains 16%. In 2025 it gains 22% against 14%.

      The years cluster. A window of dates is a qis.TimePeriod, and the same performance table can be computed on any window:

      qis.compute_ra_perf_table(prices=qis.TimePeriod('31Dec2012', '31Dec2021').locate(portfolios.get_navs()),
                                perf_params=perf_params)
      
      Return p.a.All weather60/40
      July 2002 to 201210.2%7.2%
      2013 to 20216.5%11.2%
      2022 to September 20265.0%6.3%

      An investor who looked at these two portfolios at the end of 2012 saw all weather three points a year ahead, with a deepest drawdown of 18% against 32%. The next nine years went the other way by almost five points a year.

      What kind of market favours it?

      portfolios.plot_regime_data(benchmark='SPY', regime_data_to_plot=qis.RegimeData.REGIME_AVG,
                                  perf_params=perf_params, yvar_format='{:.1%}', fontsize=10, ax=ax)
      portfolios.plot_returns_scatter(benchmark='SPY', freq='QE', fontsize=10, ax=ax)
      
      Quarterly portfolio returns by SPY regime and against SPY
      Figure 3. Left: average quarterly return in the bear, normal and bull quarters of SPY, which are the worst 16%, the middle and the best 16% of its quarterly returns. The bars are stacked and the number on top is their sum. Right: quarterly returns against SPY with a quadratic fit.

      In the 16 worst quarters of SPY, equities lose 10.2% on average, 60/40 loses 4.8% and all weather is flat. In the 16 best quarters all weather gains 4.8% and 60/40 gains 8.1%. The fitted curve on the right is flat for all weather when SPY falls, and close to a straight line for 60/40.

      The same holds month by month. All weather is ahead in 70% of the months in which 60/40 falls, and in 34% of the months in which it rises. It is a portfolio for the quarters that an investor would rather forget, and it pays for this in the other quarters.

      The same classification splits the Sharpe ratio, with regime_data_to_plot=qis.RegimeData.REGIME_SHARPE in the call above. The 0.95 of the 60/40 portfolio is 0.60 from the bull quarters, 0.70 from the normal quarters and -0.36 from the bear quarters, up to rounding. For all weather it is 0.38, 0.57 and -0.01: it earns less in the good quarters and gives nothing back in the bad ones.

      Which ETF did the work?

      all_weather.plot_performance_attribution(time_period=qis.TimePeriod('31Dec2021', '31Dec2022'), fontsize=10, ax=ax)
      
      Wealth-linked gross contributions of each ETF in four calendar years
      Figure 4. Contribution of each ETF to the return of the all-weather portfolio in four years. The bars of a year add up to its return before trading costs. Each day’s contribution is scaled by the gross portfolio wealth at the preceding close, starting from one dollar at the opening of that calendar year. Data behind the bars

      Each of the four years has a different story.

      • 2008. SPY costs 10.5 points and TLT gives back 8.0. The portfolio ends the year at -1%.
      • 2013. SPY adds 7.1 points, and gold takes 7.5 away. The two bond ETFs lose another 5.6.
      • 2022. TLT loses 8.3 points, SPY 4.6 and TIP 3.0. Gold is flat. Three of the four ETFs fall together, and nothing offsets them. In this year all weather loses 16% and 60/40 loses 17%.
      • 2025. Gold adds 14.2 percentage points to the gross return. The portfolio finishes the year up 21.8% after trading costs.

      Over the full sample SPY and GLD contribute 247 and 190 of the 516 points of return before costs. TLT and TIP hold at least half of the capital at every rebalancing and contribute 79. The risk is not equal either: with qis.compute_portfolio_risk_contribution_ratios, gold has 25% of the capital and 39% of the volatility.

      How bad did it get?

      qis.plot_top_drawdowns_paths(all_weather.get_portfolio_nav(), max_num=5, fontsize=10, ax=ax)
      
      Five largest peak-to-recovery drawdown paths in each portfolio
      Figure 5. Paths of the five deepest drawdowns of each portfolio, from the peak to the recovery.

      The deepest drawdown of all weather is not 2008. It starts on 9 November 2021, reaches -20.9% on 20 October 2022 and ends on 5 July 2024, after 969 days. The 60/40 portfolio falls 21.3% in the same episode and recovers in 794 days. Its own deepest drawdown is the financial crisis: -31.6% and 1,085 days. March 2020 looks different: all weather loses 13.5% in 12 days and recovers within a month of the trough, 41 calendar days after its previous peak.

      What changed after 2021?

      span = 36
      pair = prices[['SPY', 'TLT']]
      paired_returns = qis.to_returns(pair, freq='ME', is_log_returns=True).dropna()
      # The first 36 paired returns warm up the estimates. Display starts with return 37.
      window = qis.TimePeriod(start=paired_returns.index[span], end=paired_returns.index[-1])
      
      fig, axes = plt.subplots(1, 2, figsize=(15, 5), sharex=True, constrained_layout=True)
      qis.plot_returns_corr_matrix_time_series(
          prices=pair, freq='ME', span=span, time_period=window, fontsize=10, ax=axes[0],
          title='36-month EW correlation: SPY and TLT',
      )
      portfolios.plot_factor_betas(
          benchmark_prices=prices[['SPY']], freq_beta='ME', factor_beta_span=span,
          time_period=window, fontsize=10, axs=[axes[1]],
      )
      axes[0].set_xlim(window.start, window.end)
      
      Monthly SPY–TLT EW correlation and holdings-weighted equity betas
      Figure 6. Left: correlation of the monthly returns of SPY and TLT, exponentially weighted with a span of 36 months. Right: beta of each portfolio to SPY, computed from the betas of its holdings. The first portfolio betas appear on 31 August 2005. The correlation begins on the same date, after 36 paired monthly returns, and both panels show every month from then on. Each holding needs 36 paired monthly returns with SPY for warm-up and first contributes a beta on its 37th paired return. During the early warm-up, the panel uses the available instrument betas at their actual weights. All held instruments have coverage by December 2007.

      In 2022 three of the four ETFs fell together, and the attribution does not say why. The reason is the correlation of bonds with equities. Using monthly log returns, the ordinary sample correlation of SPY and TLT is -0.31 from 2005 to 2012, of -0.26 from 2013 to 2021, and of +0.58 from 2022 to September 2026.

      The portfolio changes with it. The beta of all weather to SPY is 0.28 at the end of 2021, reaches 0.53 in December 2023 and stands at 0.46 in September 2026.

      Bonds helped cushion equity losses in 2008. From 2013 to 2021, their correlation with equities remained negative, but the higher equity weight favoured 60/40. In 2022, stocks and long Treasuries fell together.

      The three correlations above use 96, 108 and 57 monthly returns. The rolling line in Figure 6 gives greater weight to recent months and ends at +0.31. The shift in the sample average describes the period as a whole; individual months still varied. Period correlations · Full monthly series, including warm-up

      Is the difference real?

      portfolios.get_sharpe_difference_table()
      
      PortfolioBase SharpePortfolio SharpeSharpe differenceHAC SEHAC zp-valueObservationsHAC lags
      60/400.9557900.9606660.0048760.1677730.0290640.9768142903

      The table tests the Sharpe ratio of 60/40 against all weather on their 290 common monthly returns. The difference is 0.005 with a standard error of 0.17 and a p-value of 0.98. Twenty-four years of data cannot tell the two portfolios apart by their Sharpe ratios. They differ in the years in which they disappoint.

      The test and Figure 1 do not use the same Sharpe ratio. Figure 1 divides the compound return p.a. by the volatility: 0.946 for all weather and 0.948 for 60/40. The test uses the arithmetic mean of the monthly returns: 0.956 and 0.961. qis names its Sharpe conventions, and each table states the one it uses.

      The second page of the factsheet below adds the path. At every year-end from 2007 to 2012, the trailing five-year arithmetic Sharpe favours all weather. The monthly difference briefly crosses zero in June and July 2013. It then favours 60/40 at every month-end from September 2013 through February 2020, before turning positive in March 2020. In September 2026 it ends at −0.083, with a pointwise 95% interval of −0.559 to +0.393. The sign here is all weather minus 60/40. Five-year rolling estimates and intervals With the difference in the betas to SPY taken out, all weather is ahead by 2.1% p.a. over the 225 eligible months from January 2008, with a 95% interval from -0.3% to 4.5%, which includes zero.

      What if I add leverage?

      ust_3m = yf.download('^IRX', start='2002-07-01', end='2026-10-01', ignore_tz=True, auto_adjust=True)['Close']['^IRX'].dropna() / 100.0
      levered = backtest({'SPY': 0.50, 'TLT': 0.50, 'TIP': 0.50, 'GLD': 0.50}, 'All weather 2x', funding_rate=ust_3m)
      perf_params_excess = qis.PerfParams(freq='ME', rates_data=ust_3m)  # Sharpe ratios in excess of the bill rate
      

      All weather has about the volatility of the 60/40 portfolio and a lower return. Bridgewater’s All Weather uses leverage, so I add it. The same four ETFs now hold 50% of the capital each, which is 200% in total, and the borrowed 100% pays the rate of the 3-month Treasury bill. This is the funding_rate of the backtester: it accrues on the cash balance, which is now negative. I use the last annual bill quote available at the previous portfolio date and accrue interest over the actual calendar days on a 365-day basis. The QIS reference script runs this comparison with --with-leverage and can reuse the saved annual rates.

      navs = portfolios.get_navs(benchmark='SPY').copy()
      navs['All weather 2x'] = levered.get_portfolio_nav()
      stat = qis.PerfStat
      fig, ra_table = qis.plot_ra_perf_table_benchmark(
          prices=navs, benchmark='SPY', perf_params=perf_params_excess, fontsize=10,
          perf_columns=[stat.PA_RETURN, stat.VOL, stat.SHARPE_EXCESS, stat.MAX_DD,
                        stat.ALPHA_AN, stat.BETA, stat.R2],
      )
      ra_table
      
      AssetP.a. returnVolEx SharpeMax DDAn AlphaBetaR2
      SPY11.20%14.75%0.63-55%-0.00%1.00100%
      All weather7.79%8.24%0.73-21%3.24%0.2927%
      60/408.47%8.94%0.74-32%1.03%0.5891%
      All weather 2x13.48%16.52%0.70-40%6.56%0.5827%

      The last three columns use monthly simple returns in excess of the Treasury bill rate. Beta measures sensitivity to SPY, R² gives the share of return variance explained by SPY, and annualised alpha is 12 times the monthly regression intercept.

      comparison = navs[['All weather 2x', 'SPY']]
      fig, axes = plt.subplots(2, 1, figsize=(12, 9), constrained_layout=True)
      qis.plot_prices(prices=comparison, perf_params=perf_params_excess, fontsize=10,
                      perf_stats_labels=[stat.PA_RETURN, stat.VOL, stat.SHARPE_EXCESS],
                      title='Growth of one dollar', ax=axes[0])
      qis.plot_rolling_drawdowns(prices=comparison, dd_legend_type=qis.DdLegendType.SIMPLE,
                                 title='Drawdown from the previous peak', fontsize=10, ax=axes[1])
      
      Two panels showing the growth of one dollar and daily drawdowns for all weather 2x and SPY
      Figure 7. The funded 2× portfolio and SPY from 31 July 2002 to 30 September 2026. Both series start at one dollar. Drawdowns are measured from each series’ previous peak.

      With leverage, the comparison I find more informative is SPY. The 2× portfolio earned 13.48% a year at 16.52% volatility, against 11.20% at 14.75% for SPY. Within the all-weather allocation, doubling the target exposure lifted the annualised return from 7.79% to 13.48%. Its excess Sharpe fell from 0.726 to 0.701 after financing and trading costs.

      The price of the extra exposure was clearest in 2022. The funded portfolio lost 32.45% that calendar year, against 16.01% for unlevered all weather and 18.18% for SPY. Its deepest drawdown began on 9 November 2021, reached 39.58% on 20 October 2022 and recovered on 31 March 2025. That was 1,238 calendar days from peak to recovery.

      With a funding rate in the backtest, a Sharpe ratio with a zero rate is no longer the right statistic. The Sharpe ratios of this section are in excess of the bill rate, which PerfParams takes as rates_data. On this convention the unlevered Sharpe ratios are 0.726 for all weather and 0.744 for 60/40. Funding at the bill rate with no spread is a lower bound on the cost of leverage.

      The whole report in one call

      figs = qis.factsheet(portfolios, kind='strategy_benchmark', add_brinson_attribution=False)
      qis.save_figs_to_pdf(figs=figs, file_name='aw6040_factsheet', orientation='portrait',
                           local_path=None, add_current_date=False)
      
      First page of the two-page strategy and benchmark factsheet
      Download the two-page factsheet (PDF) · Figure 8. First page of the factsheet of all weather against 60/40. For both portfolios, rolling alpha starts on 30 September 2005. The first observation is September’s portfolio log return less the 31 August beta times September’s SPY log return. This residual seeds the 36-span average, which is annualised by multiplying by 12. Earlier months are blank. The marginal-alpha comparison on page two begins in January 2008, once both portfolios have a fully covered opening beta.

      Most figures above are panels of this report. The first page shows the rolling statistics, the exposures, the turnover and the costs of both portfolios. The second reports the paired test of the Sharpe ratios and the difference in alpha against SPY. I start an analysis from this report and then pull out single panels, as in this post.

      What else the reports cover

      The factsheets are a part of what qis reports. The table lists the rest: performance and risk after the fact (ex post), and risk before it (ex ante). Some function names abbreviate tracking error to TRE.

      QuestionCallContent
      Ex-post performanceqis.compute_ra_perf_table, the factsheetsReturn, volatility, Sharpe ratio under three named conventions, drawdowns, alpha and beta to a benchmark, regime contributions, attribution, Brinson, turnover and costs
      Is a difference significant?MultiPortfolioData.get_sharpe_difference_table, the second page of the strategy-benchmark factsheetPaired Sharpe difference and marginal alpha with autocorrelation-consistent intervals
      Ex-post tracking errorqis.compute_ewma_realised_tracking_error, qis.compute_te_ir_errorsA series for monitoring; tracking error and information ratio of the whole sample
      Ex-ante riskqis.RiskModel, PortfolioData.plot_current_varTracking error by group, factor exposures, beta, marginal contributions and value at risk, from weights and dated covariance matrices
      Tracking-error reportqis.weights_tracking_error_report_by_ac_subacStrategy against benchmark by asset class: weights, tracking error, risk contributions, turnover
      Stress testsqis.generate_portfolio_stress_reportFactor shocks applied to the current holdings
      Signalsqis.generate_weight_change_reportWhat moved the weights: momentum, carry, target volatility, leverage
      Look-through and FXqis.generate_lookthrough_exposures_factsheet, qis.run_asset_fx_hedging_reportExposures through fund holdings; hedged returns in a reference currency

      Conventions

      Prices are Yahoo adjusted closes downloaded on 11 November 2026. For this edition I reran the calculations and charts with qis==6.0.4 using the saved ETF prices and Treasury bill rates. Returns, volatilities and Sharpe ratios use monthly returns; the Sharpe ratio is the compound return p.a. over the volatility with a zero risk-free rate. Drawdowns use daily values. Trading costs are 10 basis points of the traded notional. There are no taxes and no interest on cash. The QIS reference script produces the unlevered ETF comparison by default. The --with-leverage option also produces the funded table and Figure 7. Save the script as qis_reference_604.py. In a data/ folder beside it, save the ETF prices as prices.csv and the Treasury bill rates as ust_3m_irx.csv. Run python qis_reference_604.py --with-leverage --output-dir <output-folder> in an environment with qis==6.0.4.

      The test of the Sharpe difference departs from this and uses the arithmetic Sharpe ratio. The section on leverage funds the cash balance at the 3-month Treasury bill rate and reports Sharpe ratios in excess of it.

      Try it yourself

      Each experiment is a new dict of weights in the setup and the same calls.

      • Replace TLT with IEF, and see what shorter bonds do to 2022 and to 2008.
      • Move to 40% gold and 20% in each of the others, and look at 2013.
      • Add the variant to MultiPortfolioData and read the Sharpe difference table before you believe the improvement.
      • Change 'QE' to 'ME' or 'YE' in backtest, and see how little the rebalancing frequency matters.
      • Add a spread to the funding of the levered portfolio, funding_rate=ust_3m + 0.005, and compare it with SPY again.

      qis in the era of Gen AI

      I understand that in the era of AI most of the analysis that qis provides can be generated quickly. What makes qis viable is the harness: consistent treatment of NaN data, all conventions are documented (Sharpe ratio – arithmetic, compounded, excess, etc., volatility frequency, alpha and beta versus the benchmark, start and end dates) and synchronised across the reporting. I see qis as a harness for agentic work. All my repositories have an explicit setting in SKILL.md or AGENTS.md to always use qis for any type of backtesting and reporting, and never to invent something that is not available there or to re-create something that is.

      The specification is the point. Every line of it is a convention that qis implements once and documents, so the chart, the table and the factsheet of one strategy show one number under one stated convention.

      An agent also has to find the function. The documented core is CORE_API in qis/api.py, 183 symbols in 14 groups, and a test fails when a documented argument is not in the signature. The rule in my agent instructions is a table. Four of its rows:

      You need toCallDo not write
      Turn weights into a portfolioqis.backtest_model_portfolioa date loop accumulating P&L
      Performance statisticsqis.compute_ra_perf_tableSharpe, vol or drawdown by hand
      Returns to NAVqis.returns_to_nav(1 + r).cumprod()
      Covariance on a ragged panelqis.compute_masked_covar_corr.dropna().cov()

      You are welcome to use qis for your research and agentic work. You can send me feedback at artursepp@gmail.com, report an issue on GitHub, or submit a pull request to propose a new feature.

      Links

      • Paper: Sepp, A. (2026), qis: reproducible performance analytics and portfolio backtesting in Python, Journal of Open Source Software, 11(126), 11400, doi:10.21105/joss.11400
      • Code: github.com/ArturSepp/QuantInvestStrats
      • Documentation: quantinveststrats.readthedocs.io
      • PyPI: pypi.org/project/qis

      I thank the editor Daniel S. Katz and the reviewers @alex09x, @robertmartin8 and @tschm for the review, and John D. Reynolds for his contributions to qis.

      Disclosure

      The views in this post are my own and do not represent the views of my current or former employers. The post and the software are not investment advice in any form.

      Download the reproduction guide and run commands

      Share this:

      • Share on LinkedIn (Opens in new window) LinkedIn
      • Share on X (Opens in new window) X
      • Share on WhatsApp (Opens in new window) WhatsApp
      • Email a link to a friend (Opens in new window) Email
      • Print (Opens in new window) Print

      Like this:

      Like Loading…
      Posted in Asset Allocation, Python, Quantitative Strategies, Uncategorized | 0 Comments
    • The Science and Practice of Trend-following Systems: paper and presentation

      Posted at 5:35 pm by artursepp, on June 22, 2025

      I would like to introduce the updated draft of my paper co-authored with Vladimir Lucic and entitled “The Science and Practice of Trend-following Systems”.

      Trend-following systems have been employed by many quantitative and discretionary funds, also known as commodity trading advisors (CTAs), or managed futures, since the early 1980s. Richard Dennis, a commodity trader on the CME, organised and instructed two classes of novice traders in late 1983 and 1984 with the idea that trading skills can be taught. The underlying ideas and methods included strict adherence to rule-based trading and risk-management. A few graduates of these classes created their own quantitatively-driven CTA funds and gave the rise of managed futures industry.

      Lintner in 1983 provided the first evidence that managed futures deliver better risk-adjusted returns and offer strong diversification benefits for long-only portfolios. The following passage is from Lintner 1983, The Potential Role of Managed Commodity-Financial Futures Accounts (and/or Funds) in Portfolios of Stocks and Bonds:
      “The combined portfolios of stocks (or stocks and bonds) after including judicious investments in appropriately selected sub-portfolios of investments in managed futures accounts (or funds) show substantially less risk at every possible level of expected return than portfolios of stock (or stocks and bonds) alone. This is the essence of the ‘potential role’ of managed futures accounts (or funds) as a supplement to stock and bond portfolios suggested in the title of this paper.”

      Subsequent studies reinforce the role of managed futures for the diversification of broad long-only portfolios, so that currently many private and institutional portfolios have some exposure to managed futures.

      The purpose of this paper is to provide both theoretical and practical insights about trend-following (TF) systems. Let me note that practitioners refer to implemented systematic futures-based strategies as systems or programs.

      Theoretical insights

      For theoretical insights, we establish regimes in which TF systems perform well. For any systematic strategy, it is important to understand under which market dynamics it is expected to out-perform or under-perform.  We derive an exact analytical formula linking the performance of the TF system to the autocorrelation of instrument returns under generic processes. We show that the TF system is expected to be profitable when the autocorrelation of returns is positive even if the drift is zero. We also show that the TF system is expected to be profitable for a white noise process with a large positive or negative drift if the filter span is large.

      For the illustration of obtained analytical results, we focus on fractional ARFIMA process which incorporates both short- and long-term mean reversion and / or trend features, which allows for extensive profitability analysis of TF systems.

      In Figure 1, we illustrate that the TF system can be profitable if the fractional order is positive, so the dynamics are trending in the long-term. In this case, the TF system can be profitable even if the short-term dynamics are mean-reverting.

      Figure 1. Panel (A) shows analytical value of expected annual return of TF system and MC confidence intervals using ARFIMA process with positive long-term memory with fractional order $d=0.02$, which implies long-term trending, with AR-1 feature phi={-0.05, 0.0, 0.05}, and with zero drift. Panel (B) shows expected value of volatility-adjusted turnover and corresponding MC 95% confidence interval.

      In Figure 2, we illustrate that if the fractional order is negative and dynamics are mean-reverting in the long-term, the TF system can still be profitable if drift is present and span of the filter is large.

      Figure 2. Panel (A) shows analytical value of expected annual return of TF system and MC confidence intervals for ARFIMA process with negative long-term memory with fractional order d=-0.01. with AR-1 feature phi={-0.05, 0.0, 0.05} and with drift mu=0.5 (interpreted as Sharpe ratio) . Panel (B) shows expected value of volatility-adjusted turnover and corresponding MC 95% confidence interval.

      Practical Insights

      We have considered three distinct approaches for the construction of trend-following (TF) approaches which we term as European, American, and Time Series Momentum (TSMOM) systems. In Figure 3, we show the simulated performance of three TF systems assuming 2%/20% management/performance fees.

      Figure 3. Simulated performance of of European, American and TSMOM systems along with the historical performance of SG Trend Index. Panels (A1), (B1), and (C1) show the cumulative log-performance, running drawdown, and EWMA correlations with one year span. Panel (A2i) shows risk-adjusted performance table with P.a. returns being annualised return or CAGR, Vol being annualised volatility of daily log returns, Sharpe (rf=0) being Sharpe ratio, Max DD being the maximum drawdown; Skew being the skewness of quarterly log-returns, beta and R^{2} being the the slope and R^{2} of the linear regression of monthly returns relative to 60/40 equity/bond portfolio. Panel (A2ii) shows annual returns. Panels (B2) and (B3) show one year rolling volatility-adjusted turnover and cost, respectively. The background colour is obtained by ordering the quarterly returns of the benchmark 60/40 portfolio from lowest to highest and the splitting the 16% of worst returns into the “bear” regime (pink colour), 16% of best returns into the bull regime (dark green colour), and remaining regimes into “normal” regimes (light green colour). The period of performance measurement is from 31 December 1999 to 1 June 2025.

      This illustration emphasises the robustness of TF systems, as different quantitative models can provide first-order exposure to trending features of financial markets. Most CTA managers pursue to deliver outperformance over the benchmark index by second-order proprietary features including exposures to style factors (carry, value, cross-sectional momentum, etc.), risk-management (portfolio volatility targeting, asset class exposure management, etc.), operational capabilities (exposure to smaller or alternative futures markets, enhanced execution, etc.), and other risk premia (e.g. volatility carry) — see Carver 2023, Advanced Futures Trading Strategies, for a detailed overview of additional features and strategies commonly combined with managed futures.

      Smart Diversification of Long-only Portfolios

      We also analyse the diversification benefits of how blending of TF systems long-only portfolios with long-only portfolios. In Figure 4, we generate blended portfolios with (1-x)% weight to 60/40 Equity/Bond portfolio and with x% weight to each of the three TF systems with x varying from 0% to $100%. Blended portfolios are rebalanced quarterly and, for TF systems, we use their net performance. The initial portfolio on the left is 100%/0% blend of 60/40 portfolio and 0% TF system. The final portfolio on the right is 0%/100% blend. Hereby, we measure portfolio risk by the Bear-Sharpe ratio (the performance in 16% worst quarters of 60/40 equity / bond portfolio) and portfolio performance by total Sharpe ratio.

      Figure 4. Bear-Sharpe ratio vs total Sharpe ratio for blended portfolios with (1-x)% weight to 60/40 portfolio and x% weight to each of the three TF systems. The initial portfolio on the left is 100%/0%$ blend of 60/40 portfolio and 0% TF system. The final portfolio on the right is 0%/100% blend. The specification of TF systems is the same as for generation of Figure 3.

      We observe that the best combination of European and American TF systems that generates the highest Sharpe ratio is the 40%/60% combination of the 60/40 portfolio / TF system. In this case, the realised Bear-Sharpe ratio is close to zero, while the total Sharpe ratio is about 0.9, which is almost double the Sharpe ratios of its components. As we see in Figure 3, the TSMOM system has a Bear-Sharpe ratio attribution of 50% smaller than that of European and American TFs. Thus, the Bear-Sharpe ratio emphasises the diversification efficiency for long-only portfolios.

      We note that, because implementation of a TF system requires only a limited capital for margin requirements of trading futures, a TF system can implemented as an overlay to 100% exposure to a long-only portfolio. If we take the 50%/50% blend (which is not far from the optimal blend 40%/60% in Figure 4 and leverage it twice, we obtain the portfolio with 100% exposure to the 60/40 portfolio and 100% exposure to a TF system. We note that recent advances in portfolio products termed “stacking alphas” or “portable alphas”  (see Gordillo-Hoffstein, 2024, Return Stacking: Strategies For Overcoming A Low Return Environment) are based on the same concept of blending a fixed 100% exposure to a long-only portfolio and 100% (or similar) exposure to a TF system or a general managed futures program.

      Further Applications

      Our results, allow for prediction of the performance of TF systems conditional on certain dynamics, such as ARFIMA process. This could be applied for instrument selection and signal/weights adjustments.

      Given that we also derive a very good approximate formulas for the expected turnover of European TF system, our results can be applied for quick optimisations of TF systems.

      Finally, our “Smart Diversification” based on regime-conditional Sharpe ratios enables for design of overlays using TF systems for long-only portfolios. In particular, we show that the optimal weight, according to our “Smart Diversification”, of TF system for 60/40 portfolio is 50%. Return stacked portfolios are obtained by 2x leverage of 50%/50% blend of 60/40 portfolio / TF system.

      Links

      Our paper is available on SSRN: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3167787

      I presented our paper at CQF Volatility and Risk conference with slides available here and Youtube video of my presentation is available here

      Disclosure

      This research is a personal opinion and it does not represent an official view of my current and last employers.

      This paper and this post do not constitute investment advice in any form.

      Share this:

      • Share on LinkedIn (Opens in new window) LinkedIn
      • Share on X (Opens in new window) X
      • Share on WhatsApp (Opens in new window) WhatsApp
      • Email a link to a friend (Opens in new window) Email
      • Print (Opens in new window) Print
      Posted in Asset Allocation, Quantitative Strategies, Trend-following, Uncategorized | 1 Comment
    • Optimal allocation to cryptocurrencies in diversified portfolios – update on research paper

      Posted at 3:08 pm by artursepp, on August 18, 2024

      Cryptocurrencies have been acknowledged as an emerging asset class with a relatively low correlation to traditional asset classes and independent drivers of their long-term performance (see for an example excellent papers by Harvey et al (2022) and Adams at al (2024)).

      A year ago in Summer of 2023, I published research article in Risk Magazine (SSRN draft) on quantitative methods for optimal allocation to cryptocurrencies within alternative and balanced portfolios. The metrics for consideration include metrics for portfolio diversification, expected risk-return relationships and skewness of the returns distribution. Using roll-forward historical simulations, I showed that all four allocation methods produce a persistent positive allocation to Bitcoin and Ether in alternative and balanced portfolios with a median allocation of about 2.7%.

      This time, I would like to present the updated outcomes from my model given that Bitcoin and Ether had a strong performance of 95% and 35%, respectively, since the last update to today (from 30Jun2023 to 16Aug2024).

      Spoiler: the performance of all four methods for balanced and alts portfolios have been in line with what has been reported in the article with optimal allocation weights to Bitcoin and Ether largely unchanged. Python code for this analysis is available in OptimalPortfolios packadge github repo.

      First I start with the analysis of annual rolling performance. In Subplot (A) of Figure 1, I  show Sharpe ratios (through the paper and this post, the Sharpe ratio is computed using monthly log-returns adjusted by 3m UST rate) for trailing holding periods with the period start given in the first column and the period end given in the first row. For an example, Sharpe ratio realized from the investment period from 31Dec2020 to 16Aug2024 is 0.29.

      Clearly, the early periods before 2017 are characterized with higher realized Sharpe ratios. What is remarkable that any investment period that starts at the end of each calendar year from 2010 to today generated positive Sharpe ratio. In Subplot (B) of Figure 1, I  show the realised skeweness of monthly returns. In early periods, the monthly performance exhibits highly positive skewness. Also more recently the skeweness became positive again.

      Figure1. Realized Sharpe ratios from the period start (given in the first column) to the period end (given in the first row). Subplot (A) shows Sharpe ratio using average monthly log-returns; Subplot (B) shows skewness of monthly returns.

      Methodology

      The long-term positive performance and positive skeweness of cryptocurrency returns pose well for quantitative allocation methods.

      In the paper I consider four quantitative allocation methods for construction of optimal portfolios:
      1) Two risk-based methods which include portfolios constructed using equal risk contribution and with maximum diversification methods.
      2) Two risk-return based methods which include portfolios constructed using maximum Sharpe ratio and maximum CARA-utility methods.

      For the investment universe, I consider the two mandates:

      1) Alternatives (Alts) or unconstrained mandate that targets absolute returns by investing into alternative assets. This mandate is typical for high net worth private investors and family offices.

      2) Benchmarked (Balanced) mandate which targets excess returns over a benchmark by allocating to a balanced equity/bond portfolio with additional overlay to alternative assets. Such a mandate is typical for institutional investors such as pension funds, insurance companies, and endowments.

      As the balanced benchmark, I use the classic 60/40 equity/bond portfolio. I fix the target weight of the balanced portfolio for this mandate to 75% and assign $25%$ allocation to alternative assets. As a result, I consider the modern 70%/30%$approach for allocation portfolio of institutional mandates (see, for an example, McVey et al (2022)) with 30% allocation to bonds, 45% to public equities and 25% to alternative assets.

      I refer to the paper for the investment universe of this mandates (In this analysis I change the benchmark for macro funds from NEIXMTI Index to HFRIMDT Index). For each allocation method, I evaluate the following portfolios given in Table 1 below. Portfolios 1, 2, 3 provide insights into the marginal contribution of including cryptocurrencies to investable universe alternative portfolios. Portfolios 4, 5 and 6 provide with insights into including cryptocurrencies to alternatives for blending with the 60/40 equity/bond portfolio. The marginal contribution of including cryptocurrencies is estimated using 4 portfolios with either BTC or ETH using 4 allocation methods, with total of 16 different portfolio schemes allocated to cryptocurrencies. I sue spot returns for performances of cryptocurrencies. This provides a sufficient depth for making insights.

      Table 1. Simulated mandate portfolios with cryptocurrencies.

      Optimal Portfolios and Their Performances

      I use quarterly rebalancing and roll-forward analysis for generation and backtest of optimal portfolios. I describe the methodology in the paper  and in github package

      Here, I present the result of roll forward simulations from 31Mar2016 t0 16Aug2024. I will present some key figures here, all outputs can be found in pdf report of backtests.

      Maximum Diversification

      Maximum Diversification is my favorite method because it takes into account only the covariance matrix. Also, unlike Equal Risk Contribution method, Maximum Diversification method may produce zero weights to unattractive instruments. In Table 3, I show the risk-adjusted performance of the simulated portfolios without crypto and with inclusion of BTC and ETH cryptocurrencies. The Sharpe ratio is computed using monthly log-returns adjusted by 3m UST rate, beta and (annualised) alpha are computed by regression of monthly returns against 60%/40% equity/bond (Balanced) portfolio.

      The marginal gain of including BTC and ETH is of +0.24 (=0.70-0.46) and +0.29 (=0.75-0.46) in Sharpe ratio for Alternative portfolios and of +0.23 and +0.21 for Balanced portfolios, which is significant.

      In the last 4 rows I show the weight allocated to cryptocurrencies. The median allocation weight is 2.2%/1.9% and 3.13%/3.04% for BTC or ETH in alternatives and balanced portfolios, respectively.

      Table 3. Risk-adjusted performance of Maximum Diversification allocation method.

      In Figure 2, I show the time series of cumulative performances and drawdowns of Maximum Diversification portfolios. Adding cryptocurrencies to the portfolio universe did not materially impact realised drawdowns.

      Figure2. Cumulative performance of portfolios computed using Maximum Diversification allocation method.

      In Figure 3, I show the stack plot of optimal weights for BTC for alternatives and balanced mandates. We observe that the optimal weight of BTC has been persistent through the backtest period, in contract to other asset classes. It is interesting, that the optimal allocation to alternatives within balanced portfolio includes only Bitcoin and SG Trend instruments for the past two years.

      Figure 3. Optimal Allocation weights for alternative and balanced mandates with universe including BTC.

      Equal Risk Contribution

      Equal risk contribution allocates equal buckets for risk (for Balanced mandate, 75% of risk is assigned to the balanced portfolio). We observe that adding cryptocurrencies improves the risk-adjusted performance of alternatives mandate. Interestingly, from the standpoint of the equal risk contribution method, allocations to BTC and ETH are almost same.

      Table 3. Risk-adjusted performance of Equal Risk Contribution allocation method.

      Maximum Sharpe Ratio

      I use the rolling window of 5 years to estimate asset return and covariances for the estimation of the Sharpe ratio. For alternatives portfolio, the contribution to the performance (+0.80 and +0.67 in Sharpe) from adding cryptocurrencies is significant with their median weights of 9% and 4% for BTC and ETH. It is clear that using past returns as inputs to the optimiser may not be robust, however increasing the universe may lead to better results because of higher degree of freedom.

      Table 4. Risk-adjusted performance of Maximum Sharpe Ratio allocation method.

      Carra Mixture Utility

      To estimate the 3-state mixture of returns distribution for the Carra Mixture utility, I also use the rolling window of 5 years. As I explain in the paper, the Carra Mixture Utility allocation method favors instruments with positive skeweness. Similarly to the Maximum Sharpe ratio, adding cryptocurrencies to the alternatives portfolio improves the realised Sharpe ratio considerably by +0.84 and +0.64 with BTC and ETH, respectively. The median allocated weight is 21% and 8% for alternatives mandate and 19% and 8% for the balanced mandate. The higher weights are the result of overweighting instruments with positive skeweness.

      Table 5. Risk-adjusted performance of Carra Mixture Utility allocation method.

      Summary of Weights

      In the summary, I would like to the review the optimal weight to cryptocurrencies. The major goal of my article is to show that cryptocurrencies deserve an allocation for broad portfolios. In my analysis, I did not impose any allocation constraints to make a fair argument.

      In Figure 4 I show the time series of optimal allocations to BTC and ETH by each method and for each mandate. In Table 6, I show summary of weights aggregated from time series.

      Carra Mixture (CARRA-3) allocation method assigns the highest allocation to cryptocurrencies because it favors assets with high positive skewness.

      We observe that the Maximum Sharpe ratio and Carra Mixture, which take into account the rolling performance of assets, have been producing smaller allocation weights in recent years following smaller the risk-adjusted performances of cryptocurrencies.

      However, the risk based methods including Equal Risk Contribution (ERC) and Maximum Diversification (MaxDiv) produce largely stable allocation to cryptocurrencies, which stay largely intact in past couple of years.

      The median of the time series median allocation is 5.7%, 3.8%, 3.0%, 2.4%, which gives a “median”allocation of 3.4% which slightly increased from 2.7% which I reported originally in the paper.

      Figure 4. Optimal weights to BTC and ETH by allocation methods.

      Table 6. Summary of weights

      Further reading

      Enjoy reading the paper and experiment with Python code

      Disclosure

      This research is a personal opinion and it does not represent an official view of my current and last employers.

      This paper and the post is an investment advice in any possible form.

      Cryptocurrencies are associated with high risk.

      Share this:

      • Share on LinkedIn (Opens in new window) LinkedIn
      • Share on X (Opens in new window) X
      • Share on WhatsApp (Opens in new window) WhatsApp
      • Email a link to a friend (Opens in new window) Email
      • Print (Opens in new window) Print
      Posted in Asset Allocation, Crypto, Decentralized Finance, Python, Quantitative Strategies, Uncategorized | 2 Comments
    • Optimal Allocation to Cryptocurrencies in Diversified Portfolios – research paper

      Posted at 1:43 pm by artursepp, on September 13, 2022

      Cryptocurrencies have been acknowledged as an emerging asset class with a relatively low correlation to traditional asset classes. One of the most important questions for allocators is how much to allocate to Bitcoin and to a portfolios cryptocurrency assets within a broad portfolio which includes equities, bonds, and other alternatives. I wrote a research paper addressing this questions. I will provide a short summary here and refer to my paper on SSRN for details.

      I apply four quantitative methods for optimal allocation to Bitcoin cryptocurrency within alternative and balanced portfolios based on metrics of portfolio diversification, expected risk-returns, and skewness of returns distribution. Using roll-forward historical simulations, I show that all four allocation methods produce a persistent positive allocation to Bitcoin in alternative and balanced portfolios. I find that the median of optimisers’ average weights is 2.3% and 4.8% for 100% alternatives and for 75%/25% balanced/alternatives portfolios, respectively. I conclude that Bitcoin may provide positive marginal contribution to risk-adjusted performances of optimal portfolios. I emphasize the diversification benefits of cryptocurrencies as an asset class within broad risk-managed portfolios with systematic re-balancing.

      I start by considering a few drivers that support the allocation to Bitcoin using on statistical properties of its returns (see Harvey et al (2022) for an excellent review of supporting fundamental factors).

      Rolling Performance of Bitcoin returns

      Stellar performances of core cryptocurrencies, including Bitcoin and Ethereum, have been a major supporting factor for investing into cryptocurrencies. However, these performances are realized with high volatilities, so that risk-adjusted performance, for example measured by Sharpe ratio of average log-returns, is not very significant and have been declining over the past years.

      In Subplot (A) of Figure (1) I show Sharpe ratios for trailing holding periods with the period start given in the first column and the period end given in the first row. For an example, Sharpe ratio corresponding to the period from 31 December 2017 to 1 September 2022 is 0.10. It is obvious that most of large gains are attributed to periods prior to the end of 2017, when Bitcoin was little known to investment community. As a result, any historical analysis covering the early years of Bitcoin performance should be taken with caution.

      Figure (1). Realized performance from the period start (given in the first column) to the period end (given in the first row). Subplot (A) shows Sharpe ratio using average monthly log-returns; Subplot (B) shows skewness of monthly returns

      Correlations

      A low correlation with traditional asset classes has been a supporting factor for allocating to cryptocurrencies within broad portfolios. In Figure (2) I show correlation matrices of monthly returns for three different periods: prior to 2018, from 2018 to August 2022, and from 2020 to August 2022. We see that returns of Bitcoin were little correlated to 60/40 portfolio in the early period, however, the correlation between Bitcoin and equities and bonds increased over the past three years. Remarkably, Bitcoin’s correlation with returns on alternative assets has not changed significantly. Thus, the allocation to Bitcoin is still viable within a diversified portfolio of alternatives.

      Figure (2). Correlation matrix of monthly log-returns between assets in the investable universe for three periods. HFs is HFRX Global Hedge Fund Index, SG Macro is SG Macro Trading Index, SG CTA is SG CTA Index, Gold is SPDR Gold ETF (NYSE ticker GLD).

      Positive skewness of distribution of Bitcoin returns

      Positive skewness of returns of cryptocurrencies is a supporting factor for allocation to this asset class. Indeed, in a very interesting paper, Ang et al (2022) argue that for skewness-seeking investors the allocation to Bitcoin could be optimal even if cross-sectional mean return may be negative. However, we observe that the realized skewness of returns of Bitcoin has been declining, following the decline of its Sharpe ratio, as I show in Subplot (B) of Figure (1). While in early years Bitcoin returns are characterized by high positive skewness, the skewness became negative in recent years. Still, the realized skewness of Bitcoin returns is higher than that of traditional assets. Importantly, Ang et al (2022) apply a two-state Normal mixture model to describe the profile of returns on Bitcoin. Further they apply maximization of CARA utility for skewness-seeking investors using this mixture model. I extend the model of Ang et al to multi-asset universe with N assets including Bitcoin.

      I apply Gaussian Mixture model with M clusters to describe the distribution of asset returns conditional on a few clusters. Within each cluster, the distribution of N-dimensional vector of asset returns is normal with vector of estimated means and covariance matrix. I employ Python module sklearn.mixture for the estimation of Gaussian Mixture model and, through cross-validation, I have concluded that using 3 clusters is most robust to model the distribution of monthly returns of assets in our universe. In Figure below, I show the scatterplot of Bitcoin returns vs returns of 60/40 benchmark portfolio and one-std ellipsoids of Gaussian distribution in estimated clusters for two periods.

      Figure (3). Scatter plot and model clusters using estimated Gaussian mixture model. Subplots (A) and (B) show returns data from 19 July 2010 and from 18 December 2017, respectively, to 31 August 2022. Subplots (C) and (D) show corresponding cluster parameters for Bitcoin.

      Portfolio Allocation Methods

      I consider four quantitative asset allocation methods for construction of optimal portfolios.

      Risk-only based methods which include portfolios with equal risk contribution (denoted by ERC) and with maximum diversification (MaxDiv).

      Risk-return based methods which include portfolios with maximum Sharpe ratio (MaxSharpe and with maximum CARA-utility.

      For each allocation method, I evaluate the following portfolios:

      1. 100% Alts w/o BTC is the portfolio including alternative assets excluding Bitcoin;
      2. 100% Alts with BTC is the portfolio including alternative assets and Bitcoin;
      3. 75%/25% Bal/Alts w/o BTC is the portfolio with fixed allocation to 75% of balanced 60/40 equity/bond portfolio and 25% allocation to alternative assets excluding Bitcoin;
      4. 75%/25% Bal/Alts With BTC is the portfolio with fixed allocation to 75% of balanced 60/40 equity/bond portfolio and 25% allocation to alternative asset classes including Bitcoin.

      Portfolios 1 and 2 enable us to analyze the marginal contribution of including Bitcoin to the investable universe of alternative portfolios. Portfolios 2 and 3 provide with insights into including Bitcoin to alternatives universe for constructing overlays for 60/40 equity/bond portfolio.

      Optimal weights

      In table below, I show the statistics of time series of optimal weights to Bitcoin produced by the four implemented portfolio optimisers. First, it is notable that all four optimizers produced non-zero weights at all quarterly re-balancing (because the time series minimum is higher than zero) for both portfolios, except for the last quarterly rebalancing of the most diversified 75%/25% portfolio. The optimization of CARA utility produced the highest allocation to Bitcoin for both portfolios, because Bitcoin adds most to the skewness of portfolio returns that is favorable for CARA method. However, the CARA portfolios have the lowest historical allocation to Bitcoin because of declining skewness of its returns. The median of optimisers’ average weights is 2.3% and 4.8% for 100% alts and 75%/25% alts/balanced portfolios, respectively. As a result, including of Bitcoin to the investable universe is beneficial for diversification benefits of broad portfolios.

      Figure (4). Minimum, average, maximum, and last weight (as of last quarterly re-balancing on 30 June 2022) to Bitcoin by allocation methods computed using roll-forward simulations from 30 June 2015 to 31 August 2022. Subplot (A) shows the weight in the 100% alternatives portfolio, Subplot (B) shows the weight in the 75%/25% balanced and alts portfolio. ERC is portfolio with equal risk contribution, MaxDiv is portfolio with maximum diversification, MaxSharpe is portfolio with maximum Sharpe ratio, CARA-3 is portfolio with maximum CARA utility under Gaussian mixture model with 3 clusters.

      Trailing performance

      In below table I show trailing realized Sharpe ratios of simulated optimal portfolios. I add equally weighted portfolio as a benchmark. For 100% alts portfolio w/o and with Bitcoin, the weight of Bitcoin is fixed to 0% and 2%, respectively, while the rest is equally allocated to alternative assets. For 75%/25% balanced/alts portfolio w/o and with Bitcoin, the weight of Bitcoin is fixed to 0% and 0.5%, respectively, the weight of 60/40 portfolio is 75% and rest is equally allocated to alternatives.

      First, comparing 100\% alts portfolio w/o and with Bitcoin, we see that adding Bitcoin to the investable universe increased Sharpe ratios over the past periods of 2, 3, 5, 7 years except for the portfolio with maximum Sharpe ratio. The performance over the last year is better for portfolios without Bitcoin. However, I emphasize a robust positive performance of risk-based portfolios with and without Bitcoin in comparison to a poor performance of the benchmark balanced portfolio.

      Contrasting 75%/25% balanced/alts portfolio w/o and with Bitcoin, we see that including Bitcoin benefits most of portfolios over all trailing periods. The exceptions include, first, the portfolio with the maximum Sharpe ratio and, second, for the ERC portfolio which slightly under-performs when Bitcoin is added.

      A poor relative performance of portfolios with maximum Sharpe ratio highlights the hazard of relying on past data for forecast of future returns. In contrast, out-performers include risk-based methods that rely on the dynamic update of covariance matrices using most recent data.

      Figure (5) Sharpe ratios for trailing periods of 1, 2, 3, 5, 7 years starting from 31 August 2021, 2020, 2019, 2017, 2016, respectively, up to 31 August 2022. 60/40 is the benchmark equity/bond balanced portfolio, and EqualWeight w/o and with BTC are equally weighted portfolios with fixed 0% and 2% weights to Bitcoin, respectively.

      Conclusion

      I present empirical evidence that it has been optimal to include Bitcoin to an investable universe for alternative and blended portfolios, using portfolio diversification metrics. Using roll-forward analysis with dynamic updates of portfolio inputs, I also find that adding Bitcoin have improved performances of optimal portfolios.

      I conclude that adding Bitcoin, and more generally, a diversified basket of cryptocurrencies, to the investable universe of broad portfolios may be beneficial for both alternative portfolios and blended balanced/alternative portfolios. I emphasize the need for a robust portfolio allocation method with regular updates of portfolio inputs and re-balancing of portfolio weights.

      My favorite allocation method is the optimiser of portfolio diversification metric along with the optimiser of the CARA utility under Gaussian mixture distribution for skewness-seeking investors.

      Further details are provided in my paper on SSRN http://ssrn.com/abstract=4217841

      Disclaimer

      The views and opinions presented in this article and post are mine alone. This research is not an investment advice.

      Share this:

      • Share on LinkedIn (Opens in new window) LinkedIn
      • Share on X (Opens in new window) X
      • Share on WhatsApp (Opens in new window) WhatsApp
      • Email a link to a friend (Opens in new window) Email
      • Print (Opens in new window) Print
      Posted in Asset Allocation, Crypto, Decentralized Finance, Quantitative Strategies | 2 Comments
    • Developing systematic smart beta strategies for crypto assets – QuantMinds Presentation

      Posted at 3:09 pm by artursepp, on February 23, 2022

      I am delighted to share the video from my QuantMinds presentation that I made in Barcelona in December 2021. Many thanks to QuantMinds organizers for allowing me to share this video. First, it was nice to attend the onsite conference in a while and to meet old friends and colleagues. I was positively surprised by how many people attended. Many thanks to organizers for making it happen during these uncertain times!

      I presented a framework for the design of sector-based smart beta indices and products for diversified investing to crypto assets. There are thee challenges to account for when designing a systematic strategy on crypto assets.

      First, the data quality is poor indeed. We need to tackle the enormous challenge to accommodate and filter data from multiple data providers. Unlike the traditional asset classes, the market data for public data (such as market cap and traded volumes) can be a source of alpha for systematic strategies.

      Second, the time history of data is very short. For example, most of protocol tokens for Decentralized Finance (DeFi) applications were listed during the second half of 2020, which means that we have to ascertain the design and risk-reward profile of a strategy using one year of data.

      Third, the liquidity of crypto assets may be insufficient when contrasted with traditional assets. Therefore, we need to carefully design strategies by screening and incorporating the liquidity into the process. One of the challenges is that most crypto exchanges (there are about 30 tier one exchanges) tend to over-estimate their traded volumes.

      To overcome these challenges, I constructed a bootstrapping simulation engine which allows to generate joint paths of price and fundamental data for the empirical distributions without breaking the correlation and auto-correlation structure of dependencies in the data.

       

       

       

      Share this:

      • Share on LinkedIn (Opens in new window) LinkedIn
      • Share on X (Opens in new window) X
      • Share on WhatsApp (Opens in new window) WhatsApp
      • Email a link to a friend (Opens in new window) Email
      • Print (Opens in new window) Print
      Posted in Asset Allocation, Crypto, Decentralized Finance, Quantitative Strategies | 2 Comments
    • Tail risk of systematic investment strategies and risk-premia alpha

      Posted at 2:55 pm by artursepp, on April 9, 2019

      Everyone knows that the risk profile of systematic strategies can change considerably when equity markets turn down and volatilities spike. For an example, a smooth profile of a short volatility delta-hedged strategy in normal regimes becomes highly volatile and correlated to equity markets in stressed regimes.

      Is there a way to systematically measure the tail risk of investment products including hedge funds and alternative risk premia strategies? Further, how do we measure the risk-premia compensation after attribution for tail risks? Finally, would we discover patterns in cross-sectional analysis of different hedge fund strategies?

      I have been working through years on a quantitative framework to analyse the above raised questions and recently I wrote two articles on the topic:

      1. The regime-conditional regression model is introduced in The Hedge Fund Journal (online paper).
      2. A short review of the methodology and results is presented for QuantMinds

      I would like to highlight the key results of the methodology so that interested readers can further follow-up with the original sources.

      Regime conditional index betas

      In the top Figure, I show the regime conditional betas for a selection of hedge fund style from HFR indices data using the S&P 500 index as the equity benchmark.

      We can classify the strategies into defensive and risk-seeking based on their return profile in bear market regimes:

      1. Defensive strategies (long volatility, short bias, trend-following CTAs) have negative equity betas in bear regime so that these strategies serve as diversifiers of the equity downside risk.
      2. Risk-seeking strategies (short volatility, risk-parity) have positive and significant equity betas in bear regime. Equity betas of most of risk-seeking strategies are relatively small in normal and bull periods but equity betas increase significantly in bear regimes. I term these strategies as Risk-seeking risk-premia strategies.
      3. I term strategies with insignificant betas in normal bear regimes as Diversifying strategies. Examples include equity market neutral and discretionary macro strategies because, even though these strategies have positive betas to the downside, the beta profile does not change significantly between normal and bear regimes. As a result, the marginal increase in beta exposure between normal and bear periods is insignificant.

      Risk-premia alpha vs marginal bear beta

      I define the risk-premia alpha as the intercept of the regime-conditional regression model for strategy returns regressed by returns on the benchmark index. To show a strong relationship between the risk-premia alpha and marginal bear beta (the marginal bear betas are computed as the difference between betas in normal and bear regimes), I apply the cross-sectional analysis of risk premia for the following sample of hedge fund indices and alternative risk premia (ARP) products, using quarterly returns from 2000 to 2018 against the S&P 500 total return index:

      1. HF: Hedge fund indices from major index providers including HFR, SG, BarclayHedge, Eurekahedge with the total of 73 composite hedge fund indices excluding CTA indices;
      2. CTA: 7 CTA indices from the above providers and 15 CTA funds specialized on the trend-following;
      3. Vol: 28 CBOE benchmark indices for option and volatility based strategies;
      4. ARP: ARP indices using HFR Bank Systematic Risk-premia Indices with a total of 38 indices.

      In figure below, I plot risk-premia alphas against marginal bear betas grouped by strategy styles. For defensive strategies, their marginal bear betas are negative; for risk-seeking strategies, the marginal bear betas are positive and statistically significant.

      cross_sectional_rp 20190405-085150

      We see the following interesting conclusions.

      1. For volatility strategies, the cross-sectional regression has the strongest explanatory power of 90%. Because a rational investor should require a higher compensation to take the equity tail risk, we observe such a clear linear relationship between the marginal tail risk and the risk-premia alpha. Defensive volatility strategies that buy downside protection have negative marginal betas at the expense of negative risk-premia alpha.
      2. For alternative risk premia products, the dispersion is higher (most of these indices originate from 2007), yet we still observe the pattern between the defensive short and risk-seeking risk-premia strategies with negative and positive risk-premia alpha, respectively.
      3. For hedge fund indices, the dispersion of their marginal bear beta is smaller. As a result, most hedge funds serve as diversifiers of the equity risk in normal and bear periods; typical hedge fund strategies are not designed to diversify the equity tail risk.
      4. All CTA funds and indices have negative bear betas with insignificant risk-premia alpha. Even though their risk-premia alpha is negative and somewhat proportional to marginal bear beta is proportional, the risk-premia alpha is not statistically significant. In this sense, CTAs represent defensive active strategies. The contributors to slightly negative risk-premia alpha may include transaction costs and management fees.

       

      References

      Sepp A., Dezeraud L., (2019), “Trend-Following CTAs vs Alternative Risk-Premia: Crisis beta vs risk-premia alpha”, The Hedge Fund Journal, Issue 138, page 20-31, https://thehedgefundjournal.com/trend-following-ctas-vs-alternative-risk-premia/

      Sepp, A. The convexity profile of systematic strategies and diversification benefits of trend-following strategies, QuantMinds, April 2019

      Share this:

      • Share on LinkedIn (Opens in new window) LinkedIn
      • Share on X (Opens in new window) X
      • Share on WhatsApp (Opens in new window) WhatsApp
      • Email a link to a friend (Opens in new window) Email
      • Print (Opens in new window) Print
      Posted in Asset Allocation, Quantitative Strategies, Trend-following, Uncategorized, Volatility Modeling | 1 Comment
    • Machine Learning for Volatility Trading

      Posted at 6:33 am by artursepp, on May 29, 2018

      Recently I have been working on applying machine learning for volatility forecasting and trading. I presented some of my findings at QuantMinds Conference 2018 which I wanted to share in this post.

      My presentation is available at SSRN with the video of the talk in YouTube.

      Continue reading →

      Share this:

      • Share on LinkedIn (Opens in new window) LinkedIn
      • Share on X (Opens in new window) X
      • Share on WhatsApp (Opens in new window) WhatsApp
      • Email a link to a friend (Opens in new window) Email
      • Print (Opens in new window) Print
      Posted in Asset Allocation, Quantitative Strategies, Uncategorized, Volatility Modeling, Volatility Trading | 3 Comments
    • Trend-following strategies for tail-risk hedging and alpha generation

      Posted at 11:39 am by artursepp, on April 24, 2018

      Because of the adaptive nature of position sizing, trend-following strategies can generate the positive skewness of their returns, when infrequent large gains compensate overall for frequent small losses. Further, trend-followers can produce the positive convexity of their returns with respect to stock market indices, when large gains are realized during either very bearish or very bullish markets. The positive convexity along with the overall positive performance make trend-following strategies viable diversifiers and alpha generators for both long-only portfolios and alternatives investments.

      I provide a practical analysis of how the skewness and convexity profiles of trend-followers depend on the trend smoothing parameter differentiating between slow-paced and fast-paced trend-followers. I show how the returns measurement frequency affects the realized convexity of the trend-followers. Finally, I discuss an interesting connection between trend-following and stock momentum strategies and illustrate the benefits of allocation to trend-followers within alternatives portfolio.

      Interested readers can download the pdf of my paper on SSRN

      Key takeaway

      1. Risk-profile of quant strategies

      The skewness and the convexity of strategy returns with respect to the benchmark are the key metrics to assess the risk-profile of quant strategies. Strategies with the significant positive skewness and convexity are expected to generate large gains during market stress periods and, as a result, convex strategies can serve as robust diversifiers. Using benchmark Eurekahedge indices on major hedge fund strategies, I show the following.

        • While long volatility hedge funds produce the positive skewness, they do not produce the positive convexity.
        • Tail risk hedge funds can generate significant skewness and convexity, however at the expense of strongly negative overall performance.
        • Trend-following CTAs can produce significant positive convexity similar to the tail risk funds and yet trend-followers can produce positive overall performance delivering alpha over long horizons.
        • On the other spectrum, short volatility funds exibit significant negative convexity in tail events.

      Fig2HFconv

      HFSkew

      Continue reading →

      Share this:

      • Share on LinkedIn (Opens in new window) LinkedIn
      • Share on X (Opens in new window) X
      • Share on WhatsApp (Opens in new window) WhatsApp
      • Email a link to a friend (Opens in new window) Email
      • Print (Opens in new window) Print
      Posted in Asset Allocation, Quantitative Strategies, Trend-following, Uncategorized | 1 Comment
    • Diversifying Cyclicality Risk of Quantitative Investment Strategies: presentation slides and webinar Q&A

      Posted at 5:21 pm by artursepp, on December 1, 2017

      What is the most significant contributing factor to the performance of a quantitative fund: its signal generators or its risk allocators? Can we still succeed if we have good signal generators but poor risk management? How should we allocate to a portfolio of quantitative strategies?

      I have developed a top-down and bottom-up model for portfolio allocation and risk-management of quantitative strategies. The interested readers can find  the slides of my presentation here  and can watch the webinar can be viewed on youtube.

      Keep on Reading!

      Share this:

      • Share on LinkedIn (Opens in new window) LinkedIn
      • Share on X (Opens in new window) X
      • Share on WhatsApp (Opens in new window) WhatsApp
      • Email a link to a friend (Opens in new window) Email
      • Print (Opens in new window) Print
      Posted in Asset Allocation, Quantitative Strategies, Trend-following, Uncategorized, Volatility Modeling, Volatility Trading | 1 Comment
    • Allocation to systematic volatility strategies using VIX futures, S&P 500 index puts, and delta-hedged long-short strategies

      Posted at 3:45 pm by artursepp, on September 20, 2017

      I present a few systematic strategies for investing into volatility risk-premia and illustrate their back-tested performance. I apply the four factor Fama-French-Carhart model to attribute monthly returns on volatility strategies to returns on the style factors. I show that all strategies have insignificant exposure to the style factors, while the exposure to the market factor becomes insignificant when strategies are equipped with statistical filtering and delta-hedging. I show that, by allocating 10% of portfolio funds to these strategies within equity and fixed-income benchmarked portfolios, investors can boost the alpha by 1% and increase the Sharpe ratio by 10%-20%.

      Keep on Reading!

      Share this:

      • Share on LinkedIn (Opens in new window) LinkedIn
      • Share on X (Opens in new window) X
      • Share on WhatsApp (Opens in new window) WhatsApp
      • Email a link to a friend (Opens in new window) Email
      • Print (Opens in new window) Print
      Posted in Asset Allocation, Quantitative Strategies, Uncategorized, Volatility Modeling, Volatility Trading | 4 Comments
    ← Older posts
    • Receive notifications of new posts by email

      Join 351 other subscribers
    • Recent Posts

      • All-weather or 60/40? A portfolio backtest with qis
      • The Science and Practice of Trend-following Systems: paper and presentation
      • Lognormal Stochastic Volatility – Youtube Seminar and Slides
      • Optimal allocation to cryptocurrencies in diversified portfolios – update on research paper
      • Unified Approach for Hedging Impermanent Loss of Liquidity Provision – Research paper
      • Log-normal stochastic volatility with quadratic drift – open access publication
      • Stochastic Volatility for Factor Heath-Jarrow-Morton Framework – research paper
      • AD Derivatives podcast on volatility modeling and DeFi
      • What is a robust stochastic volatility model – research paper
      • Robust Log-normal Stochastic Volatility for Interest Rate Dynamics – research paper
      • Optimal Allocation to Cryptocurrencies in Diversified Portfolios – research paper
      • Log-normal Stochastic Volatility Model for Assets with Positive Return-Volatility Correlation – research paper
      • Developing systematic smart beta strategies for crypto assets – QuantMinds Presentation
      • Toward an efficient hybrid method for pricing barrier options on assets with stochastic volatility – research paper
      • Paper on Automated Market Making for DeFi: arbitrage-fee exchange between on-chain and traditional markets
      • Tail risk of systematic investment strategies and risk-premia alpha
      • Trend-Following CTAs vs Alternative Risk-Premia (ARP) products: crisis beta vs risk-premia alpha
      • My talk on Machine Learning in Finance: why Alternative Risk Premia (ARP) products failed
      • Why Python for quantitative trading?
      • Machine Learning for Volatility Trading
    • Categories

      • Asset Allocation (11)
      • Crypto (8)
      • Decentralized Finance (5)
      • Python (5)
      • Quantitative Strategies (18)
      • Trend-following (4)
      • Uncategorized (21)
      • Volatility Modeling (18)
      • Volatility Trading (13)

Loading Comments...
%d