Applications of Quantum Annealing in Computational FinanceDr. Phil GoddardHead of Research, 1QBitD-Wave User Conference, Santa Fe, Sept. 2016
• Where’s my Babel Fish?
• Quantum-Ready Applications for Computational Finance
• Tools and Resources
2
Outline
Where’s my Babel Fish?
Where’s my Babel Fish?
• k-Coloring • Connected Dominating Set• Job Shop Scheduling
• Graph Similarity• Graph Partitioning
4
• Portfolio Optimization
• Asset Allocation• Risk Management
• Option Pricing
1
1
2
2 3
3 2
31
Job 1Job 2Job 3
1 1
2 2
33
2
3
1
0 1 2 3 4 5 6time
0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3-0.2
0
0.2
0.4
0.6
0.8
1
1.2Mean-Variance-Efficient Frontier
Risk (Standard Deviation)
Expe
cted
Ret
urn
Is that a QUBO?
5
𝑥 ∈ 0,1 &
𝑄 ∈ ℝ&×&
min-
𝑥.𝑄𝑥
𝑥 ∈ ℝ&𝑄 ∈ ℝ&×&
Weightofassetsinportfolio
Covariancematrix
Quantum-Ready Applicationsfor Computational Finance
• A Multi-Period Optimal Trading Strategy
• Quantum-Ready Hierarchical Risk Parity (QHRP)
• Real-Time Optimization Framework
• Tax Loss Harvesting
7
Applications for Computational Finance
Optimal Trading Trajectories
8
• The optimal trading trajectory problem
• The mathematical formulation
• Considerations in using the quantum annealer
• Experimental Results
9
A Multi-Period Optimal Trading Strategy
The Optimal Trading Trajectory Problem
• Managers of large portfolios typically need to optimize their portfolios over a multiple period horizon.
• A sequence of single-period optimal positons is rarely multi-period optimal.
• Rebalancing the portfolio to align with each single period optimal weight is typically prohibitively expensive.
10
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 2 4 6 8 10 12
OptimalWeight
TimeofRebalance
Single-periodOptimalWeight --- Multi-periodOptimalWeight
Practical Considerations
11
• Friction: Transaction costs prevent portfolio managers from monetizing much of their forecasting power
• Market Impact: The sale or purchase of large blocks of a given asset may result in temporary and/or permanent price movements
• Constraints: Some positions can only be traded in blocks (e.g. real-estate, private offerings, fixed lot sizes,…), thus requiring integer solutions
2 4 6 8 10 12 14-0.04
-0.02
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14Efficient Frontier
Risk
Retu
rn
Basic ConstraintsTrading Constraints
Mathematical Formulation• The multi-period integer optimization problem may be written as
• To solve, the problem must be converted to standard QUBO form:
12
𝑤 = argmax5 6 𝜇8.𝑤89:;<9=>
−𝛾2𝑤8
.Σ8𝑤89C>D
− Δ𝑤8.Λ8Δ𝑤8GC9:H;HJ>;>,;:KL.CKLNH;
− Δ𝑤8.Λ8O Δ𝑤8L:9K.CKLNH;
.
8PQ
s.t.:
∀𝑡:6𝑤U,8 ≤ 𝐾&
UPQ
; ∀𝑡, ∀𝑛:𝑤U,8 ≤ 𝐾O
mean-varianceportfolio optimization
transactioncostandmarketimpacts
min-𝑥.𝑄𝑥
𝑥 ∈ 0,1 &, 𝑄 ∈ ℝ&×&
Bit Encoding• The integer variables of the optimization problem 𝑤Z must be recast to the binary variables used by the
annealer 𝑥Z .
13
Experimental Procedure and Results• Generate a random problem: number of assets; time horizon; and total investable assets
• Solve using quantum annealer
• Find exact minimum solution using an exhaustive search
• Evaluate performance by how far the quantum solution is from the exact solution
14
• The annealer solution is typically within a small and acceptable margin of error of the exact globally minimal solution.
Quantum-Ready Hierarchical Risk Parity
Quantum-Ready Hierarchical Risk Parity
16
The Approach
• Use tree structure to reduce connections between assets as well as estimation error
• Instead of minimizing variance via all correlations using all assets at once, solve the minimum variance problem at each node of the tree
• Build the final weight vector by recursively minimizing variance from the bottom of the tree to the top
• Ignore correlations in determining weights, use only in calculating variance of sub-trees
• Effect: Improve out-of-sample realized volatility
• Can also be applied to linear regression
17
𝒘∗ = argmin𝒘
𝒘.�̂�𝒘 𝑠. 𝑡.6𝑤Z = 1�
Z
𝒘𝟐,𝟏∗ = argmin
𝒘𝒘.Σc,Qd 𝒘 𝒘𝟐,𝟐
∗ = argmin𝒘
𝒘.Σc,cd 𝒘
𝒘𝟏,𝟏∗ = argmin
𝒘𝒘.ΣQ,Qd 𝒘
Classical
QHRP
(Out-of-Sample) Minimum Risk Portfolios
18
• Classical algorithm minimizes in-sample risk, but sometimes missed the point
• In this example, it invests over 50% of the portfolio in just McDonalds, Coca-Cola and Johnson & Johnson
• QHRP provides more diversification
Risk Improvement in SimulationsOut-of-sample volatility is reduced by 20% in simulated examples using 10 assets with 10% volatility each, random shocks, random correlations.
20 %
19
Real-Time Optimization Framework
Real-Time Optimization Framework
21
• Stream Analytics
• Real-Time data signals• Quantum powered analytics
Stock Market
1QBit SDKD-Wave 2X Processor
Post Processing
Trading Signals
GOOG
AAPL
MSFT
SBUX
TSLA
CorrelationGraph
Generator
Time
Real-Time Optimization Framework
22
• Stream Analytics
• Real-Time data signals• Quantum powered analytics
Stock Market
1QBit SDKD-Wave 2X Processor
Post Processing
Trading Signals
GOOG
AAPL
MSFT
SBUX
TSLA
CorrelationGraph
Generator
Time
Real-Time Optimization Framework
23
• Stream Analytics
• Real-Time data signals• Quantum powered analytics
Stock Market
1QBit SDKD-Wave 2X Processor
Post Processing
Trading Signals
GOOG
AAPL
MSFT
SBUX
TSLA
CorrelationGraph
Generator
Time
Tax Loss Harvesting
Tax Loss Harvesting
• Track an index using a subset of the components of the index while selling losses and moving into unowned components
• Integer Quadratic Programming: sell quantities from owned lots; buy new lots (avoiding wash sales)
• Offset gains and income; carry losses forward; create a tax buffer
• Quantum annealer used to find the optimal share quantities to buy and sell to generate the greatest tax benefit while staying within a specified tracking error.
25
Tools and Resources
Tools
1QBit’squantum-readySoftwareDevelopmentKit:Explore: 1qbit.comRegister for Beta Release: qdk.1qbit.com
27
Resources: www.quantumforquants.org
28
Phil [email protected]
©20161QBInformationTechnologies.Allrightsreserved.