Applications

# Quantum Computing Industries - Finance

29
April
,
2022

The financial industry, and all those it impacts, has much to gain from quantum computing, and can benefit from the thoughtful deployment of quantum sooner than any other industry. Whether a risk analysis justifies a family receiving a loan for which they would normally be rejected or an individual gains financial competence and independence through better pricing of assets or options, the benefits of quantum computing in the financial industry are far-reaching.

As many financial firms interact with other industries, there is often an overlap in the quantum applications that are important to them. Take AXA, one of the top global insurance firms, for example - though they don’t make pharmaceuticals, some of their clients do, and their early adoption of quantum computing benefits both the company, as they gain quantum competence, and their clients, whom already rely on their insurer for advice.

Quantum computing often offers a powerful speedup when there are large unstructured datasets. Properties inherent to quantum systems allow the analysis of many scenarios simultaneously. We already see hints of this implemented in the financial field with Monte Carlo simulations, utilizing the randomness of nature to predict outcomes of complex systems. Optimizations and simulations cover many uses in the financial field such as minimizing loss, maximizing gain, or simulating investing in exotic options. It’s noteworthy many of these calculations can be performed even in the present state of NISQ hardware using hybrid classical/quantum algorithms like VQE, so even today’s devices are not far delivering rewards.

Interested in live examples? Watch a recent webinar demonstrating how the Classiq platform uses quantum computing to solve financial problems here, watch a portfolio optimization demo here, or schedule a demo here.

It’s also noteworthy that the speedups from quantum computing can greatly contribute to quantum machine learning - a field with large, unstructured datasets everywhere and with commonly used approaches to financial solutions. Any problem that can be mapped into a classical machine learning model could become a candidate to solve on quantum machinery.

## The Classiq Approach to Value at Risk

Let's use the Classiq Platform to solve a Quantum Risk Analysis problem, where an investor needs to quantify how large a loss on investment could be, given a certain level of confidence, over a period of time.

To solve this problem, one must create a distribution function that represents the assets portfolio, construct the Value at Risk operator, and extract the value at risk using amplitude estimation. Say we have a two asset portfolio represented by a Conditioned Gaussian model.

To use the Classiq platform, use either an extension to Visual Studio Code or a Python SDK, both offering pretty much the same functionality. You'll need a Classiq license, of course.

With the textual model in VS Code, the user simply specifies constraints and the functionality of the circuit and uses the "Generate Quantum Circuit" command.


{
"constraints:{
"max_width": 8,
"max_depth": 120
},
"logic_flow": [
{
"function": "Finance",
"function_params": {
"model": {
"name": "gaussian",
"params": {
"num_qubits": 2,
"normal_max_value": 2,
"default_probabilities": [
0.15,
0.25
],
"rhos": [
0.1,
0.05
],
"loss": [
1,
2
],
"min_loss": 0
}
},
"finance_function": {
"f": "var",
"condition": {
"threshold": 2,
"larger": true
}
}
}
}
]
}


And with the Python SDK:


from classiq import ModelDesigner
from classiq.builtin_functions import Finance
from classiq_interface.finance import (
model_input,
function_input,
gaussian_model_input
)

model_designer = ModelDesigner()
gaussian_input = gaussian_model_input.GaussianModelInput(
num_qubits=2,
normal_max_value=2,
default_probabilities=[0.15, 0.25],
rhos=[0.1, 0.05],
loss=[1, 2],
min_loss=0
)
model = model_input.FinanceModelInput(name="gaussian", params=gaussian_input)

condition = function_input.FunctionCondition(threshold=2, larger=True)
finance_function = function_input.FinanceFunctionInput(
f="var",
condition=condition,
)
model_designer.Finance(params=Finance(model=model, finance_function=finance_function))

circuit = model_designer.synthesize()


We can now generate our circuit.

And here's the interactive circuit, where one can explore the different functional blocks of this circuit by clicking the plus icons in the top-left corner of each block.

There was some error with the script

Now we execute this circuit using amplitude estimation. To find the value at risk we use binary search. The value at risk is the loss value that corresponds to the percentile we have inserted at the binary search threshold.

With the textual model we create an execution preferences file and use the "Execute Generated Quantum Circuit" command.


{
"preferences": {
"num_shots": 100,
"amplitude_estimation": {
"alpha": 0.05,
"epsilon": 0.01,
"binary_search_threshold": 0.05
}
}
}


And with the Python SDK, we specify the following:


res = Executor(
amplitude_estimation=execution_preferences.AmplitudeEstimation(
alpha=0.5, epsilon=0.5, binary_search_threshold=0.05
)
).execute_generated_circuit(generation_result=circuit)


And the result?


"var_results": {
"var": 2,
"alpha": 0.040910419136997445
}


The financial industry, and all those it impacts, has much to gain from quantum computing, and can benefit from the thoughtful deployment of quantum sooner than any other industry. Whether a risk analysis justifies a family receiving a loan for which they would normally be rejected or an individual gains financial competence and independence through better pricing of assets or options, the benefits of quantum computing in the financial industry are far-reaching.

As many financial firms interact with other industries, there is often an overlap in the quantum applications that are important to them. Take AXA, one of the top global insurance firms, for example - though they don’t make pharmaceuticals, some of their clients do, and their early adoption of quantum computing benefits both the company, as they gain quantum competence, and their clients, whom already rely on their insurer for advice.

Quantum computing often offers a powerful speedup when there are large unstructured datasets. Properties inherent to quantum systems allow the analysis of many scenarios simultaneously. We already see hints of this implemented in the financial field with Monte Carlo simulations, utilizing the randomness of nature to predict outcomes of complex systems. Optimizations and simulations cover many uses in the financial field such as minimizing loss, maximizing gain, or simulating investing in exotic options. It’s noteworthy many of these calculations can be performed even in the present state of NISQ hardware using hybrid classical/quantum algorithms like VQE, so even today’s devices are not far delivering rewards.

Interested in live examples? Watch a recent webinar demonstrating how the Classiq platform uses quantum computing to solve financial problems here, watch a portfolio optimization demo here, or schedule a demo here.

It’s also noteworthy that the speedups from quantum computing can greatly contribute to quantum machine learning - a field with large, unstructured datasets everywhere and with commonly used approaches to financial solutions. Any problem that can be mapped into a classical machine learning model could become a candidate to solve on quantum machinery.

## The Classiq Approach to Value at Risk

Let's use the Classiq Platform to solve a Quantum Risk Analysis problem, where an investor needs to quantify how large a loss on investment could be, given a certain level of confidence, over a period of time.

To solve this problem, one must create a distribution function that represents the assets portfolio, construct the Value at Risk operator, and extract the value at risk using amplitude estimation. Say we have a two asset portfolio represented by a Conditioned Gaussian model.

To use the Classiq platform, use either an extension to Visual Studio Code or a Python SDK, both offering pretty much the same functionality. You'll need a Classiq license, of course.

With the textual model in VS Code, the user simply specifies constraints and the functionality of the circuit and uses the "Generate Quantum Circuit" command.


{
"constraints:{
"max_width": 8,
"max_depth": 120
},
"logic_flow": [
{
"function": "Finance",
"function_params": {
"model": {
"name": "gaussian",
"params": {
"num_qubits": 2,
"normal_max_value": 2,
"default_probabilities": [
0.15,
0.25
],
"rhos": [
0.1,
0.05
],
"loss": [
1,
2
],
"min_loss": 0
}
},
"finance_function": {
"f": "var",
"condition": {
"threshold": 2,
"larger": true
}
}
}
}
]
}


And with the Python SDK:


from classiq import ModelDesigner
from classiq.builtin_functions import Finance
from classiq_interface.finance import (
model_input,
function_input,
gaussian_model_input
)

model_designer = ModelDesigner()
gaussian_input = gaussian_model_input.GaussianModelInput(
num_qubits=2,
normal_max_value=2,
default_probabilities=[0.15, 0.25],
rhos=[0.1, 0.05],
loss=[1, 2],
min_loss=0
)
model = model_input.FinanceModelInput(name="gaussian", params=gaussian_input)

condition = function_input.FunctionCondition(threshold=2, larger=True)
finance_function = function_input.FinanceFunctionInput(
f="var",
condition=condition,
)
model_designer.Finance(params=Finance(model=model, finance_function=finance_function))

circuit = model_designer.synthesize()


We can now generate our circuit.

And here's the interactive circuit, where one can explore the different functional blocks of this circuit by clicking the plus icons in the top-left corner of each block.

There was some error with the script

Now we execute this circuit using amplitude estimation. To find the value at risk we use binary search. The value at risk is the loss value that corresponds to the percentile we have inserted at the binary search threshold.

With the textual model we create an execution preferences file and use the "Execute Generated Quantum Circuit" command.


{
"preferences": {
"num_shots": 100,
"amplitude_estimation": {
"alpha": 0.05,
"epsilon": 0.01,
"binary_search_threshold": 0.05
}
}
}


And with the Python SDK, we specify the following:


res = Executor(
amplitude_estimation=execution_preferences.AmplitudeEstimation(
alpha=0.5, epsilon=0.5, binary_search_threshold=0.05
)
).execute_generated_circuit(generation_result=circuit)


And the result?


"var_results": {
"var": 2,
"alpha": 0.040910419136997445
}