Artur Sepp Blog on Quantitative Investment Strategies

  • Blog
  • Research
  • About
    • 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
    • Lognormal Stochastic Volatility – Youtube Seminar and Slides

      Posted at 6:14 am by artursepp, on October 25, 2024

      I would like to share the youtube video of my online seminar at Minnesota Center for Financial and Actuarial Mathematics and presentation slides.

      I discuss the motivation behind introducing Karasinki-Sepp log-normal stochastic volatility (SV) model in our IJATF paper with Parviz Rakhmonov. I briefly highlight the advantages of this model over existing SV models. Then I focus on new features of the model.

      For the first time, I formulate the dynamic of log-normal SV model consistent with the forward variance by construction. This formulation enables to automatically fit the model to a given term structure of variance swap strikes implied from market prices. I show that there is a small modification of the closed-form solution presented in our paper so that the existing solution can be applied here as well.

      Also for the first time, I introduce the rough formulation of the log-normal SV model. I note that our exponential affine expansion for the classic log-normal SV model can also be applied for the rough version, but it results in a system of multi-variate system of integral equations which is numerically tedious. We need to resort tom Monte-Carlo simulations of this model and Deep Learning for model calibration. This is work in progress so stay tuned.

      Finally, I present the model calibration to the time series of implied volatilities of options on Bitcoin traded on Deribit. I touch upon the calibration of mean-reversion parameters using empirical auto-correlation function discussed in our paper. The rest of model parameters: the current level and long-term mean volatility, volatility beta, and volatility-of-volatility are fitted in time series calibration.

      Below I show that the model error (the average difference between market and model implied volatility) is less than 1% most of the times. The volatility beta serves as the expected skeweness indicator switching from large negative values during risk-aversion and positive values during risk-seeking periods. This time series construction can serve as a base for relative value analysis and quant trading strategies.

      I mention that Python implementation of model is available in stochvolmodels package at Github. See an example of running the log-normal SV model and example of model calibration using the new formulation of term structure consistent with impled variance.

       

      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.

      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 Crypto, Python, Volatility Modeling, Volatility Trading | 2 Comments
    • 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
    • Unified Approach for Hedging Impermanent Loss of Liquidity Provision – Research paper

      Posted at 7:16 pm by artursepp, on July 9, 2024

      Let me introduce our research paper co-authored with Alexander Lipton and Vladimir Lucic for hedging of impermanent loss of liquidity provision (LP) staked at Decentralised Exchanges (DEXes) which employ Uniswap V2 and V3 protocols.

      Uniswap V3 protocol allows liquidity providers to concentrate liquidity in specified ranges. As a result, the liquidity of the pool can be increased in certain ranges (typically around the current price) and the potential to generate more trading fees from the LP is increased accordingly. I illustrate the dynamics of staked LP using ETH/USDT pool as an example. A liquidity provider stakes liquidity to a specific range using initial amount of ETH and USDT tokens as specified by Uniswap V3 CFMM. When the price of ETH falls, traders use the pool to swap USDT by depositing ETH, so that the LP accrues more units of ETH. Thus when ETH falls persistently, the liquidity provider ends up holding more units of the depreciating asset, which is similar to being short a put option. In opposite, when ETH price increases, traders will deplete ETH reserves from the pool by depositing
      USDT tokens. Thus, the liquidity provider ends up holding less units of the appreciating asset, which is similar to being short a call option. The combined effect of increasing / decreasing the exposure to depreciating / appreciating asset leads to what is known as the impermanent loss in Decentralised Finance (DeFi) applications.

      In Figure 1, I show ETH units (left y-axis) and USDT units (right y-axis) for LP on Uniswap V3 with 1m USDT notional and p_{0}=2000, p_{a}=1500, p_{b}=2500. The initial LP units of (ETH, USDT) are (220, 559282). The red bar at p=1500 shows LP units of (543, 0) with LP fully in ETH units when price falls below lower threshold p_{a}. The
      green bar at $p=2500$ shows corresponding LP units of (0, 1052020) with LP fully in USDT units when price rises above upper threshold p_{b}. In subplot (B), we show USDT values of 50%/50% ETH/USDT portfolio, Funded LP positions (funded LP involves the purchase of ETH for staking without any delta hedge) and Borrowed LP positions (Borrowed LP is produced by static delta hedge of the initial staked position in ETH).

      The value profile of funded LP resembles the profile of a covered call option (long ETH and short out-of-the-money call). The value of the borrowed LP resembles the payoff of a short straddle (short both at-the-money call and put).

      Figure 1. The impremanent loss of funded and borrowed LP position

      (A) ETH units (left y-axis) and USDT units (right y-axis) for LP on Uniswap V3. (B) USDT value of 50%/50% ETH/USDT portfolio, Funded LP position and Borrowed LP position. Uniswap V3 LP position is constructed using 1m USDT notional with p_{0}=2000, p_{a}=1500, p_{b}=2500.

       

      We define the protection claim against the impermanent loss (IL) as a derivative security whose payoff at time T equals to negative value of the IL.

      We develop static model-independent and dynamic model-dependent approaches for hedging of the IL of liquidity provision (LP) staked at Decentralised Exchanges (DEXes) which employ Uniswap V2 and V3 protocols.

      For staking of BTC and ETH with liquid options market, the liquidity provider can apply out static model-independent replication to eliminate the IL completely.

      In Figure 2, I illustrate the replicating of IL for borrowed Uniswap V3 LP. I use strikes with widths of 50 USDT in alignment with ETH options traded on Deribit exchange (for options with maturity of less than 3 days, Deribit introduces new strikes with widths of $25$). In subplot (A), I show the IL of the borrowed LP position, and the payoffs of replicating calls and puts portfolios (with negative signs to align with the P&L). In subplot (B), we show the residual computed as the difference between the IL and the payoff of the replication portfolios. In Subplot (C), I show the number of put and call option contracts for the replication portfolios. It is clear that the approximation error is zero at
      strikes in the grid, which is illustrated in subplot (B). The maximum value of the residual is 0.025% or 2.5 basis points, which is very small. A small approximation error with a similar magnitude will occur in case, p_{0}, p_{a}, p_{b} are not placed exactly at the strike grid.

      Figure 2. Replication of IL of borrowed Uniswap V3 LP for allocation of 1m USDT notional, p_{0}=2000 ETH/USDT with p_{a}=1500 and p_{b}=2500. (A) Impermanent loss in USDT and (negative) values of replicating puts and call portfolios; (B) Residual, which is the spread between IL and options replication portfolios; (C) Number of option contracts for put and calls portfolios.

       

      For cryptocurrencies without a liquid options market develop the model-dependent valuation and dynamics hedging of IL protection claims for Uniswap V2 and V3 protocols. Model-based valuation can be employed by a few crypto trading companies that currently sell over-the-counter IL protection claims. When using model-based dynamics delta-hedging for the replication of the payoff of the IL protection claim, the profit-and-loss (P&L) of the dynamic delta-hedging strategy will be primarily driven by the realised variance of the price process. Thus, the total P&L of a trading desk will be the difference between premiums received (from selling IL protection claims) and the variance realised through delta-hedging. Trading desk can employ our results for the analysis of price dynamics and hedging strategies which optimize their total P&L.

      The simplest dynamic model is of course the Black-Scholes-Merton model which allows to analyze the sensitivity of the price for IL protection as a function of a single parameter for log-normal volatility

      In Figure 3, I show the annualised cost (APR) % for the cost of BSM hedge for the borrowed LP as a function of the range multiple m such that p_{a}(m)=e^{-m}p_{0} and p_{b}(m)=e^{m}p_{0}. I use two weeks to maturity T=14/365 and different values of log-normal volatility \sigma. All being the same, it is more expensive to hedge
      narrow ranges.

      Figure 3. BSM premium annualised (U^{borrower}(t, p_{t})/T) for borrowed LP with time to maturity of two weeks and notional of 1 USDT as function of the range multiple m such that p_{a}(m)=e^{-m}p_{0} and p_{b}(m)=e^{m}p_{0}.

       

      Further, we consider a wide class of dynamics models with jumps and stochastic volatility for which the moment generating function (MGF) for the log-return  is available in closed-form. The closed-form solution for the MGF is available under a wide class of models including jump-diffusions and diffusions with stochastic volatility. Thus, we can
      develop analytic solution for model-dependent valuation of IL protection under various models with analytic MGF.

      In particular, we apply the log-normal SV model which can handle positive correlation between returns and volatility observed in price-volatility dynamics of digital assets (see my paper with Parviz Rakhmonov for details).

      In Subplot (A) of Figure 4, I show the implied volatilities of the log-normal SV model for a range of volatility of residual volatility with zero volatility beta (which is typical for ETH skews). In Subplot (B), I show the premium APR for IL protection as a function of range multiple for a range of volatility-of-volatility. We see that the model-value of IL protection is is not very sensitive to tails of implied distribution (or, equivalently, to the convexity of the implied volatility). The reason is that the most of the value of IL protection is derived from the center of returns distribution.

      Figure 4. (A) BSM volatilities implied by log-normal SV model as function of volatility-of-volatility parameter ; (B) Premiums APR computed using log-normal SV model for borrowed LP as function of the range multiple m such that p_{a}(m)=e^{-m}p_{0} and p_{b}(m)=e^{m}p_{0}.

      For liquidity providers, who buy IL protection claims for their LP position, the total P&L will be driven by the difference between accrued fees from LP positions and costs of IL protection claims. The cost of the IL protection claim can be estimated beforehand using either the cost of static options replicating portfolio or costs of buying IL protection from a trading desk. As a result, liquidity providers can focus on selecting DEX pools and liquidity ranges where expected fees could exceed hedging costs. Thus, liquidity providers can apply our analysis optimal allocation to LP pools and for creating static replication portfolios using either traded options or assessing costs quoted by providers of IL protection.

      We leave the application of our model-free and model-dependent results for an optimal liquidity provision and optimal design of LP pools for future research.

      Enjoy reading the paper available on SSRN https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4887298

      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 Crypto, Decentralized Finance, Uncategorized, Volatility Modeling | 1 Comment
    • Log-normal stochastic volatility with quadratic drift – open access publication

      Posted at 5:01 pm by artursepp, on March 7, 2024

      Our article “Log-normal Stochastic Volatility Model with Quadratic Drift” co-authored with Parviz Rakhmonov is published in International Journal of Theoretical and Applied Finance with open access https://www.worldscientific.com/doi/10.1142/S0219024924500031

      The log-normality of realised and implied volatilities of asset returns is a well-documented empirical feature. For example, see Christoffersen-Jacobs-Mimouni (2010) for equity indices and Andersen-Lund (1997) for short-term interest rates. Yet, the difficulty in implementing log-normal stochastic volatility (SV) models in practice is that these models are not analytically tractable due to being non-affine, so that standard techniques for affine SV model cannot be applied here. Our key contribution is the closed-form accurate and fast approach for valuation of vanilla options under the log-normal SV model.

      I have started working on the log-normal SV model back in 2012 together with Piotr Karasinski and we published a joint paper in Risk. Over years, I have developed the affine expansion for log-normal SV model which is analytic (up to solving a system of ODEs) and which provides a very accurate solution to the moment generating function (MGF) arising in log-normal SV models. Be means of this solution to the MGF, we can value vanilla options using methods developed for valuation under affine models, including the Lipton-Lewis formula.

      With Parviz, we have extended Karasinki-Sepp stochastic volatility model by adding a quadratic mean-reversion to the drift, which turns to be important for the model to be functionally invariant under different numeraire measures (see our paper on this topic). We have provided detailed proofs on important aspect of our model including the positivity and finiteness of the volatility process, the martingality of the price dynamics, the existence of the solution for valuation equation in this model, and the stability of the affine expansion. The most parts of our paper are technical to address these necessary topics.

      We have also included the illustration of model calibration to options data on Bitcoin from April 2019 to October 2023. For this extended period, we show that the model can fit accurately to the market data across different market regimes with low/high volatilities, positive/negative skews, and  steep/flat convexities of market implied volatilities.

      A big advantage of using the log-normal SV model in a traditional quant valuation setup, it that the model is easy to implement for Monte-Carlo (MC) simulations and for numerical PDE solvers using the the logarithm of the volatility as a modelling variable, which is defined on unrestricted domain. In contrast, affine models require to handle the positivity of the volatility in MC simulations and PDEs solvers, which is not trivial. The availability of closed-form solution for vanilla options enables fast model calibration to market data.

      Finally, our log-normal SV model is conceptually robust because if can be applied for valuation of derivatives on different asset classes. In particular, we apply this model to interest rates (see application to Cheyette model here and to Factor HJM model here), whereas traditional SV models have many limitations when it comes to modeling dynamics of fixed income  derivatives.

      For transparency and as a courtesy to the readers, Python implementation of the analytics from the paper for valuation under our log-normal SV model is available in Github.

      Enjoy reading and testing our model.

      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 Volatility Modeling | 2 Comments
    • Stochastic Volatility for Factor Heath-Jarrow-Morton Framework – research paper

      Posted at 9:29 am by artursepp, on March 2, 2024

      Let me present our recent research paper with Parviz Rakhmonov on the stochastic volatility model for Factor Heath-Jarrow-Morton (HJM) interest rate framework (available on SSRN: Stochastic Volatility for Factor Heath-Jarrow-Morton Framework).

      Factor Heath-Jarrow-Morton (HJM) model

      Under the risk-neutral measure, the interest rate curve can be conveniently modeled using the forward curve f_t(tau) where tau is rate tenor. It is well known that the bond prices can be reconstructed from f_t(tau). When we develop a model for the evolution of forward curve f_t(tau), the HJM framework imposes conditions on the drift of the forward curve f_t(tau) so that the future forward curve reprices (in expectation) the term structure seen today. In practice, this requires using multi-dimensional models and handling path-dependency. See a brief intro to HJM and references in wikipedia.

      When we apply a finite dimensional basis for modelling of the forward rate under statistical measure P, the core difficulty is to derive the corresponding factor dynamics under the risk-neutral measure Q. The paper by Lyashenko and Goncharov provides a straightforward way for augmentation of P-dynamics so that the Q-dynamics are arbitrage-free and consistent with the initial term structure of forward rates by construction.

      Nelson-Siegel Term Structure model

      Nelson-Siegel Term Structure model provides a convenient way to model the forward curve f_t(tau) under the statistical P-measure using just 3 factors for the level, slope, and convexity of the terms structure of forward rates. This model is widely used by central banks due to its intuitiveness and due to its good consistency with time series of rates data.

      In our paper, we develop a generic Factor HJM model extended this model with the stochastic volatility using our previous paper for modelling stochastic volatility of one-factor interest rate model. As a base case, we apply the dynamics of Nelson-Siegel factors under P-measure with stochastic log-normal volatility of this factors.

      We find that this approach is well aligned with the popularity of Nelson-Siegel model and extends this model for realistic P-modeling of factors with stochastic volatility. It is well-established that stochastic volatility models can model empirical features such as volatility clustering, auto-correlations, and heavy-tails, while log-normality of rates volatility for one-factor models is well documented. We apply our developed log-normal stochastic volatility with quadratic drift as a driver for volatility of Nelson-Siegel factors.

      For valuation purposes, we derive the model dynamics under risk-neutral Q-measure. The advantage of our framework is that is fully analytic, and it allows for consistent valuation and risk management of interest rate derivatives including swaps, swaptions, futures rates and options on futures rates.

      Simulations of Nelson-Siegel Term Structure model with Log-normal Stochastic Volatility

      In this post, I will illustrate some possible outputs from our model using Monte Carlo simulations. First, I apply the inference of  Nelson-Siegel factors using Diebold-Li approach. Then I use the term structure of US rates observed at the end of February 2024 and I apply model parameters calibrated to swaptions data. In Figure 1, I show the term structure of US Treasury yields and fitted Nelson-Siegel curve. The model fit is very good. For pricing purposes under risk-neutral measure Q, we introduce a small deterministic curve so that the given yield curve is fitted exactly.

      Figure 1. Initial US Treasury yields and fitted Nelson-Siegel curve

      Next I simulate the factors of Nelson-Siegel model under P-measure as shown in Figure 2 for the simulation horizon of one year using the initial Nelson-Siegel curve in Figure 1. For brevity, in Figure 2, I show only 10 paths. Factors 1, 2, 3 are the level, slope, and convexity drivers of the forward curve. Realisations of factor X1 model possible evolution for overall level of rates: we observe a range of outcomes from 1.5% to 5.0% in 1 year. Paths of factor X2 model the (negative) slope: all paths indicate mean reversion back to positive slope indicating upward looking forward curves. Paths of factor X3 show the evolution of the convexity of the forward curve.

      Figure 2. Simulated paths of Nelson-Siegel factors for 1y horizon starting from initial values (X1, X2, X3) = (4.36%, 1.3%, -1.0%) with mean-reversion lambda=0.55. See Eq (1) along with Eq (23) in the paper.

      Along with the factors I simulate the log-normal stochastic volatility of these factors using the calibrated model. I apply the extension of Karasinki-Sepp stochastic volatility model augmented with the quadratic drift as developed in our paper with Parviz. I show the paths of volatility in Figure 3. The starting value of the stochastic volatility is 100%. For each factors, we apply deterministic volatility scale which is a part of model calibration (see sections 2.1 and 7.5 in the paper). Interestingly, the correlation between different factors and the volatility driver has different signs: the volatility is positively correlated with level factor X1, while the volatility is negatively correlated with  slope factor X2 and convexity factor X3. We see that we can obtain a rich set of realization for both the forward curve and the volatility of factors. We can compare paths of the volatility sigma_t with the move index for implied rates volatility.

      Figure 3. Simulated paths of the Log-normal stochastic volatility of Nelson-Siegel factors. See Eq (13) in the paper.

      The realisations of Nelson-Siegel factors and their volatilities in 1y allows us to construct the forward curve f_t(tau) under measure Q as seen in 1 year. We observe different shapes of forward curve in 1y compared to the today curve as function of tenor, as shown in Figure 4. Overall, the level of the yield curve is expected to decline following the initial curve shown in Figure 1, yet we have scenarios with higher curve (path 2), inverted U-shape curve (path 5), upward sloping curve (path 1), and flattish curve with different rate levels. Thus, Nelson-Siegel model can generate a rich set of scenarios of the yield curve evolution which can be applied either for valuation of interest rate derivatives or for risk and stress management of fixed-income portfolios.

      Figure 4. Realisations of the forward rates in 1 year using simulated paths of Nelson-Siegel factors. See Eq (22) in the paper for factor loadings.

      Simulations of the yield curve allow us to construct realisations of interest rate derivatives as swap curves, as shown in Figure 5 for swap rate starting in 1y as function of tenor, and rates futures, which require a convexity adjustment (see Section 3.3 in the paper).

      Figure 5. Realisations of swap rate starting in 1Y as function of tenor computed using simulated forward rates. See Eq (29) in the paper.

      Furthermore, we can value call and put options on swap futures rates. In Figure 6, I show model implied volatilities for 1y5y swaptions computed using simulated paths. Option strikes are set as fix moneyness in basis points (bps) relative to 1Y5Y swap rate in each paths. We see that the model can generate a variety of implied volatility curves from convex curves (as today), curves with strong positive skeweness (as seen in middle of year 2022), to curves with negative skeweness (as seen during 2010s).

      Figure 6. Model implied volatilities of swaptions on 1Y5Y swap rate seen in 1 year as functions of moneyness in bps relative to 1Y5Y swap rate in each path. See Eq (88) in the paper for valuation of swaptions.

      Summary

      Given the popularity of Nelson-Siegel term structure model, our model can provide a valuable toolkit for building scenarios for the shape of both the yield curve and the implied volatilities and for risk-management of fixed-income derivatives. I emphasize that the model is arbitrage-free and consistent with the initial forward curve by construction and the model can value different interest rate derivatives (swaptions and options on rate futures) consistently.

      Enjoy the reading of our paper in full and feel free to provide comments.

      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 Uncategorized | 2 Comments
    • AD Derivatives podcast on volatility modeling and DeFi

      Posted at 7:28 pm by artursepp, on December 7, 2023

      I had a pleasure talking with Greg Magadini from Amberdata Derivatives. Greg is a seasoned options trader and he co-founded of GVol which provides awesome analytics for crypto options: check it out!

      We discussed many interesting topics including my background in becoming a quant, volatility modelling and trading, and my latest work in crypto options and DeFi.

      Greg put a nice summary to get you engaged

      https://blog.amberdata.io/ad-derivatives-podcast-feat-artur-sepp-head-quant-at-clearstar-labs

      and to watch the podcast on Youtube

      https://www.youtube.com/watch?v=3Km02FDIpxM

      Enjoy!

      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 Crypto, Uncategorized, Volatility Modeling, Volatility Trading | 0 Comments
    • What is a robust stochastic volatility model – research paper

      Posted at 4:38 pm by artursepp, on November 28, 2023

      I would like to share my research and thoughts about stochastic volatility models and, in particular, about the log-normal stochastic volatility model that I have been developing in a series of papers (see introductory paper with Piotr Karasinski in 2012, the extension to include quadratic drift with Parviz Rakhmonov in 2022, and application of the model to Cheyette interest rate model and  to factor HJM framework.

      In my new working paper with Parviz Rakhmonov, which is available on SSRN here, we address specification of the functional form for the dynamics of stochastic volatility (SV) driver including affine, log-normal, and rough specifications. We propose the four principles which, in our opinion, determine the applicability of an SV model for valuation of derivative securities for different asset classes including equities, rates, commodities, FX and cryptocurrencies. We emphasise that the invariance of an SV under different numeraires is crucial for the model applications for modeling volatility of different asset classes. We argue that currently only the two SV dynamics satisfy these universality conditions: affine Heston SV model and log-normal SV model with quadratic drift. We discuss that both models are analytically tractable for valuation of vanilla options and model calibration when applying these models in different asset classes. We also present some empirical evidence for the considered models and discuss their link with contemporary research topics such as volatility skew-stickiness. We conclude that log-normal SV model with quadratic drift is robust because it does not require special conditions (such as Feller condition for Heston model) for numerical implementation of the model using MC and PDE methods.

      For illustrations, we use the implied volatilities of the core assets for equity indices, rates and commodities:

      1.  S&P 500 index and its implied volatilities proxied with VIX index;

      2. 10y US treasury rate and its implied volatilities proxied with MOVE index;

      3. Oil futures (using USO ETF) and its implied volatilities proxied with OVX index;

      4. Bitcoin (denoted as BTC) and its implied at-the-money (ATM) volatility for options with time-to-maturity of 7 days (We use historical options data of Deribit exchange with the data set starting on April 2019).

      We formulate the following principles for universality and feasibility of a stochastic volatility (SV) model. Our primary focus is based on specifying the parametric form of the dynamics of the volatility driver so that we leave aside important but, in our opinion, secondary features of a universal volatility model including jumps, local volatility, etc.

      1. The dynamics of volatility must have the same marginal distribution under statistical measure P and risk-neutral valuation measure Q. This point ensures that the model can be used under the both statistical and pricing measures. More generally, this requirement implies that the model can be used with different numeraires specific to different asset classes, including equities, rates, commodities, FX and cryptocurrencies. For universality of a SV driver, the SV model dynamics must be functionally invariant     under different numeraires. For an example, for interest rates derivatives it is necessary that the volatility dynamics are invariant under the annuity measure, while for options on FX and cryptocurrencies the model must be invariant under the price numeraire.

      2. The price process augmented with stochastic volatility must remain a strict martingale under different model specification. This particular point is important for the model application for assets with positive implied volatility skews and, as a result, with positive return-volatility correlation.

      Lions and Musiela in their 2007 paper  show that most of one-factor SV models fail to produce strict martingale dynamics when return-volatility correlation between SV and return drivers is positive. This point can be overlooked in equity derivatives where return-volatility correlation is strongly negative but it cannot neglected for other asset classes where return-volatility is positive on many occasions. In Figure 1, we show that volatility beta may become positive (so that return-volatility correlation is positive too) for interest rates and commodities. We show here that return-volatility correlation may become positive for cryptocurrencies too.

      Figure 1: Volatility beta estimated using EWMA regression model with span of 65 days: (A) time series from inceptions, (B) Empirical PDF

       

      3. The dynamics of volatility must be well behaved: the volatility process must be strictly positive without explosions, the stationary distribution of the volatility must exist. This point ensures that the model can implemented efficiently with analytical and numerical methods.

      4. The model is relatively easy to implement both analytically (for model calibration to market data) and numerically (through Monte-Carlo and PDEs) for valuation of exotic options and structured products.

      We make the following conclusions about our four principals applied to well-known SV models (the references are given in our paper).

      Stein-Stein SV model does not admit a valid change of measure. While it is still possible to use this model by directly specifying it under either Q or P measures, the scope of the model is limited. For example price numeraire (for FX and cryptocurrency derivatives) or annuity numeraire (for interest rate derivatives) cannot be applied for this model.

      Exp-OU SV model, Bergomi one-factor model, and log-normal volatility model with linear drift allow for change of measures, but the functional form of model dynamics changes because of an additional term which arises in the drift of the volatility due to measure change. These models do not admit strong martingale dynamics when  return-volatility correlation is positive. In our opinion, these models are originally designed for applications in equity derivatives and their application to other asset classes is rather limited.

      Rough SV model is an extension of Exp-OU using the power kernel for Brownian driver in the volatility dynamics. While rough volatility may provide good fit to empirical auto-correlation function (ACF) as we show in the Figure 2 below, the marginal improvement over a one-factor SV model is rather low when using ACF fit metric (the absolute difference is less than 0.1). Rough OU-based SV models inherit drawbacks of Exp-OU models: first, the difficulty in changing measures consistently and, second, the lack of martingale property when return-volatility correlation is positive. In our opinion, rough SV models are designed exclusively for equity markets and it may not be feasible to apply them for other asset classes. On the implementation side, rough Exp-OU models can only be implemented with MC methods.

      Figure 2: Auto-correlation of implied volatilities as function of lag periods (in days) for the three implies volatility indices: A) VIX for the S&P 500 index, B) MOVE for the 10y UST rate, C) OVX for oil ETF, D) Bitcoin (BTC) ATM implied volatilities for options with maturities of 7 day. Empirical is the empirical estimate, Log SV is the fitted auto-correlation of the lognormal SV model, Rough is the rough auto-correlation with fitted decay power alpha.

       

      Heston SV model allows for consistent measure changes under different numeraires. The model also produces true martingale dynamics when return-volatility correlation is positive and the variance cannot hit zero as long as the Feller condition is satisfied. On the implementation side, Heston model admits a closed-form solution for valuation of vanilla options, which makes it easy for model calibration. These facts undoubtedly have made Heston model applicable to multiple asset classes. However, numerical implementation of Heston model using MC or numerical PDE methods is rather complicated, especially when Feller condition is not satisfied. There is a great deal of literature on how to make Heston model work in practice.

      Heston model also implied the stationary distribution of the volatility which has a thin right tail which is inconsistent with empirical data shown in Figure 3 below.

      Figure 3: Steady-state PDF of the logarithm of the volatility (y-axis is shown in log-scale).

       

      Log-normal SV model with quadratic drift allows for consistent measure changes using different numeraires. For positive return-volatility correlation, the model produces true martingale dynamics as long as the quadratic mean-reversion coefficient exceeds volatility beta. For model calibration, we develop a closed-form and accurate solution for valuation of vanilla options under this model in this paper. For numerical implementation using MC methods, we also develop a first-order MC scheme using the log-transform of the volatility to unbounded domain. Since in log-coordinates the valuation problem in log-volatility is defined on unrestricted domain, the problem can be solved efficiently using PDE methods for such domain (see my old workshop slides here). As a result, log-normal SV model with quadratic drift can be considered as a robust choice for modeling price dynamics for different asset classes.

      Enjoy the reading of our paper in full and feel free to provide comments.

      Python code for producing figures is available on Github in stochvolmodels package https://github.com/ArturSepp/StochVolModels and in module for the paper https://github.com/ArturSepp/StochVolModels/tree/main/papers/volatility_models

      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 Volatility Modeling | 2 Comments
    • Robust Log-normal Stochastic Volatility for Interest Rate Dynamics – research paper

      Posted at 5:49 pm by artursepp, on December 31, 2022

      The volatility of interest rates in 2022 has been indeed extreme. In Figure 1, I show the dependence the between the MOVE index (which measures the implied volatility of one-month options on UST bond futures and which is constructed similarly to the VIX index for implied volatilities of the S&P index futures), realized 10y UST rate volatility over the 6 months rolling window, and the level of 10y UST rates. For understanding of historical patterns, we classify the historical period from 2002 to the end of 2022 into the 5 periods: 2002-2007 (hiking cycle), 2008-2010 (tightening), 2011-2017 (QE), 2018-2020 (tightening), 2021-2022 (hiking cycle).

      We see that period of 2021-2022 was indeed unprecedented period when the rates rose from low levels of around 100 basis point (bp) to over 400bp, while the rates implied and realised volatilities rose from 50bps to over 150bps.

      Figure1. (A) The MOVE implied volatility index vs 10y UST bond rate; (B) 6m realized volatility of 10y UST bond rate vs 10y UST bond rate.

      The dependence between the rate and its volatility manifests in implied volatilities with positive skews as I show in Figure 2 (The market convention is to use Bachelier normal model for marking implied swaption volatilities).

      Figure 2. Implied normal volatilities for $10Y$ swaption as function of option expiries in basis points observed in December 2022. Option delta is Bachelier normal model delta.

      The dependence between the rate and volatility also manifests in strong level between the implied and realized volatilities and the volatility of volatility and the volatility beta (the change in 1bp of the volatility predicted by 1bp change in rates) which I show in Figure 3.

      Figure 3. (A) Realized volatility-of-volatility vs move volatility index. (B) Realized volatility beta vs Move index.

      Quantitative modeling of such dynamics is challenging. In my previous joint paper with Parviz Rakhmonov on the
      log-normal stochastic volatility for assets with positive return-volatility correlation we show that conventional SV model are ill-equipped for such dynamics. The rate dynamics are no exception, and practitioners rely on either local volatility models or local SV models with zero correlation. Both approaches are ill-poised because the may lead to explosive behavior of interest rates.

      In our extension with Parviz we apply the Karasinski-Sepp log-normal SV dynamic for modelling the interest rate volatility, which is available on SSRN: Robust Log-normal Stochastic Volatility for Interest Rate Dynamics

      We show that the proposed rates model is robust both on the quantitative dynamics and its practical implementation. While rate models in general are notorious for their tractability and implementation, we derive a closed form analytic solution for valuation of swaptions and for model calibration. In Figure 4, I show the model implied distribution of the 10y swap rate in the annuity measure computed using our analytical methods compared to the Monte Carlo simulations. Our solution is very accurate and it allows for robust calibration of the model to market data.

      Figure 4. Probability density functions computed using the first order affine expansion and the second-order expansion for the distribution of 10y swap rate in one year. The blue histogram is computed using realizations from MC simulations in model dynamics.

      All the technical details are available in the paper: Robust Log-normal Stochastic Volatility for Interest Rate Dynamics. Happy 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 Quantitative Strategies, Volatility Modeling, Volatility Trading | 1 Comment
    ← 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)

Proudly powered by WordPress Theme: Personal by Obox Themes.

Loading Comments...
%d