Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qiskit-community/qiskit-finance
Quantum Finance
https://github.com/qiskit-community/qiskit-finance
Last synced: 6 days ago
JSON representation
Quantum Finance
- Host: GitHub
- URL: https://github.com/qiskit-community/qiskit-finance
- Owner: qiskit-community
- License: apache-2.0
- Created: 2021-01-19T15:55:37.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-20T08:48:22.000Z (9 months ago)
- Last Synced: 2024-05-21T15:18:44.709Z (9 months ago)
- Language: Python
- Homepage: https://qiskit-community.github.io/qiskit-finance/
- Size: 13.6 MB
- Stars: 214
- Watchers: 12
- Forks: 128
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- quantum-awesome - https://github.com/Qiskit/qiskit-finance
README
# Qiskit Finance
[![License](https://img.shields.io/github/license/Qiskit/qiskit-finance.svg?style=popout-square)](https://opensource.org/licenses/Apache-2.0)[![Build Status](https://github.com/qiskit-community/qiskit-finance/workflows/Finance%20Unit%20Tests/badge.svg?branch=main)](https://github.com/qiskit-community/qiskit-finance/actions?query=workflow%3A"Finance%20Unit%20Tests"+branch%3Amain+event%3Apush)[![](https://img.shields.io/github/release/Qiskit/qiskit-finance.svg?style=popout-square)](https://github.com/qiskit-community/qiskit-finance/releases)[![](https://img.shields.io/pypi/dm/qiskit-finance.svg?style=popout-square)](https://pypi.org/project/qiskit-finance/)[![Coverage Status](https://coveralls.io/repos/github/Qiskit/qiskit-finance/badge.svg?branch=main)](https://coveralls.io/github/Qiskit/qiskit-finance?branch=main)
**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).