qufin 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. qufin-0.1.0/.editorconfig +15 -0
  2. qufin-0.1.0/.github/FUNDING.yml +1 -0
  3. qufin-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +46 -0
  4. qufin-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
  5. qufin-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +29 -0
  6. qufin-0.1.0/.github/workflows/ci.yml +94 -0
  7. qufin-0.1.0/.gitignore +59 -0
  8. qufin-0.1.0/.pre-commit-config.yaml +15 -0
  9. qufin-0.1.0/CHANGELOG.md +81 -0
  10. qufin-0.1.0/CITATION.cff +15 -0
  11. qufin-0.1.0/CODE_OF_CONDUCT.md +37 -0
  12. qufin-0.1.0/CONTRIBUTING.md +90 -0
  13. qufin-0.1.0/GOVERNANCE.md +25 -0
  14. qufin-0.1.0/LICENSE +190 -0
  15. qufin-0.1.0/PKG-INFO +279 -0
  16. qufin-0.1.0/README.md +202 -0
  17. qufin-0.1.0/SECURITY.md +24 -0
  18. qufin-0.1.0/benchmarks/classical_comparison.py +399 -0
  19. qufin-0.1.0/benchmarks/quantum_advantage.py +377 -0
  20. qufin-0.1.0/benchmarks/quantum_scaling.py +537 -0
  21. qufin-0.1.0/benchmarks/run_all.py +75 -0
  22. qufin-0.1.0/data/README.md +3 -0
  23. qufin-0.1.0/docs/api/backends.md +42 -0
  24. qufin-0.1.0/docs/api/backtesting.md +29 -0
  25. qufin-0.1.0/docs/api/benchmarks.md +39 -0
  26. qufin-0.1.0/docs/api/data.md +17 -0
  27. qufin-0.1.0/docs/api/options.md +75 -0
  28. qufin-0.1.0/docs/api/portfolio.md +95 -0
  29. qufin-0.1.0/docs/api/risk.md +42 -0
  30. qufin-0.1.0/docs/benchmarks.md +109 -0
  31. qufin-0.1.0/docs/getting-started/install.md +54 -0
  32. qufin-0.1.0/docs/getting-started/quickstart.md +102 -0
  33. qufin-0.1.0/docs/index.md +89 -0
  34. qufin-0.1.0/docs/javascripts/mathjax.js +16 -0
  35. qufin-0.1.0/docs/theory/qae.md +99 -0
  36. qufin-0.1.0/docs/theory/qaoa.md +93 -0
  37. qufin-0.1.0/docs/theory/qubo.md +120 -0
  38. qufin-0.1.0/docs/user-guide/backends.md +134 -0
  39. qufin-0.1.0/docs/user-guide/backtesting.md +105 -0
  40. qufin-0.1.0/docs/user-guide/options.md +142 -0
  41. qufin-0.1.0/docs/user-guide/portfolio.md +163 -0
  42. qufin-0.1.0/docs/user-guide/risk.md +142 -0
  43. qufin-0.1.0/mkdocs.yml +97 -0
  44. qufin-0.1.0/notebooks/executive_demo.ipynb +161 -0
  45. qufin-0.1.0/notebooks/technical_deep_dive.ipynb +143 -0
  46. qufin-0.1.0/papers/joss/paper.bib +135 -0
  47. qufin-0.1.0/papers/joss/paper.md +48 -0
  48. qufin-0.1.0/pyproject.toml +142 -0
  49. qufin-0.1.0/src/qufin/__init__.py +23 -0
  50. qufin-0.1.0/src/qufin/_typing.py +14 -0
  51. qufin-0.1.0/src/qufin/_version.py +24 -0
  52. qufin-0.1.0/src/qufin/backends/__init__.py +43 -0
  53. qufin-0.1.0/src/qufin/backends/base.py +60 -0
  54. qufin-0.1.0/src/qufin/backends/braket_backend.py +136 -0
  55. qufin-0.1.0/src/qufin/backends/cirq_backend.py +131 -0
  56. qufin-0.1.0/src/qufin/backends/error_mitigation.py +370 -0
  57. qufin-0.1.0/src/qufin/backends/ibm_runtime.py +137 -0
  58. qufin-0.1.0/src/qufin/backends/mock.py +48 -0
  59. qufin-0.1.0/src/qufin/backends/noise_models.py +296 -0
  60. qufin-0.1.0/src/qufin/backends/pennylane_backend.py +146 -0
  61. qufin-0.1.0/src/qufin/backends/qiskit_backend.py +54 -0
  62. qufin-0.1.0/src/qufin/backtesting/__init__.py +8 -0
  63. qufin-0.1.0/src/qufin/backtesting/engine.py +237 -0
  64. qufin-0.1.0/src/qufin/backtesting/metrics.py +187 -0
  65. qufin-0.1.0/src/qufin/benchmarks/__init__.py +31 -0
  66. qufin-0.1.0/src/qufin/benchmarks/leaderboard.py +78 -0
  67. qufin-0.1.0/src/qufin/benchmarks/manifest.py +91 -0
  68. qufin-0.1.0/src/qufin/benchmarks/metrics.py +59 -0
  69. qufin-0.1.0/src/qufin/benchmarks/problems.py +159 -0
  70. qufin-0.1.0/src/qufin/benchmarks/runner.py +100 -0
  71. qufin-0.1.0/src/qufin/data/__init__.py +13 -0
  72. qufin-0.1.0/src/qufin/data/cache.py +55 -0
  73. qufin-0.1.0/src/qufin/data/equities.py +68 -0
  74. qufin-0.1.0/src/qufin/data/interfaces.py +3 -0
  75. qufin-0.1.0/src/qufin/data/macro.py +126 -0
  76. qufin-0.1.0/src/qufin/data/synthetic.py +182 -0
  77. qufin-0.1.0/src/qufin/data/universes.py +31 -0
  78. qufin-0.1.0/src/qufin/derivatives/__init__.py +35 -0
  79. qufin-0.1.0/src/qufin/derivatives/autocallable.py +163 -0
  80. qufin-0.1.0/src/qufin/derivatives/basket.py +182 -0
  81. qufin-0.1.0/src/qufin/derivatives/bermudan_lsm.py +146 -0
  82. qufin-0.1.0/src/qufin/derivatives/path_dependent.py +155 -0
  83. qufin-0.1.0/src/qufin/hedging/__init__.py +14 -0
  84. qufin-0.1.0/src/qufin/hedging/deep_hedging.py +285 -0
  85. qufin-0.1.0/src/qufin/hedging/delta.py +199 -0
  86. qufin-0.1.0/src/qufin/hedging/quantum_deep_hedging.py +251 -0
  87. qufin-0.1.0/src/qufin/hedging/rl_quantum.py +244 -0
  88. qufin-0.1.0/src/qufin/ml/__init__.py +27 -0
  89. qufin-0.1.0/src/qufin/ml/classifiers.py +173 -0
  90. qufin-0.1.0/src/qufin/ml/kernels.py +167 -0
  91. qufin-0.1.0/src/qufin/ml/qgan.py +244 -0
  92. qufin-0.1.0/src/qufin/ml/reservoir.py +156 -0
  93. qufin-0.1.0/src/qufin/options/__init__.py +16 -0
  94. qufin-0.1.0/src/qufin/options/amplitude_estimation/__init__.py +41 -0
  95. qufin-0.1.0/src/qufin/options/amplitude_estimation/canonical.py +185 -0
  96. qufin-0.1.0/src/qufin/options/amplitude_estimation/estimation_problem.py +112 -0
  97. qufin-0.1.0/src/qufin/options/amplitude_estimation/european_qae.py +162 -0
  98. qufin-0.1.0/src/qufin/options/amplitude_estimation/fqae.py +169 -0
  99. qufin-0.1.0/src/qufin/options/amplitude_estimation/iqae.py +295 -0
  100. qufin-0.1.0/src/qufin/options/amplitude_estimation/mlae.py +186 -0
  101. qufin-0.1.0/src/qufin/options/asian.py +198 -0
  102. qufin-0.1.0/src/qufin/options/barrier.py +248 -0
  103. qufin-0.1.0/src/qufin/options/bermudan.py +129 -0
  104. qufin-0.1.0/src/qufin/options/classical/__init__.py +28 -0
  105. qufin-0.1.0/src/qufin/options/classical/binomial.py +148 -0
  106. qufin-0.1.0/src/qufin/options/classical/black_scholes.py +185 -0
  107. qufin-0.1.0/src/qufin/options/classical/monte_carlo.py +192 -0
  108. qufin-0.1.0/src/qufin/options/distributions.py +209 -0
  109. qufin-0.1.0/src/qufin/options/european.py +87 -0
  110. qufin-0.1.0/src/qufin/options/heston.py +280 -0
  111. qufin-0.1.0/src/qufin/portfolio/__init__.py +7 -0
  112. qufin-0.1.0/src/qufin/portfolio/classical/__init__.py +10 -0
  113. qufin-0.1.0/src/qufin/portfolio/classical/black_litterman.py +95 -0
  114. qufin-0.1.0/src/qufin/portfolio/classical/hrp.py +107 -0
  115. qufin-0.1.0/src/qufin/portfolio/classical/mean_variance.py +167 -0
  116. qufin-0.1.0/src/qufin/portfolio/classical/risk_parity.py +87 -0
  117. qufin-0.1.0/src/qufin/portfolio/encodings.py +164 -0
  118. qufin-0.1.0/src/qufin/portfolio/mixers.py +227 -0
  119. qufin-0.1.0/src/qufin/portfolio/optimizers/__init__.py +31 -0
  120. qufin-0.1.0/src/qufin/portfolio/optimizers/exhaustive.py +86 -0
  121. qufin-0.1.0/src/qufin/portfolio/optimizers/hybrid.py +163 -0
  122. qufin-0.1.0/src/qufin/portfolio/optimizers/qaoa.py +180 -0
  123. qufin-0.1.0/src/qufin/portfolio/optimizers/vqe.py +178 -0
  124. qufin-0.1.0/src/qufin/portfolio/optimizers/warm_start.py +209 -0
  125. qufin-0.1.0/src/qufin/portfolio/qubo.py +271 -0
  126. qufin-0.1.0/src/qufin/py.typed +0 -0
  127. qufin-0.1.0/src/qufin/risk/__init__.py +51 -0
  128. qufin-0.1.0/src/qufin/risk/classical_var.py +215 -0
  129. qufin-0.1.0/src/qufin/risk/counterparty.py +157 -0
  130. qufin-0.1.0/src/qufin/risk/credit/__init__.py +37 -0
  131. qufin-0.1.0/src/qufin/risk/credit/egger.py +274 -0
  132. qufin-0.1.0/src/qufin/risk/credit/gaussian_copula.py +194 -0
  133. qufin-0.1.0/src/qufin/risk/credit/nig_copula.py +187 -0
  134. qufin-0.1.0/src/qufin/risk/cvar.py +219 -0
  135. qufin-0.1.0/src/qufin/risk/quantum_var.py +374 -0
  136. qufin-0.1.0/src/qufin/risk/stress.py +202 -0
  137. qufin-0.1.0/src/qufin/utils/__init__.py +8 -0
  138. qufin-0.1.0/src/qufin/utils/encoders.py +40 -0
  139. qufin-0.1.0/src/qufin/utils/logging.py +18 -0
  140. qufin-0.1.0/src/qufin/utils/results.py +40 -0
  141. qufin-0.1.0/src/qufin/utils/settings.py +40 -0
  142. qufin-0.1.0/src/qufin/utils/viz.py +182 -0
  143. qufin-0.1.0/tests/__init__.py +0 -0
  144. qufin-0.1.0/tests/conftest.py +38 -0
  145. qufin-0.1.0/tests/integration/__init__.py +0 -0
  146. qufin-0.1.0/tests/integration/test_benchmark_15.py +116 -0
  147. qufin-0.1.0/tests/integration/test_benchmark_25.py +115 -0
  148. qufin-0.1.0/tests/integration/test_hardware_smoke.py +111 -0
  149. qufin-0.1.0/tests/integration/test_qaoa_aer.py +134 -0
  150. qufin-0.1.0/tests/integration/test_vqe_aer.py +150 -0
  151. qufin-0.1.0/tests/property/__init__.py +0 -0
  152. qufin-0.1.0/tests/property/test_bs_properties.py +65 -0
  153. qufin-0.1.0/tests/property/test_portfolio_properties.py +123 -0
  154. qufin-0.1.0/tests/regression/__init__.py +0 -0
  155. qufin-0.1.0/tests/stress/__init__.py +0 -0
  156. qufin-0.1.0/tests/stress/test_stress_suite.py +1364 -0
  157. qufin-0.1.0/tests/unit/__init__.py +0 -0
  158. qufin-0.1.0/tests/unit/test_asian_barrier.py +103 -0
  159. qufin-0.1.0/tests/unit/test_backends.py +49 -0
  160. qufin-0.1.0/tests/unit/test_backtesting.py +359 -0
  161. qufin-0.1.0/tests/unit/test_basket.py +103 -0
  162. qufin-0.1.0/tests/unit/test_benchmarks.py +138 -0
  163. qufin-0.1.0/tests/unit/test_benchmarks_suite.py +116 -0
  164. qufin-0.1.0/tests/unit/test_binomial.py +45 -0
  165. qufin-0.1.0/tests/unit/test_black_scholes.py +105 -0
  166. qufin-0.1.0/tests/unit/test_cache.py +45 -0
  167. qufin-0.1.0/tests/unit/test_classical_var.py +107 -0
  168. qufin-0.1.0/tests/unit/test_counterparty.py +77 -0
  169. qufin-0.1.0/tests/unit/test_coverage_boost.py +1430 -0
  170. qufin-0.1.0/tests/unit/test_credit_risk.py +172 -0
  171. qufin-0.1.0/tests/unit/test_cvar.py +117 -0
  172. qufin-0.1.0/tests/unit/test_derivatives_exotic.py +190 -0
  173. qufin-0.1.0/tests/unit/test_distributions.py +89 -0
  174. qufin-0.1.0/tests/unit/test_encoders.py +46 -0
  175. qufin-0.1.0/tests/unit/test_encodings.py +90 -0
  176. qufin-0.1.0/tests/unit/test_european.py +50 -0
  177. qufin-0.1.0/tests/unit/test_hedging.py +94 -0
  178. qufin-0.1.0/tests/unit/test_heston.py +113 -0
  179. qufin-0.1.0/tests/unit/test_mixers.py +104 -0
  180. qufin-0.1.0/tests/unit/test_ml_modules.py +116 -0
  181. qufin-0.1.0/tests/unit/test_mlae_fqae.py +108 -0
  182. qufin-0.1.0/tests/unit/test_monte_carlo.py +76 -0
  183. qufin-0.1.0/tests/unit/test_noise_mitigation.py +395 -0
  184. qufin-0.1.0/tests/unit/test_portfolio_classical.py +105 -0
  185. qufin-0.1.0/tests/unit/test_qae.py +134 -0
  186. qufin-0.1.0/tests/unit/test_quantum_var.py +106 -0
  187. qufin-0.1.0/tests/unit/test_qubo.py +154 -0
  188. qufin-0.1.0/tests/unit/test_results.py +30 -0
  189. qufin-0.1.0/tests/unit/test_stress.py +113 -0
  190. qufin-0.1.0/tests/unit/test_synthetic.py +66 -0
  191. qufin-0.1.0/tests/unit/test_vqe.py +349 -0
  192. qufin-0.1.0/tests/unit/test_warm_start.py +104 -0
@@ -0,0 +1,15 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 4
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
10
+
11
+ [*.{yml,yaml,toml}]
12
+ indent_size = 2
13
+
14
+ [*.md]
15
+ trim_trailing_whitespace = false
@@ -0,0 +1 @@
1
+ github: []
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Report a bug in qufin
4
+ title: "[BUG] "
5
+ labels: bug
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Description
10
+
11
+ A clear and concise description of the bug.
12
+
13
+ ## Steps to Reproduce
14
+
15
+ 1. Install qufin version X.X.X
16
+ 2. Run the following code:
17
+
18
+ ```python
19
+ # Minimal code to reproduce the issue
20
+ ```
21
+
22
+ 3. Observe the error.
23
+
24
+ ## Expected Behavior
25
+
26
+ Describe what you expected to happen.
27
+
28
+ ## Actual Behavior
29
+
30
+ Describe what actually happened. Include the full error traceback if applicable.
31
+
32
+ ```
33
+ Paste error output here
34
+ ```
35
+
36
+ ## Environment
37
+
38
+ - **Python version**: (e.g., 3.12.0)
39
+ - **qufin version**: (e.g., 0.1.0)
40
+ - **OS**: (e.g., Ubuntu 24.04, Windows 11, macOS 15)
41
+ - **Qiskit version** (if relevant): (e.g., 2.4.1)
42
+ - **Installation method**: (e.g., pip, from source)
43
+
44
+ ## Additional Context
45
+
46
+ Add any other relevant information, logs, or screenshots.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: Feature Request
3
+ about: Suggest a new feature or enhancement for qufin
4
+ title: "[FEATURE] "
5
+ labels: enhancement
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Description
10
+
11
+ A clear and concise description of the feature you are requesting.
12
+
13
+ ## Use Case
14
+
15
+ Explain the problem this feature would solve or the workflow it would enable. Include references to relevant financial models, quantum algorithms, or academic papers if applicable.
16
+
17
+ ## Proposed Solution
18
+
19
+ Describe your preferred approach to implementing this feature. If you have considered alternatives, list them here with trade-offs.
20
+
21
+ ## Additional Context
22
+
23
+ Add any other information, references, or examples that support this request.
@@ -0,0 +1,29 @@
1
+ ## Summary
2
+
3
+ Describe the changes in this PR and the motivation behind them.
4
+
5
+ Closes #(issue number)
6
+
7
+ ## Type of Change
8
+
9
+ - [ ] Bug fix (non-breaking change that fixes an issue)
10
+ - [ ] New feature (non-breaking change that adds functionality)
11
+ - [ ] Breaking change (fix or feature that would cause existing functionality to change)
12
+ - [ ] Performance improvement
13
+ - [ ] Refactor (no functional changes)
14
+ - [ ] Documentation update
15
+ - [ ] CI/CD or build configuration change
16
+
17
+ ## Checklist
18
+
19
+ - [ ] Tests pass locally (`pytest -m "not hardware and not slow"`)
20
+ - [ ] Lint is clean (`ruff check src/ tests/`)
21
+ - [ ] Code is formatted (`ruff format --check src/ tests/`)
22
+ - [ ] Type checks pass (`mypy`)
23
+ - [ ] New code has tests with adequate coverage
24
+ - [ ] Public APIs have docstrings
25
+ - [ ] CHANGELOG.md updated (if applicable)
26
+
27
+ ## Notes for Reviewers
28
+
29
+ Add any context that would help reviewers understand the changes.
@@ -0,0 +1,94 @@
1
+ name: CI
2
+ on: [push, pull_request]
3
+
4
+ jobs:
5
+ test:
6
+ strategy:
7
+ fail-fast: false
8
+ matrix:
9
+ os: [ubuntu-latest, macos-latest, windows-latest]
10
+ python: ["3.10", "3.11", "3.12"]
11
+ runs-on: ${{ matrix.os }}
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: actions/setup-python@v5
15
+ with:
16
+ python-version: ${{ matrix.python }}
17
+ cache: pip
18
+ - run: pip install -e ".[dev]"
19
+ - run: pytest -m "not hardware and not slow" --cov=qufin --cov-report=xml
20
+ - uses: codecov/codecov-action@v4
21
+ if: matrix.os == 'ubuntu-latest' && matrix.python == '3.12'
22
+ with:
23
+ file: coverage.xml
24
+ fail_ci_if_error: false
25
+
26
+ lint:
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ - uses: actions/setup-python@v5
31
+ with:
32
+ python-version: "3.12"
33
+ cache: pip
34
+ - run: pip install ruff
35
+ - run: ruff check src/ tests/
36
+
37
+ typecheck:
38
+ runs-on: ubuntu-latest
39
+ steps:
40
+ - uses: actions/checkout@v4
41
+ - uses: actions/setup-python@v5
42
+ with:
43
+ python-version: "3.12"
44
+ cache: pip
45
+ - run: pip install -e ".[dev]"
46
+ - run: |
47
+ mypy src/qufin/backtesting/ \
48
+ src/qufin/risk/classical_var.py \
49
+ src/qufin/risk/stress.py \
50
+ src/qufin/risk/counterparty.py \
51
+ src/qufin/portfolio/classical/
52
+
53
+ security:
54
+ runs-on: ubuntu-latest
55
+ steps:
56
+ - uses: actions/checkout@v4
57
+ - uses: actions/setup-python@v5
58
+ with:
59
+ python-version: "3.12"
60
+ cache: pip
61
+ - run: pip install bandit pip-audit
62
+ - run: bandit -r src/qufin/ -ll -q
63
+ - run: pip install -e . && pip-audit
64
+ continue-on-error: true
65
+
66
+ docs:
67
+ runs-on: ubuntu-latest
68
+ steps:
69
+ - uses: actions/checkout@v4
70
+ - uses: actions/setup-python@v5
71
+ with:
72
+ python-version: "3.12"
73
+ cache: pip
74
+ - run: pip install -e ".[dev]" mkdocs mkdocs-material "mkdocstrings[python]"
75
+ - run: mkdocs build --strict
76
+ continue-on-error: true
77
+
78
+ release:
79
+ if: startsWith(github.ref, 'refs/tags/v')
80
+ needs: [test, lint, typecheck]
81
+ runs-on: ubuntu-latest
82
+ environment:
83
+ name: pypi
84
+ url: https://pypi.org/p/qufin
85
+ permissions:
86
+ id-token: write
87
+ contents: read
88
+ steps:
89
+ - uses: actions/checkout@v4
90
+ - uses: actions/setup-python@v5
91
+ with:
92
+ python-version: "3.12"
93
+ - run: pip install build && python -m build
94
+ - uses: pypa/gh-action-pypi-publish@release/v1
qufin-0.1.0/.gitignore ADDED
@@ -0,0 +1,59 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg-info/
6
+ *.egg
7
+ dist/
8
+ build/
9
+ *.whl
10
+ .eggs/
11
+
12
+ # Virtual environments
13
+ .venv/
14
+ venv/
15
+ ENV/
16
+
17
+ # IDE
18
+ .vscode/
19
+ .idea/
20
+ *.swp
21
+ *.swo
22
+ *~
23
+
24
+ # Testing
25
+ .pytest_cache/
26
+ .hypothesis/
27
+ .coverage
28
+ htmlcov/
29
+ .mypy_cache/
30
+ .ruff_cache/
31
+
32
+ # Jupyter
33
+ .ipynb_checkpoints/
34
+
35
+ # Data cache
36
+ data/*.parquet
37
+ data/*.csv
38
+ !data/README.md
39
+
40
+ # OS
41
+ .DS_Store
42
+ Thumbs.db
43
+
44
+ # Docs build
45
+ docs/_build/
46
+ site/
47
+
48
+ # Benchmark outputs
49
+ benchmarks/leaderboard.md
50
+ benchmarks/leaderboard.json
51
+ benchmarks/results/
52
+
53
+ # Secrets
54
+ .env
55
+ *.key
56
+ credentials.json
57
+ rel.md
58
+ plan.md
59
+ guide/
@@ -0,0 +1,15 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.8.6
4
+ hooks:
5
+ - id: ruff
6
+ args: [--fix]
7
+ - id: ruff-format
8
+ - repo: https://github.com/psf/black
9
+ rev: 24.10.0
10
+ hooks:
11
+ - id: black
12
+ - repo: https://github.com/kynan/nbstripout
13
+ rev: 0.8.1
14
+ hooks:
15
+ - id: nbstripout
@@ -0,0 +1,81 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2026-05-11
9
+
10
+ ### Added
11
+
12
+ #### Portfolio Optimization
13
+ - Mean-variance optimization with CVXPY (MIQP with GLPK_MI fallback)
14
+ - Black-Litterman model
15
+ - Risk parity optimization
16
+ - Hierarchical Risk Parity (HRP)
17
+ - QAOA optimizer with X, XY-ring, XY-full, and Grover mixers (CVaR objective, Dicke init)
18
+ - QUBO formulation with cardinality, sector, turnover, and transaction cost constraints
19
+ - One-hot and binary variable encoding
20
+ - Exhaustive QUBO solver for exact reference solutions
21
+
22
+ #### Option Pricing
23
+ - Black-Scholes analytical pricing with full Greeks (delta, gamma, theta, vega, rho)
24
+ - Black-Scholes functional API with implied volatility solver
25
+ - CRR binomial tree (European and American exercise)
26
+ - Monte Carlo engine with antithetic variates (European, Asian, barrier)
27
+ - Bermudan, lookback, cliquet, and autocallable exotic options
28
+
29
+ #### Quantum Amplitude Estimation
30
+ - Canonical QAE
31
+ - Iterative QAE (IQAE)
32
+ - Maximum Likelihood QAE (MLAE)
33
+ - Fourier QAE (FQAE)
34
+
35
+ #### Risk Management
36
+ - Historical, parametric, and Monte Carlo VaR
37
+ - Conditional VaR (CVaR / Expected Shortfall)
38
+ - Stress testing framework
39
+ - Counterparty credit valuation adjustment (CVA/DVA)
40
+ - Credit risk modeling with Gaussian and NIG copula
41
+
42
+ #### Backtesting
43
+ - Walk-forward backtesting engine
44
+ - 15 performance metrics
45
+ - Transaction cost modeling
46
+
47
+ #### Data Layer
48
+ - Yahoo Finance integration
49
+ - FRED macroeconomic data
50
+ - Synthetic data generators (GBM, Heston, Merton jump-diffusion)
51
+ - Local caching system
52
+
53
+ #### Noise Simulation
54
+ - 4 device noise profiles
55
+ - Zero-noise extrapolation (ZNE)
56
+ - Twirled readout error extinction (TREX)
57
+ - Readout error calibration
58
+
59
+ #### Machine Learning
60
+ - Quantum kernel methods
61
+ - Variational Quantum Classifier (VQC)
62
+ - Quantum reservoir computing
63
+
64
+ #### Backends
65
+ - MockBackend for unit testing
66
+ - Qiskit Aer simulator backend
67
+ - Noisy Aer backend with device profiles
68
+ - IBM Runtime backend interface
69
+
70
+ #### Benchmarks
71
+ - 150+ benchmark entries across 15, 25, and 50 asset universes
72
+ - Classical comparison baselines
73
+ - Quantum scaling analysis
74
+ - Quantum advantage metrics
75
+
76
+ #### Infrastructure
77
+ - MkDocs Material documentation site
78
+ - GitHub Actions CI/CD pipeline
79
+ - Linting with ruff, type checking with mypy, security with bandit, dependency audit with pip-audit
80
+
81
+ [0.1.0]: https://github.com/anonymousAAK/qufin/releases/tag/v0.1.0
@@ -0,0 +1,15 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite it as below."
3
+ type: software
4
+ title: "qufin: Research-grade quantum algorithms for quant finance"
5
+ authors:
6
+ - given-names: Adarsh
7
+ license: Apache-2.0
8
+ repository-code: "https://github.com/qufinance/qufin"
9
+ keywords:
10
+ - quantum computing
11
+ - finance
12
+ - portfolio optimization
13
+ - option pricing
14
+ - amplitude estimation
15
+ - QAOA
@@ -0,0 +1,37 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to a positive environment:
15
+ - Using welcoming and inclusive language
16
+ - Being respectful of differing viewpoints and experiences
17
+ - Gracefully accepting constructive criticism
18
+ - Focusing on what is best for the community
19
+
20
+ Examples of unacceptable behavior:
21
+ - The use of sexualized language or imagery
22
+ - Trolling, insulting or derogatory comments, and personal or political attacks
23
+ - Public or private harassment
24
+ - Publishing others' private information without explicit permission
25
+ - Other conduct which could reasonably be considered inappropriate
26
+
27
+ ## Enforcement
28
+
29
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
30
+ reported to the project maintainer. All complaints will be reviewed and
31
+ investigated and will result in a response that is deemed necessary and
32
+ appropriate to the circumstances.
33
+
34
+ ## Attribution
35
+
36
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
37
+ version 2.1.
@@ -0,0 +1,90 @@
1
+ # Contributing to qufin
2
+
3
+ Thank you for your interest in contributing to qufin. This guide covers the workflow and standards for contributions.
4
+
5
+ ## Getting Started
6
+
7
+ 1. Fork the repository on GitHub.
8
+ 2. Clone your fork and create a feature branch:
9
+
10
+ ```bash
11
+ git clone https://github.com/<your-username>/qufin.git
12
+ cd qufin
13
+ git checkout -b feature/your-feature-name
14
+ ```
15
+
16
+ 3. Install the package in development mode with all extras:
17
+
18
+ ```bash
19
+ pip install -e ".[dev]"
20
+ ```
21
+
22
+ ## Development Workflow
23
+
24
+ ### Running Tests
25
+
26
+ Run the fast test suite (excludes hardware and slow integration tests):
27
+
28
+ ```bash
29
+ pytest -m "not hardware and not slow"
30
+ ```
31
+
32
+ Run the full suite including slow tests:
33
+
34
+ ```bash
35
+ pytest
36
+ ```
37
+
38
+ ### Linting and Formatting
39
+
40
+ Check for lint issues:
41
+
42
+ ```bash
43
+ ruff check src/ tests/
44
+ ```
45
+
46
+ Auto-format code:
47
+
48
+ ```bash
49
+ ruff format src/ tests/
50
+ ```
51
+
52
+ ### Type Checking
53
+
54
+ Run mypy on modules that have strict typing enabled:
55
+
56
+ ```bash
57
+ mypy src/qufin/
58
+ ```
59
+
60
+ ## Code Style
61
+
62
+ - **Formatter/linter**: ruff (configured in `pyproject.toml`)
63
+ - **Line length**: 100 characters
64
+ - **Variable naming**: Standard finance and mathematics conventions are acceptable for variable names (e.g., `S` for spot price, `K` for strike, `T` for time to maturity, `sigma` for volatility, `mu` for drift). Use descriptive names for everything else.
65
+ - **Docstrings**: Google style. All public functions and classes must have docstrings.
66
+ - **Type hints**: Required for all public function signatures.
67
+
68
+ ## Pull Request Requirements
69
+
70
+ Before submitting a PR, verify the following:
71
+
72
+ - [ ] All tests pass (`pytest -m "not hardware and not slow"`)
73
+ - [ ] No lint errors (`ruff check src/ tests/`)
74
+ - [ ] Code is formatted (`ruff format --check src/ tests/`)
75
+ - [ ] Type checks pass on modified modules (`mypy`)
76
+ - [ ] New functionality includes tests
77
+ - [ ] Docstrings are present for all public APIs
78
+
79
+ ## Submitting a Pull Request
80
+
81
+ 1. Push your branch to your fork.
82
+ 2. Open a pull request against the `main` branch of the upstream repository.
83
+ 3. Fill out the PR template completely.
84
+ 4. Ensure CI checks pass.
85
+
86
+ A maintainer will review your PR and may request changes. Please respond to feedback promptly.
87
+
88
+ ## Reporting Issues
89
+
90
+ Use the GitHub issue templates for bug reports and feature requests. Provide as much detail as possible to help us reproduce and address the issue.
@@ -0,0 +1,25 @@
1
+ # Governance
2
+
3
+ ## Current model: BDFL (Year 1)
4
+
5
+ qufin is currently maintained by a single developer (Adarsh) with final say
6
+ on all decisions. This is the "Benevolent Dictator For Life" model, appropriate
7
+ for a solo project in its first year.
8
+
9
+ ## Transition trigger (Year 2+)
10
+
11
+ When the project has 3 or more external contributors with 5+ merged PRs each,
12
+ governance transitions to a 3-person Steering Council with rotating chair.
13
+
14
+ ## Contributor ladder
15
+
16
+ 1. **Contributor** - Anyone with a merged PR
17
+ 2. **Triager** - Issue triage rights (after 3+ merged PRs)
18
+ 3. **Committer** - Merge rights on assigned modules (after 5+ merged PRs)
19
+ 4. **Maintainer** - Release rights (Steering Council members)
20
+
21
+ ## Decision process
22
+
23
+ - Minor decisions (bug fixes, docs): maintainer discretion
24
+ - Moderate decisions (new features, API changes): RFC in GitHub Discussions
25
+ - Major decisions (architecture, licensing): Steering Council vote (future)