Open orsa-classiq opened 2 months ago
Hi @orsa-classiq & @amir-naveh,
I would like to work on this issue. May I please know what exactly do you mean by "native language constructs"? I am assuming that the functions needs to be changed to classiq 0.42.0 version. Please correct me if I am wrong. I look forward to hearing from you soon :)
Hi @Qubit1718, we will be really glad if you take it :)
By 'native language constructs' we mean using a main
function, as you did in the hw_aware_sytnthesis notebook
You can see that currently the notebook contains a construct_finance_model
that directly returns pre-built qmod, and we want it to be transparent.
You mean the construct_finance_model
and function_input
need to be rewritten as main
functions? Could you please also let me know what would be a better starting point to understand the working of construct_finance_model
and function_input
:))
You can just ignore this function, and re-write the notebook from scratch. I refer you to the mentioned paper for understanding of the algorithm.
You need to create a single model (i.e single main
function), within you use the amplitude-estimation algorithm, for the European Call options.
Got it, @orsa-classiq. I'll start reading the paper and post it to you if I have any further questions. Thanks!
@Qubit1718 are you still working on this?
Using quantum computers for pricing financial derivatives has the promise for quadratic speedup.
In this issue we will improve the current option-pricing notebook, implementing algorithm for european call options, based on the paper Option Pricing using Quantum Computers. The goal is to use native language constructs instead of the current
construct_finance_model
black box function in the existing implementation.to complete this issue, follow the following steps:
construct_finance_model
,function_input
in the model creation. You will later on use native language functions Instead.num_qubits
,mu
,sigma
,threshold
. A bonus is to derive them from financial parameters. Use theprepare_state
function on calculated lognormal distribution with the parameters, and some truncation value (5 sigma). This can be computed classically and passed to theprepare_state
as an array of probabilities.*=
syntax, see amplitude loading example. Pay attention for needed remapping of the variables and normalization, as done in the paper. Here, in difference from the article, the implementation is exact and not approximated.iqae
execution scheme, that uses the iterative amplitude estimation, and the built-ingrover_operator
. See quantum_counting for example.assert
validation to the code.write_qmod(qmod, "option_pricing.qmod")
line. Run the notebook, and you will automatically update the .qmod file for this example.If you have any questions or comments, you can ask them here in the issue, or in our slack community, and the Classiq team will be happy to assist.
Happy quantum coding!