# Qiskit Finance
[![License](https://img.shields.io/github/license/Qiskit/qiskit-finance.svg?style=popout-square)](https://opensource.org/licenses/Apache-2.0)
**Qiskit Finance** is an open-source framework that contains uncertainty components for stock/securities problems,
applications, such as portfolio optimization, and data providers to source real or random data to
finance experiments.
## Installation
We encourage installing Qiskit Finance via the pip tool (a python package manager).
```bash
pip install qiskit-finance
```
**pip** will handle all dependencies automatically and you will always install the latest
(and well-tested) version.
If you want to work on the very latest work-in-progress versions, either to try features ahead of
their official release or if you want to contribute to Finance, then you can install from source.
To do this follow the instructions in the
[documentation](https://qiskit-community.github.io/qiskit-finance/getting_started.html#installation).
----------------------------------------------------------------------------------------------------
### Creating Your First Finance Programming Experiment in Qiskit
Now that Qiskit Finance is installed, it's time to begin working with the finance module.
Let's try an experiment using Amplitude Estimation algorithm to
evaluate a fixed income asset with uncertain interest rates.
```python
import numpy as np
from qiskit.primitives import Sampler
from qiskit_algorithms import AmplitudeEstimation
from qiskit_finance.circuit.library import NormalDistribution
from qiskit_finance.applications import FixedIncomePricing
# Create a suitable multivariate distribution
num_qubits = [2, 2]
bounds = [(0, 0.12), (0, 0.24)]
mvnd = NormalDistribution(
num_qubits, mu=[0.12, 0.24], sigma=0.01 * np.eye(2), bounds=bounds
)
# Create fixed income component
fixed_income = FixedIncomePricing(
num_qubits,
np.eye(2),
np.zeros(2),
cash_flow=[1.0, 2.0],
rescaling_factor=0.125,
bounds=bounds,
uncertainty_model=mvnd,
)
# the FixedIncomeExpectedValue provides us with the necessary rescalings
# create the A operator for amplitude estimation
problem = fixed_income.to_estimation_problem()
# Set number of evaluation qubits (samples)
num_eval_qubits = 5
# Construct and run amplitude estimation
sampler = Sampler()
algo = AmplitudeEstimation(num_eval_qubits=num_eval_qubits, sampler=sampler)
result = algo.estimate(problem)
print(f"Estimated value:\t{fixed_income.interpret(result):.4f}")
print(f"Probability: \t{result.max_probability:.4f}")
```
When running the above the estimated value result should be 2.46 and probability 0.8487.
### Further examples
Learning path notebooks may be found in the
[finance tutorials](https://qiskit-community.github.io/qiskit-finance/tutorials/index.html) section
of the documentation and are a great place to start.
----------------------------------------------------------------------------------------------------
## Contribution Guidelines
If you'd like to contribute to Qiskit, please take a look at our
[contribution guidelines](https://github.com/qiskit-community/qiskit-finance/blob/main/CONTRIBUTING.md).
This project adheres to Qiskit's [code of conduct](https://github.com/qiskit-community/qiskit-finance/blob/main/CODE_OF_CONDUCT.md).
By participating, you are expected to uphold this code.
We use [GitHub issues](https://github.com/qiskit-community/qiskit-finance/issues) for tracking requests and bugs. Please
[join the Qiskit Slack community](https://qisk.it/join-slack)
and for discussion and simple questions.
For questions that are more suited for a forum, we use the **Qiskit** tag in [Stack Overflow](https://stackoverflow.com/questions/tagged/qiskit).
## Authors and Citation
Finance was inspired, authored and brought about by the collective work of a team of researchers.
Finance continues to grow with the help and work of
[many people](https://github.com/qiskit-community/qiskit-finance/graphs/contributors), who contribute
to the project at different levels.
If you use Qiskit, please cite as per the provided
[BibTeX file](https://github.com/Qiskit/qiskit/blob/main/CITATION.bib).
## License
This project uses the [Apache License 2.0](https://github.com/qiskit-community/qiskit-finance/blob/main/LICENSE.txt).
Raw data
{
"_id": null,
"home_page": "https://github.com/qiskit-community/qiskit-finance",
"name": "qiskit-finance",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "qiskit sdk quantum finance",
"author": "Qiskit Finance Development Team",
"author_email": "qiskit@us.ibm.com",
"download_url": "https://files.pythonhosted.org/packages/06/59/d67fd31c54068606e22f28ccdfae8e9354039184b71ded4bd2e89a7c0207/qiskit-finance-0.4.1.tar.gz",
"platform": null,
"description": "# Qiskit Finance\n\n[![License](https://img.shields.io/github/license/Qiskit/qiskit-finance.svg?style=popout-square)](https://opensource.org/licenses/Apache-2.0)\n\n**Qiskit Finance** is an open-source framework that contains uncertainty components for stock/securities problems,\napplications, such as portfolio optimization, and data providers to source real or random data to\nfinance experiments.\n\n## Installation\n\nWe encourage installing Qiskit Finance via the pip tool (a python package manager).\n\n```bash\npip install qiskit-finance\n```\n\n**pip** will handle all dependencies automatically and you will always install the latest\n(and well-tested) version.\n\nIf you want to work on the very latest work-in-progress versions, either to try features ahead of\ntheir official release or if you want to contribute to Finance, then you can install from source.\nTo do this follow the instructions in the\n [documentation](https://qiskit-community.github.io/qiskit-finance/getting_started.html#installation).\n\n\n----------------------------------------------------------------------------------------------------\n\n### Creating Your First Finance Programming Experiment in Qiskit\n\nNow that Qiskit Finance is installed, it's time to begin working with the finance module.\nLet's try an experiment using Amplitude Estimation algorithm to\nevaluate a fixed income asset with uncertain interest rates.\n\n```python\nimport numpy as np\nfrom qiskit.primitives import Sampler\nfrom qiskit_algorithms import AmplitudeEstimation\nfrom qiskit_finance.circuit.library import NormalDistribution\nfrom qiskit_finance.applications import FixedIncomePricing\n\n# Create a suitable multivariate distribution\nnum_qubits = [2, 2]\nbounds = [(0, 0.12), (0, 0.24)]\nmvnd = NormalDistribution(\n num_qubits, mu=[0.12, 0.24], sigma=0.01 * np.eye(2), bounds=bounds\n)\n\n# Create fixed income component\nfixed_income = FixedIncomePricing(\n num_qubits,\n np.eye(2),\n np.zeros(2),\n cash_flow=[1.0, 2.0],\n rescaling_factor=0.125,\n bounds=bounds,\n uncertainty_model=mvnd,\n)\n\n# the FixedIncomeExpectedValue provides us with the necessary rescalings\n\n# create the A operator for amplitude estimation\nproblem = fixed_income.to_estimation_problem()\n\n# Set number of evaluation qubits (samples)\nnum_eval_qubits = 5\n\n# Construct and run amplitude estimation\nsampler = Sampler()\nalgo = AmplitudeEstimation(num_eval_qubits=num_eval_qubits, sampler=sampler)\nresult = algo.estimate(problem)\n\nprint(f\"Estimated value:\\t{fixed_income.interpret(result):.4f}\")\nprint(f\"Probability: \\t{result.max_probability:.4f}\")\n```\nWhen running the above the estimated value result should be 2.46 and probability 0.8487.\n\n### Further examples\n\nLearning path notebooks may be found in the\n[finance tutorials](https://qiskit-community.github.io/qiskit-finance/tutorials/index.html) section\nof the documentation and are a great place to start.\n\n----------------------------------------------------------------------------------------------------\n\n## Contribution Guidelines\n\nIf you'd like to contribute to Qiskit, please take a look at our\n[contribution guidelines](https://github.com/qiskit-community/qiskit-finance/blob/main/CONTRIBUTING.md).\nThis project adheres to Qiskit's [code of conduct](https://github.com/qiskit-community/qiskit-finance/blob/main/CODE_OF_CONDUCT.md).\nBy participating, you are expected to uphold this code.\n\nWe use [GitHub issues](https://github.com/qiskit-community/qiskit-finance/issues) for tracking requests and bugs. Please\n[join the Qiskit Slack community](https://qisk.it/join-slack)\nand for discussion and simple questions.\nFor questions that are more suited for a forum, we use the **Qiskit** tag in [Stack Overflow](https://stackoverflow.com/questions/tagged/qiskit).\n\n## Authors and Citation\n\nFinance was inspired, authored and brought about by the collective work of a team of researchers.\nFinance continues to grow with the help and work of\n[many people](https://github.com/qiskit-community/qiskit-finance/graphs/contributors), who contribute\nto the project at different levels.\nIf you use Qiskit, please cite as per the provided\n[BibTeX file](https://github.com/Qiskit/qiskit/blob/main/CITATION.bib).\n\n## License\n\nThis project uses the [Apache License 2.0](https://github.com/qiskit-community/qiskit-finance/blob/main/LICENSE.txt).\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Qiskit Finance: A library of quantum computing finance experiments",
"version": "0.4.1",
"project_urls": {
"Bug Tracker": "https://github.com/qiskit-community/qiskit-finance/issues",
"Documentation": "https://qiskit-community.github.io/qiskit-finance/",
"Homepage": "https://github.com/qiskit-community/qiskit-finance",
"Source Code": "https://github.com/qiskit-community/qiskit-finance"
},
"split_keywords": [
"qiskit",
"sdk",
"quantum",
"finance"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "694fd4a8f06b2d20b6054822f4ebf63be21ac2f39aee84266bdd2318950048d9",
"md5": "b185e09811eaf344b826e4f80579ba18",
"sha256": "1aa46d1bfc1813144d504b1da3dbb7a45c14686b430be160952179d4f4dbdf60"
},
"downloads": -1,
"filename": "qiskit_finance-0.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b185e09811eaf344b826e4f80579ba18",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 51155,
"upload_time": "2024-02-29T02:26:25",
"upload_time_iso_8601": "2024-02-29T02:26:25.398919Z",
"url": "https://files.pythonhosted.org/packages/69/4f/d4a8f06b2d20b6054822f4ebf63be21ac2f39aee84266bdd2318950048d9/qiskit_finance-0.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0659d67fd31c54068606e22f28ccdfae8e9354039184b71ded4bd2e89a7c0207",
"md5": "bcc1cab2679843c035f06f49851e527d",
"sha256": "dd9559775918f79f4c5f31577a73cf5f135d1911e6601ebcc1ade3901949908d"
},
"downloads": -1,
"filename": "qiskit-finance-0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "bcc1cab2679843c035f06f49851e527d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 40246,
"upload_time": "2024-02-29T02:26:27",
"upload_time_iso_8601": "2024-02-29T02:26:27.156683Z",
"url": "https://files.pythonhosted.org/packages/06/59/d67fd31c54068606e22f28ccdfae8e9354039184b71ded4bd2e89a7c0207/qiskit-finance-0.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-29 02:26:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "qiskit-community",
"github_project": "qiskit-finance",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "qiskit-finance"
}