top of page

Financial Index Tracking using Quantum Inspired Optimization

Writer's picture: Saavan PatelSaavan Patel

Author: Saavan Patel PhD [Chief Technology Officer]: InfinityQ Technology


Abstract:


Quantitative Finance has many difficult optimization problems which have great importance to the daily operations of many companies.


Index Tracking is an important example where an asset manager wishes to construct a portfolio of assets to accurately track an underlying index.  


While traditional optimization methods can solve this problem in the academic case, as we add more real-world constraints and variables, the problem becomes increasingly intractable.


In this report we demonstrate TitanQ having >1000x time to solution benefits on this problem compared to the state-of-the-art classical solver, Gurobi when incorporating constraints that come from a real-world setting.


This demonstrates important advantages in complicated financial use cases using quantum-inspired methods.


Introduction:


Financial Index tracking (or passive index tracking) is a strategy where a portfolio manager attempts to replicate the performance of a specific financial index (e.g., the S&P 500, FTSE 100, or MSCI World Index).


The objective is to minimize the tracking error, which is the difference in returns between the portfolio and the target index.


This problem is particularly important for index funds and exchange-traded funds (ETFs), which aim to closely mirror the performance of the underlying index.


The index tracking problem can be formulated as a mathematical optimization problem, where our objective is to construct the optimal portfolio weights.


To incorporate real trading constraints, such as risk constraints (to control the variance of the constructed portfolio), budget constraints (to use a minimal budget, or be under a maximal budget), diversification constraints (to ensure various market sectors are added), we add mathematical constraints to the underlying model.


As we integrate more and more real-world constraints into the problem, index tracking can turn into a highly non-convex optimization problem which can cause classical solvers to struggle.


To aid in solving non-convex, difficult problems, InfinityQ has developed the TitanQ optimization platform, which specializes particularly in nonlinear and non-convex optimization problems.


These problems often come up in financial use cases, such as the index tracking problem outlined here.


The TitanQ platform is based on quantum-inspired and probabilistic techniques to optimizations which are well suited to these kinds of problems.

 

Problem Overview:


The index tracking problem has many possible formulations. The one chosen here is particularly well suited towards usage of optimization solutions.


The main goal is to minimize the tracking error for our target portfolio over a given period of time.


Objective:


In general, we will want to minimize the “tracking error”, which will attribute to the average Mean Square Error (MSE) of the time indexed returns compared to our portfolio returns. Mathematically this looks like the below equation:

In the above equation  represents the index returns at time t,  represents the returns of asset i at time t  and  represents the normalized number of units of asset i purchased.


Variables and Constraints:


In many real-world settings, portfolio weights cannot be approximated as continuous values as they are in academic settings. This would arise when portfolio assets may be expensive (where we can’t buy a large amount compared to our budget) or illiquid (where there are not many of the asset to purchase), and we cannot buy fractional asset amounts.


Additionally, we will only allow a certain amount of a given asset to be purchased again representing the setting of illiquid assets, and incentivizing diversity of solutions. 

Risk constraints arise when we want to create a portfolio that is correlated  within a set amount  of the underlying index. It can also be used to generate a portfolio that is correlated with the underlying index, but with lower or higher risk. This constraint is reproduced below, where the Q matrix represents asset covariances.

Additionally, constraints like budget constraints can be added to ensure a value between the  minimum and maximum budget allocation are used, represented by the initial price allocation of the assets.

This portfolio and set of constraints represent a minimum subset of constraints that take the original index tracking problem and turn it into a non-convex, mixed integer quadratically constrained quadratic problem (MIQCQP).

 

Results:


We use the production version of the TitanQ platform to test this system, and compare the performance to Gurobi 11.0.3, a commercial solver for MIQCQP problems, widely regarded as one of the fastest for such problems.


Synthetic Data & Scaling:


To begin the analysis, we conducted a performance study on synthetic data, only focusing on the integer and quadratic constraints. This analysis allows us to see how each solver compares to one another before adding real data. Index returns and covariance matrices are randomly generated to understand the scaling of the system.  


TitanQ Solver


The production cloud version of TitanQ is a quantum-inspired solver running on classical parallel hardware such as GPUs and multi-threaded CPUs. To make the comparison fair, we run TitanQ on the same CPU model as Gurobi (the Xeon Silver 4214R), with the same hardware.


Gurobi Baseline


Gurobi 11.0.3 was run on an Intel(R) Xeon(R) Silver 4214R CPU (2.4 – 3.5 GHz) with 24 threads, using all available threads. Computational timeout was set to 1000 seconds, time was recorded by Gurobi after the run was complete.

Figure 1: Performance on TitanQ vs. Gurobi on Synthetic Index Tracking Problem. TitanQ can produce the same quality result 1000x faster compared to Gurobi, while producing a much better scaling constant.
Figure 1: Performance on TitanQ vs. Gurobi on Synthetic Index Tracking Problem. TitanQ can produce the same quality result 1000x faster compared to Gurobi, while producing a much better scaling constant.

S&P500 Index Tracking with Real Constraints & Data


To demonstrate the power and flexibility of the TitanQ platform, we have additionally implemented a sample problem on real world data. We took historical data of the S&P500 for the year of 2021, and used it to forward track the index for the first 4 months of 2022.


We compared the time to solution performance between TitanQ & Gurobi on this problem as well to demonstrate the kinds of performance gains possible with the TitanQ Platform.  

 

First to illustrate problem performance, we allocated a minimum budget of $10,000, a maximum budget of $50,000 and a max stock allocation of 16. This roughly sets the optimization problem to find 16 stock units that will match the performance of the portfolio we are trying to track.


An example stock portfolio is shown below, with portfolio weightings for each element. We can see that the stocks picked are a large swath of the full market picture, ranging from consumer electronics (BBY) to Energy (NRG), to life sciences (EW) to food items (MDLZ and GIS).


The performance of the TitanQ portfolio is plotted below in comparison to the S&P500 index returns, showing very close agreement between the two.


Stocks picked & weights generated for a budget of $10,000


Stocks: AOS, AZO, BBY, CI, COO, EW, GIS, IPG, KMB, MTCH, MDLZ, MS, NRG, PCG, WDC,

Portfolio weights: 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 1.0, 1.0, 1.0, 1.0,

Figure 2: Backtesting the portfolio on the problem it was optimized on. Strong agreement between TitanQ portfolio and the S&P500 index.
Figure 2: Backtesting the portfolio on the problem it was optimized on. Strong agreement between TitanQ portfolio and the S&P500 index.

The above backtesting shows that the TitanQ portfolio closely tracks the index over the optimized range. This effectively shows that the optimizer is doing what it is constructed to do over this range.


The real question, however, is whether the same portfolio can generalize to unseen data. Below we plot a forward testing procedure, using the portfolio optimized for the previous time period on the future time period. 

Figure 3: Forward Testing TitanQ portfolio against S&P500 Index shows good agreement on unseen data.
Figure 3: Forward Testing TitanQ portfolio against S&P500 Index shows good agreement on unseen data.

This forward testing demonstrates that the TitanQ portfolio is a good representation of the market and can effectively track the underlying index while only using a minimal quantity of the underlying assets.

 

Finally, we demonstrate the specific advantages of the TitanQ platform in comparison to traditional MIQP solvers.


We again compare to Gurobi and demonstrate a 1000x speedup to reach similar objective values.


TitanQ is able to find better quality solutions in a shorter amount of time, demonstrating its ability to solve complex problems in the index tracking domain. 


Put another way:


TitanQ is able to reach a better solution in 60 seconds

than Gurobi is able to find in 24 hours.

Additionally, while TitanQ is able to solve this problem quickly, for even larger problems (such as tracking the MSCI world index, or the Russell 1000 index), TitanQ would continue to support the problem and provide high quality solutions in a reasonable time frame.


This makes previously intractable and difficult problems tractable on our platform.


Conclusion:


We demonstrate the ability of TitanQ to solve highly non-convex, non-linear problems which have importance in computational finance using the index tracking problem as a representative example.


For these problems, we see the system is able to solve problems >1000x faster than Gurobi, a state of the art competitor in the market.


This takes problems that would originally take 24 hours to compute down to 60 seconds, making previously impossible problems, possible to solve.  


Additional Resources:


An example of this use case, with data, models, and information is available on the TitanQ examples repository here:


 

Additionally, a video demonstration of this exact use case is shown in the video here:




Recent Posts

See All
bottom of page