quantflow 0.4.4__tar.gz → 0.5.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 (204) hide show
  1. quantflow-0.5.0/.coveragerc +18 -0
  2. quantflow-0.5.0/.dockerignore +16 -0
  3. quantflow-0.5.0/.github/copilot-instructions.md +27 -0
  4. quantflow-0.5.0/.github/workflows/build.yml +75 -0
  5. quantflow-0.5.0/.github/workflows/deploy.yml +74 -0
  6. quantflow-0.5.0/.github/workflows/docker-multiarch.yml +68 -0
  7. quantflow-0.5.0/.gitignore +39 -0
  8. quantflow-0.5.0/.vscode/launch.json +21 -0
  9. quantflow-0.5.0/.vscode/settings.json +7 -0
  10. quantflow-0.5.0/.vscode/tasks.json +16 -0
  11. quantflow-0.5.0/CITATION.cff +23 -0
  12. quantflow-0.5.0/CLAUDE.md +2 -0
  13. quantflow-0.5.0/Makefile +48 -0
  14. quantflow-0.5.0/PKG-INFO +150 -0
  15. quantflow-0.5.0/app/__main__.py +42 -0
  16. quantflow-0.5.0/app/cointegration.py +164 -0
  17. quantflow-0.5.0/app/double_exponential_sampling.py +81 -0
  18. quantflow-0.5.0/app/gaussian_sampling.py +91 -0
  19. quantflow-0.5.0/app/hurst.py +327 -0
  20. quantflow-0.5.0/app/poisson_sampling.py +72 -0
  21. quantflow-0.5.0/app/supersmoother.py +110 -0
  22. quantflow-0.5.0/app/utils/__init__.py +12 -0
  23. quantflow-0.5.0/dev/blocks/quantflow.yaml +12 -0
  24. quantflow-0.5.0/dev/charts.yaml +4 -0
  25. quantflow-0.5.0/dev/helm/.helmignore +21 -0
  26. quantflow-0.5.0/dev/helm/Chart.yaml +5 -0
  27. quantflow-0.5.0/dev/helm/templates/_helpers.tpl +34 -0
  28. quantflow-0.5.0/dev/helm/templates/_service.tpl +92 -0
  29. quantflow-0.5.0/dev/helm/templates/app.yaml +3 -0
  30. quantflow-0.5.0/dev/helm/templates/configmap.yaml +10 -0
  31. quantflow-0.5.0/dev/helm/templates/secret.yaml +13 -0
  32. quantflow-0.5.0/dev/helm/values.yaml +36 -0
  33. quantflow-0.5.0/dev/install +3 -0
  34. quantflow-0.5.0/dev/lint +26 -0
  35. quantflow-0.5.0/dev/marimo +9 -0
  36. quantflow-0.5.0/dev/quantflow.dockerfile +41 -0
  37. quantflow-0.5.0/dev/test +6 -0
  38. quantflow-0.5.0/docs/api/data/deribit.md +11 -0
  39. quantflow-0.5.0/docs/api/data/fed.md +9 -0
  40. quantflow-0.5.0/docs/api/data/fmp.md +13 -0
  41. quantflow-0.5.0/docs/api/data/fred.md +9 -0
  42. quantflow-0.5.0/docs/api/data/index.md +8 -0
  43. quantflow-0.5.0/docs/api/index.md +3 -0
  44. quantflow-0.5.0/docs/api/options/black.md +19 -0
  45. quantflow-0.5.0/docs/api/options/calibration.md +5 -0
  46. quantflow-0.5.0/docs/api/options/index.md +5 -0
  47. quantflow-0.5.0/docs/api/options/pricer.md +9 -0
  48. quantflow-0.5.0/docs/api/options/vol_surface.md +24 -0
  49. quantflow-0.5.0/docs/api/sp/cir.md +5 -0
  50. quantflow-0.5.0/docs/api/sp/compound_poisson.md +3 -0
  51. quantflow-0.5.0/docs/api/sp/heston.md +6 -0
  52. quantflow-0.5.0/docs/api/sp/index.md +9 -0
  53. quantflow-0.5.0/docs/api/sp/jump_diffusion.md +8 -0
  54. quantflow-0.5.0/docs/api/sp/ou.md +13 -0
  55. quantflow-0.5.0/docs/api/sp/poisson.md +5 -0
  56. quantflow-0.5.0/docs/api/sp/weiner.md +3 -0
  57. quantflow-0.5.0/docs/api/ta/ewma.md +4 -0
  58. quantflow-0.5.0/docs/api/ta/index.md +1 -0
  59. quantflow-0.5.0/docs/api/ta/kalman.md +3 -0
  60. quantflow-0.5.0/docs/api/ta/ohlc.md +3 -0
  61. quantflow-0.5.0/docs/api/ta/paths.md +3 -0
  62. quantflow-0.5.0/docs/api/ta/supersmoother.md +14 -0
  63. quantflow-0.5.0/docs/api/utils/bins.md +5 -0
  64. quantflow-0.5.0/docs/api/utils/distributions.md +9 -0
  65. quantflow-0.5.0/docs/api/utils/index.md +1 -0
  66. quantflow-0.5.0/docs/api/utils/marginal1d.md +3 -0
  67. quantflow-0.5.0/docs/assets/heston.gif +0 -0
  68. quantflow-0.5.0/docs/assets/linkedin-banner.png +0 -0
  69. quantflow-0.5.0/docs/assets/quantflow-light.svg +110 -0
  70. quantflow-0.5.0/docs/assets/quantflow-logo.png +0 -0
  71. quantflow-0.5.0/docs/assets/quantflow-repo.png +0 -0
  72. quantflow-0.5.0/docs/assets/quantflow-repo.svg +203 -0
  73. quantflow-0.5.0/docs/assets/quantflow.svg +252 -0
  74. quantflow-0.5.0/docs/bibliography.md +13 -0
  75. quantflow-0.5.0/docs/contributing.md +24 -0
  76. quantflow-0.5.0/docs/index.md +95 -0
  77. quantflow-0.5.0/docs/javascripts/mathjax.js +12 -0
  78. quantflow-0.5.0/mkdocs.yml +116 -0
  79. quantflow-0.5.0/notebooks/CNAME +1 -0
  80. quantflow-0.5.0/notebooks/_config.yml +65 -0
  81. quantflow-0.5.0/notebooks/_toc.yml +46 -0
  82. quantflow-0.5.0/notebooks/applications/calibration.md +204 -0
  83. quantflow-0.5.0/notebooks/applications/calibration.py +189 -0
  84. quantflow-0.5.0/notebooks/applications/hurst.md +202 -0
  85. quantflow-0.5.0/notebooks/applications/overview.md +23 -0
  86. quantflow-0.5.0/notebooks/applications/sampling.md +35 -0
  87. quantflow-0.5.0/notebooks/applications/volatility_surface.md +144 -0
  88. quantflow-0.5.0/notebooks/conf.py +38 -0
  89. quantflow-0.5.0/notebooks/data/fed.md +40 -0
  90. quantflow-0.5.0/notebooks/data/fiscal_data.md +31 -0
  91. quantflow-0.5.0/notebooks/data/fmp.md +80 -0
  92. quantflow-0.5.0/notebooks/data/timeseries.md +39 -0
  93. quantflow-0.5.0/notebooks/examples/heston_vol_surface.md +54 -0
  94. quantflow-0.5.0/notebooks/index.md +54 -0
  95. quantflow-0.5.0/notebooks/models/bns.md +111 -0
  96. quantflow-0.5.0/notebooks/models/cir.md +186 -0
  97. quantflow-0.5.0/notebooks/models/gousv.md +48 -0
  98. quantflow-0.5.0/notebooks/models/heston.md +133 -0
  99. quantflow-0.5.0/notebooks/models/heston_jumps.md +78 -0
  100. quantflow-0.5.0/notebooks/models/jump_diffusion.md +101 -0
  101. quantflow-0.5.0/notebooks/models/ou.md +203 -0
  102. quantflow-0.5.0/notebooks/models/overview.md +19 -0
  103. quantflow-0.5.0/notebooks/models/poisson.md +269 -0
  104. quantflow-0.5.0/notebooks/models/weiner.md +73 -0
  105. quantflow-0.5.0/notebooks/reference/biblio.md +18 -0
  106. quantflow-0.5.0/notebooks/reference/contributing.md +68 -0
  107. quantflow-0.5.0/notebooks/reference/glossary.md +80 -0
  108. quantflow-0.5.0/notebooks/reference/references.bib +139 -0
  109. quantflow-0.5.0/notebooks/theory/characteristic.md +93 -0
  110. quantflow-0.5.0/notebooks/theory/inversion.md +131 -0
  111. quantflow-0.5.0/notebooks/theory/levy.md +122 -0
  112. quantflow-0.5.0/notebooks/theory/option_pricing.md +137 -0
  113. quantflow-0.5.0/notebooks/theory/overview.md +17 -0
  114. {quantflow-0.4.4 → quantflow-0.5.0}/pyproject.toml +49 -54
  115. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/__init__.py +1 -1
  116. quantflow-0.5.0/quantflow/ai/__init__.py +1 -0
  117. quantflow-0.5.0/quantflow/ai/server.py +27 -0
  118. quantflow-0.5.0/quantflow/ai/tools/base.py +33 -0
  119. quantflow-0.5.0/quantflow/ai/tools/charts.py +40 -0
  120. quantflow-0.5.0/quantflow/ai/tools/crypto.py +90 -0
  121. quantflow-0.5.0/quantflow/ai/tools/fred.py +82 -0
  122. quantflow-0.5.0/quantflow/ai/tools/stocks.py +99 -0
  123. quantflow-0.5.0/quantflow/ai/tools/vault.py +35 -0
  124. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/data/deribit.py +7 -6
  125. quantflow-0.5.0/quantflow/options/inputs.py +125 -0
  126. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/options/surface.py +219 -157
  127. quantflow-0.5.0/quantflow_tests/conftest.py +3 -0
  128. quantflow-0.5.0/quantflow_tests/test_ai.py +469 -0
  129. quantflow-0.5.0/quantflow_tests/test_cir.py +38 -0
  130. quantflow-0.5.0/quantflow_tests/test_copula.py +30 -0
  131. quantflow-0.5.0/quantflow_tests/test_data.py +61 -0
  132. quantflow-0.5.0/quantflow_tests/test_distributions.py +31 -0
  133. quantflow-0.5.0/quantflow_tests/test_frft.py +29 -0
  134. quantflow-0.5.0/quantflow_tests/test_heston.py +39 -0
  135. quantflow-0.5.0/quantflow_tests/test_jump_diffusion.py +27 -0
  136. quantflow-0.5.0/quantflow_tests/test_ohlc.py +24 -0
  137. quantflow-0.5.0/quantflow_tests/test_options.py +187 -0
  138. quantflow-0.5.0/quantflow_tests/test_options_pricer.py +22 -0
  139. quantflow-0.5.0/quantflow_tests/test_ou.py +48 -0
  140. quantflow-0.5.0/quantflow_tests/test_poisson.py +101 -0
  141. quantflow-0.5.0/quantflow_tests/test_utils.py +40 -0
  142. quantflow-0.5.0/quantflow_tests/test_vault.py +34 -0
  143. quantflow-0.5.0/quantflow_tests/test_weiner.py +54 -0
  144. quantflow-0.5.0/quantflow_tests/utils.py +46 -0
  145. quantflow-0.5.0/quantflow_tests/volsurface.json +4359 -0
  146. quantflow-0.5.0/readme.md +95 -0
  147. quantflow-0.5.0/rops.toml +15 -0
  148. quantflow-0.5.0/taplo.toml +22 -0
  149. quantflow-0.5.0/test_comparison.py +22 -0
  150. quantflow-0.5.0/uv.lock +4195 -0
  151. quantflow-0.4.4/PKG-INFO +0 -73
  152. quantflow-0.4.4/quantflow/cli/app.py +0 -100
  153. quantflow-0.4.4/quantflow/cli/commands/__init__.py +0 -18
  154. quantflow-0.4.4/quantflow/cli/commands/base.py +0 -134
  155. quantflow-0.4.4/quantflow/cli/commands/crypto.py +0 -149
  156. quantflow-0.4.4/quantflow/cli/commands/fred.py +0 -118
  157. quantflow-0.4.4/quantflow/cli/commands/stocks.py +0 -134
  158. quantflow-0.4.4/quantflow/cli/commands/vault.py +0 -52
  159. quantflow-0.4.4/quantflow/cli/script.py +0 -14
  160. quantflow-0.4.4/quantflow/cli/settings.py +0 -12
  161. quantflow-0.4.4/quantflow/options/inputs.py +0 -72
  162. quantflow-0.4.4/readme.md +0 -38
  163. {quantflow-0.4.4 → quantflow-0.5.0}/LICENSE +0 -0
  164. {quantflow-0.4.4/quantflow/cli → quantflow-0.5.0/quantflow/ai/tools}/__init__.py +0 -0
  165. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/data/__init__.py +0 -0
  166. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/data/fed.py +0 -0
  167. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/data/fiscal_data.py +0 -0
  168. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/data/fmp.py +0 -0
  169. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/data/fred.py +0 -0
  170. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/data/vault.py +0 -0
  171. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/options/__init__.py +0 -0
  172. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/options/bs.py +0 -0
  173. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/options/calibration.py +0 -0
  174. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/options/pricer.py +0 -0
  175. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/py.typed +0 -0
  176. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/sp/__init__.py +0 -0
  177. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/sp/base.py +0 -0
  178. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/sp/bns.py +0 -0
  179. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/sp/cir.py +0 -0
  180. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/sp/copula.py +0 -0
  181. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/sp/dsp.py +0 -0
  182. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/sp/heston.py +0 -0
  183. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/sp/jump_diffusion.py +0 -0
  184. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/sp/ou.py +0 -0
  185. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/sp/poisson.py +0 -0
  186. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/sp/weiner.py +0 -0
  187. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/ta/__init__.py +0 -0
  188. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/ta/base.py +0 -0
  189. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/ta/ewma.py +0 -0
  190. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/ta/kalman.py +0 -0
  191. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/ta/ohlc.py +0 -0
  192. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/ta/paths.py +0 -0
  193. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/ta/supersmoother.py +0 -0
  194. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/utils/__init__.py +0 -0
  195. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/utils/bins.py +0 -0
  196. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/utils/dates.py +0 -0
  197. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/utils/distributions.py +0 -0
  198. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/utils/functions.py +0 -0
  199. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/utils/interest_rates.py +0 -0
  200. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/utils/marginal.py +0 -0
  201. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/utils/numbers.py +0 -0
  202. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/utils/plot.py +0 -0
  203. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/utils/transforms.py +0 -0
  204. {quantflow-0.4.4 → quantflow-0.5.0}/quantflow/utils/types.py +0 -0
@@ -0,0 +1,18 @@
1
+ [run]
2
+ source = quantflow
3
+
4
+ omit =
5
+ quantflow/utils/plot.py
6
+
7
+ [html]
8
+ directory = build/coverage/html
9
+
10
+ [report]
11
+ exclude_lines =
12
+ pragma: no cover
13
+ raise NotImplementedError
14
+ if TYPE_CHECKING:
15
+ @abstract
16
+
17
+ [xml]
18
+ output = build/coverage.xml
@@ -0,0 +1,16 @@
1
+ dist/
2
+ build/
3
+
4
+ __marimo__
5
+ __pycache__
6
+ *.pyc
7
+ *.pyo
8
+ *.pyd
9
+ .data
10
+ .env
11
+ .venv
12
+ .mypy_cache
13
+ .ruff_cache
14
+ .pytest_cache
15
+ .codebuild
16
+ .gihub
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: quantflow-instructions
3
+ description: 'Instructions for quantflow'
4
+ applyTo: '/**'
5
+ ---
6
+
7
+
8
+ # Quantflow Instructions
9
+
10
+
11
+ ## Development
12
+
13
+ * Always run `make lint` after code changes — runs taplo, isort, black, ruff, and mypy
14
+ * Never edit `readme.md` directly — it is generated from `docs/index.md` via `make docs`
15
+
16
+ ## Docker
17
+
18
+ * The Dockerfile is at `dev/quantflow.dockerfile`
19
+ * Uses `ghcr.io/astral-sh/uv:python3.14-bookworm-slim` as the base image (uv + Python bundled, no separate install needed)
20
+ * Multi-stage build: builder installs deps and builds docs, runtime copies the `.venv` and app code
21
+ * Package manager is `uv` — do not use Poetry or pip directly
22
+
23
+ ## Documentation
24
+
25
+ * The documentation for quantflow is available at `https://quantflow.quantmid.com`
26
+ * Documentation is built using [mkdocs](https://www.mkdocs.org/) and stored in the `docs/` directory. The documentation source files are written in markdown format.
27
+
@@ -0,0 +1,75 @@
1
+ name: build
2
+
3
+ on:
4
+ push:
5
+ branches-ignore:
6
+ - deploy
7
+ tags-ignore:
8
+ - v*
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ env:
14
+ PYTHON_ENV: ci
15
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16
+ PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
17
+ FMP_API_KEY: ${{ secrets.FMP_API_KEY }}
18
+ strategy:
19
+ matrix:
20
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ - name: install rops
25
+ uses: quantmind/rops/.github/actions/setup-rops@main
26
+ - name: install taplo
27
+ run: rops tools update taplo
28
+ - name: Set up Python ${{ matrix.python-version }}
29
+ uses: actions/setup-python@v5
30
+ with:
31
+ python-version: ${{ matrix.python-version }}
32
+ - name: Install uv
33
+ run: pip install -U pip uv
34
+ - name: Install dependencies
35
+ run: make install-dev
36
+ - name: run tests
37
+ run: make tests
38
+ - name: Install dependencies
39
+ run: make install-dev
40
+ - name: run lint
41
+ run: make lint-check
42
+ - name: run tests
43
+ run: make tests
44
+ - name: upload coverage reports to codecov
45
+ if: matrix.python-version == '3.14'
46
+ uses: codecov/codecov-action@v3
47
+ with:
48
+ token: ${{ secrets.CODECOV_TOKEN }}
49
+ files: ./build/coverage.xml
50
+ - name: publish
51
+ if: ${{ matrix.python-version == '3.14' && github.event.head_commit.message == 'release' }}
52
+ run: make publish
53
+
54
+ image:
55
+ if: github.ref == 'refs/heads/main'
56
+ uses: ./.github/workflows/docker-multiarch.yml
57
+ needs: build
58
+ with:
59
+ image-name: quantflow
60
+
61
+ deploy:
62
+ name: Create Deployment
63
+ if: github.ref == 'refs/heads/main'
64
+ runs-on: ubuntu-latest
65
+ permissions:
66
+ deployments: write
67
+ needs: image
68
+ steps:
69
+ - uses: chrnorm/deployment-action@v2
70
+ name: Create GitHub deployment
71
+ id: deployment
72
+ with:
73
+ token: "${{ secrets.TOKEN_DEPLOYMENT }}"
74
+ environment: prod
75
+ payload: '{"tag": "main-${{ github.sha }}"}'
@@ -0,0 +1,74 @@
1
+ name: deploy
2
+
3
+ on: deployment
4
+
5
+ jobs:
6
+ deploy:
7
+ runs-on: ubuntu-latest
8
+ # These permissions are needed for AWS GitHub's OIDC Token endpoint.
9
+ permissions:
10
+ id-token: write
11
+ contents: read
12
+ env:
13
+ K8S_ENV: ${{ github.event.deployment.environment }}
14
+ IMAGE_TAG: ${{ github.event.deployment.payload.tag }}
15
+ METABLOCK_API_TOKEN: ${{ secrets.METABLOCK_API_TOKEN }}
16
+ RUST_LOG: info
17
+
18
+ steps:
19
+ - name: Update deployment status (in_progress)
20
+ if: success()
21
+ uses: chrnorm/deployment-status@v2
22
+ with:
23
+ token: "${{ secrets.TOKEN_DEPLOYMENT }}"
24
+ deployment-id: ${{ github.event.deployment.id }}
25
+ state: "in_progress"
26
+ - name: checkout repo
27
+ uses: actions/checkout@v4
28
+ with:
29
+ ref: ${{ github.event.deployment.sha }}
30
+ - name: checkout vars
31
+ uses: actions/checkout@v4
32
+ with:
33
+ repository: quantmind/metaplatform
34
+ path: metaplatform
35
+ token: ${{ secrets.TOKEN_DEPLOYMENT }}
36
+ - name: Configure AWS Credentials
37
+ uses: aws-actions/configure-aws-credentials@v2
38
+ with:
39
+ role-to-assume: arn:aws:iam::337900243020:role/GithubActions
40
+ aws-region: eu-west-1
41
+ - name: install rops
42
+ uses: quantmind/rops/.github/actions/setup-rops@main
43
+ env:
44
+ GITHUB_TOKEN: ${{ secrets.TOKEN_DEPLOYMENT }}
45
+ - name: Install mozilla sops
46
+ uses: mdgreenwald/mozilla-sops-action@v1.4.1
47
+ - name: deploy quantflow
48
+ run: |
49
+ rops charts update
50
+ rops charts deploy \
51
+ quantflow \
52
+ --env ${K8S_ENV} \
53
+ --set image.tag=${IMAGE_TAG} \
54
+ --wait
55
+ - name: Update ingress configuration
56
+ uses: quantmind/metablock-ingress@v3
57
+ with:
58
+ token: ${{ secrets.METABLOCK_API_TOKEN }}
59
+ space: quantmind
60
+ path: dev/blocks
61
+ - name: Update deployment status (success)
62
+ if: success()
63
+ uses: chrnorm/deployment-status@v2
64
+ with:
65
+ token: "${{ secrets.TOKEN_DEPLOYMENT }}"
66
+ deployment-id: ${{ github.event.deployment.id }}
67
+ state: "success"
68
+ - name: Update deployment status (failure)
69
+ if: failure()
70
+ uses: chrnorm/deployment-status@v2
71
+ with:
72
+ token: "${{ secrets.TOKEN_DEPLOYMENT }}"
73
+ deployment-id: ${{ github.event.deployment.id }}
74
+ state: "failure"
@@ -0,0 +1,68 @@
1
+ name: Docker Multi-arch Build
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ image-name:
7
+ required: true
8
+ type: string
9
+
10
+ jobs:
11
+ build-amd64:
12
+ runs-on: ubuntu-latest
13
+ env:
14
+ GITHUB_TOKEN: ${{ github.token }}
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - name: Login to GitHub Container Registry
19
+ uses: docker/login-action@v3
20
+ with:
21
+ registry: ghcr.io
22
+ username: ${{ github.actor }}
23
+ password: ${{ github.token }}
24
+ - name: install rops
25
+ uses: quantmind/rops/.github/actions/setup-rops@main
26
+ - name: build amd64
27
+ run: rops docker build ${{ inputs.image-name }}
28
+ - name: push amd64
29
+ run: rops docker push ${{ inputs.image-name }} --arch
30
+
31
+ build-arm64:
32
+ runs-on: ubuntu-24.04-arm
33
+ env:
34
+ GITHUB_TOKEN: ${{ github.token }}
35
+ DOCKER_BUILDKIT: 0
36
+
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+ - name: Login to GitHub Container Registry
40
+ uses: docker/login-action@v3
41
+ with:
42
+ registry: ghcr.io
43
+ username: ${{ github.actor }}
44
+ password: ${{ github.token }}
45
+ - name: install rops
46
+ uses: quantmind/rops/.github/actions/setup-rops@main
47
+ - name: build arm64
48
+ run: rops docker build ${{ inputs.image-name }}
49
+ - name: push arm64
50
+ run: rops docker push ${{ inputs.image-name }} --arch
51
+
52
+ manifest:
53
+ needs: [build-amd64, build-arm64]
54
+ runs-on: ubuntu-latest
55
+ env:
56
+ GITHUB_TOKEN: ${{ github.token }}
57
+ steps:
58
+ - uses: actions/checkout@v4
59
+ - name: Login to GitHub Container Registry
60
+ uses: docker/login-action@v3
61
+ with:
62
+ registry: ghcr.io
63
+ username: ${{ github.actor }}
64
+ password: ${{ github.token }}
65
+ - name: install rops
66
+ uses: quantmind/rops/.github/actions/setup-rops@main
67
+ - name: create manifest
68
+ run: rops docker manifest ${{ inputs.image-name }}
@@ -0,0 +1,39 @@
1
+ #
2
+ # IDEs
3
+ .idea
4
+ *.sublime-workspace
5
+
6
+ #
7
+ # Files
8
+ .DS_Store
9
+ *.log
10
+ .env
11
+
12
+ #
13
+ # Coverage
14
+ .coveralls-repo-token
15
+ .coverage
16
+ htmlcov
17
+
18
+ #
19
+ # Python
20
+ *.pyc
21
+ .eggs
22
+ *.egg-info
23
+ __pycache__
24
+ __marimo__
25
+ build
26
+ dist
27
+ .venv
28
+ .mypy_cache
29
+ .pytest_cache
30
+ .ruff_cache
31
+ .python-version
32
+
33
+ # Jupyter
34
+ *.ipynb
35
+ .ipynb_checkpoints
36
+ _build
37
+
38
+ # builds
39
+ app/docs
@@ -0,0 +1,21 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+
5
+ {
6
+ "name": "PyTest",
7
+ "type": "debugpy",
8
+ "request": "launch",
9
+ "cwd": "${workspaceFolder}",
10
+ "console": "integratedTerminal",
11
+ "module": "pytest",
12
+ "env": {},
13
+ "justMyCode": false,
14
+ "args": [
15
+ "-x",
16
+ "-vvv",
17
+ "quantflow_tests/test_data.py::test_fed_yc",
18
+ ]
19
+ },
20
+ ]
21
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "python.defaultInterpreterPath": ".venv/bin/python",
3
+ "[python]": {
4
+ "editor.defaultFormatter": "ms-python.black-formatter",
5
+ "editor.formatOnSave": true
6
+ }
7
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "tasks": [
3
+ {
4
+ "label": "JupyText Sync",
5
+ "type": "shell",
6
+ "command": "${command:python.interpreterPath} -m jupytext ${file} -s",
7
+ "group": {
8
+ "kind": "build",
9
+ "isDefault": true
10
+ },
11
+ "presentation": {
12
+ "reveal": "never",
13
+ }
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,23 @@
1
+ # This CITATION.cff file was generated with cffinit.
2
+ # Visit https://bit.ly/cffinit to generate yours today!
3
+
4
+ cff-version: 1.2.0
5
+ title: quantflow
6
+ message: >-
7
+ If you use this software, please cite it using the
8
+ metadata from this file.
9
+ type: software
10
+ authors:
11
+ - given-names: Luca
12
+ family-names: Sbardella
13
+ email: luca@quantmind.com
14
+ - name: quantmind
15
+ repository-code: 'https://github.com/quantmind/quantflow'
16
+ url: 'https://quantflow.quantmind.com'
17
+ abstract: Quantitative finance and derivative pricing
18
+ keywords:
19
+ - finance
20
+ - option-pricing
21
+ - quantitative-finance
22
+ - timeseries
23
+ license: BSD-3-Clause
@@ -0,0 +1,2 @@
1
+ @readme.md
2
+ @.github/copilot-instructions.md
@@ -0,0 +1,48 @@
1
+
2
+ .PHONY: help
3
+ help:
4
+ @echo ================================================================================
5
+ @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
6
+ @echo ================================================================================
7
+
8
+
9
+ .PHONY: lint
10
+ lint: ## Lint and fix
11
+ @uv run ./dev/lint fix
12
+
13
+
14
+ .PHONY: lint-check
15
+ lint-check: ## Lint check only
16
+ @uv run ./dev/lint
17
+
18
+
19
+ .PHONY: install-dev
20
+ install-dev: ## Install development dependencies
21
+ @./dev/install
22
+
23
+ .PHONY: marimo
24
+ marimo: ## Run marimo for editing notebooks
25
+ @./dev/marimo edit
26
+
27
+ .PHONY: docs
28
+ docs: ## build documentation
29
+ @cp docs/index.md readme.md
30
+ @uv run mkdocs build
31
+
32
+ .PHONY: docs-serve
33
+ docs-serve: ## serve documentation
34
+ @uv run mkdocs serve --livereload --watch quantflow --watch docs
35
+
36
+ .PHONY: publish
37
+ publish: ## Release to pypi
38
+ @uv build
39
+ @uv publish --token $(PYPI_TOKEN)
40
+
41
+ .PHONY: tests
42
+ tests: ## Unit tests
43
+ @./dev/test
44
+
45
+
46
+ .PHONY: outdated
47
+ outdated: ## Show outdated packages
48
+ uv tree --outdated
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.4
2
+ Name: quantflow
3
+ Version: 0.5.0
4
+ Summary: quantitative analysis
5
+ Project-URL: Homepage, https://github.com/quantmind/quantflow
6
+ Project-URL: Repository, https://github.com/quantmind/quantflow
7
+ Project-URL: Documentation, https://quantmind.github.io/quantflow/
8
+ Author-email: Luca Sbardella <luca@quantmind.com>
9
+ License-Expression: BSD-3-Clause
10
+ License-File: LICENSE
11
+ Requires-Python: <3.15,>=3.11
12
+ Requires-Dist: ccy>=1.7.1
13
+ Requires-Dist: polars[pandas,pyarrow]>=1.11.0
14
+ Requires-Dist: pydantic>=2.0.2
15
+ Requires-Dist: python-dotenv>=1.0.1
16
+ Requires-Dist: scipy>=1.14.1
17
+ Requires-Dist: statsmodels<0.15.0,>=0.14.6
18
+ Provides-Extra: ai
19
+ Requires-Dist: asciichartpy>=1.5.25; extra == 'ai'
20
+ Requires-Dist: ccy[holidays]>=1.7.1; extra == 'ai'
21
+ Requires-Dist: google-genai>=1.61.0; extra == 'ai'
22
+ Requires-Dist: mcp>=1.26.0; extra == 'ai'
23
+ Requires-Dist: openai>=2.16.0; extra == 'ai'
24
+ Requires-Dist: pydantic-ai-slim>=1.51.0; extra == 'ai'
25
+ Requires-Dist: rich>=13.9.4; extra == 'ai'
26
+ Provides-Extra: book
27
+ Requires-Dist: altair>=6.0.0; extra == 'book'
28
+ Requires-Dist: autodocsumm>=0.2.14; extra == 'book'
29
+ Requires-Dist: duckdb>=1.4.4; extra == 'book'
30
+ Requires-Dist: fastapi>=0.129.0; extra == 'book'
31
+ Requires-Dist: marimo>=0.19.7; extra == 'book'
32
+ Requires-Dist: plotly>=6.2.0; extra == 'book'
33
+ Requires-Dist: sympy>=1.12; extra == 'book'
34
+ Provides-Extra: data
35
+ Requires-Dist: aio-fluid[http]>=1.2.1; extra == 'data'
36
+ Provides-Extra: dev
37
+ Requires-Dist: black>=26.3.1; extra == 'dev'
38
+ Requires-Dist: ghp-import>=2.0.2; extra == 'dev'
39
+ Requires-Dist: isort>=8.0.0; extra == 'dev'
40
+ Requires-Dist: mypy>=1.14.1; extra == 'dev'
41
+ Requires-Dist: pytest-asyncio>=1.0.0; extra == 'dev'
42
+ Requires-Dist: pytest-cov>=7.0.0; extra == 'dev'
43
+ Requires-Dist: ruff>=0.15.4; extra == 'dev'
44
+ Requires-Dist: types-python-dateutil>=2.9.0.20251115; extra == 'dev'
45
+ Provides-Extra: docs
46
+ Requires-Dist: griffe-pydantic>=1.1.0; extra == 'docs'
47
+ Requires-Dist: griffe-typingdoc>=0.2.7; extra == 'docs'
48
+ Requires-Dist: mkdocs-macros-plugin>=1.3.7; extra == 'docs'
49
+ Requires-Dist: mkdocs-material>=9.7.0; extra == 'docs'
50
+ Requires-Dist: mkdocs-redirects>=1.2.1; extra == 'docs'
51
+ Requires-Dist: mkdocstrings[python]==1.0.0; extra == 'docs'
52
+ Provides-Extra: ml
53
+ Requires-Dist: torch>=2.10.0; extra == 'ml'
54
+ Description-Content-Type: text/markdown
55
+
56
+ # <a href="https://quantmind.github.io/quantflow"><img src="https://raw.githubusercontent.com/quantmind/quantflow/main/notebooks/assets/quantflow-light.svg" width=300 /></a>
57
+
58
+ [![PyPI version](https://badge.fury.io/py/quantflow.svg)](https://badge.fury.io/py/quantflow)
59
+ [![Python versions](https://img.shields.io/pypi/pyversions/quantflow.svg)](https://pypi.org/project/quantflow)
60
+ [![Python downloads](https://img.shields.io/pypi/dd/quantflow.svg)](https://pypi.org/project/quantflow)
61
+ [![build](https://github.com/quantmind/quantflow/actions/workflows/build.yml/badge.svg)](https://github.com/quantmind/quantflow/actions/workflows/build.yml)
62
+ [![codecov](https://codecov.io/gh/quantmind/quantflow/branch/main/graph/badge.svg?token=wkH9lYKOWP)](https://codecov.io/gh/quantmind/quantflow)
63
+
64
+ Quantitative analysis and pricing tools.
65
+
66
+ ![btcvol](https://github.com/quantmind/quantflow/assets/144320/88ed85d1-c3c5-489c-ac07-21b036593214)
67
+
68
+ ## Installation
69
+
70
+ ```bash
71
+ pip install quantflow
72
+ ```
73
+
74
+ ## Modules
75
+
76
+ * [quantflow.ai](https://github.com/quantmind/quantflow/tree/main/quantflow/ai) MCP server for AI clients (requires `quantflow[ai,data]`)
77
+ * [quantflow.data](https://github.com/quantmind/quantflow/tree/main/quantflow/data) data APIs (requires `quantflow[data]`)
78
+ * [quantflow.options](https://github.com/quantmind/quantflow/tree/main/quantflow/options) option pricing and calibration
79
+ * [quantflow.sp](https://github.com/quantmind/quantflow/tree/main/quantflow/sp) stochastic process primitives
80
+ * [quantflow.ta](https://github.com/quantmind/quantflow/tree/main/quantflow/ta) timeseries analysis tools
81
+ * [quantflow.utils](https://github.com/quantmind/quantflow/tree/main/quantflow/utils) utilities and helpers
82
+
83
+ ## Optional dependencies
84
+
85
+ * `data` — data retrieval: `pip install quantflow[data]`
86
+ * `ai` — MCP server for AI clients: `pip install quantflow[ai,data]`
87
+
88
+ ## MCP Server
89
+
90
+ Quantflow exposes its data tools as an [MCP](https://modelcontextprotocol.io) server, allowing AI clients such as Claude to query market data, crypto volatility surfaces, and economic indicators directly.
91
+
92
+ Install with the `ai` and `data` extras:
93
+
94
+ ```bash
95
+ pip install quantflow[ai,data]
96
+ ```
97
+
98
+ ### API keys
99
+
100
+ Store your API keys in `~/.quantflow/.vault`:
101
+
102
+ ```
103
+ fmp=your-fmp-key
104
+ fred=your-fred-key
105
+ ```
106
+
107
+ Or let the AI manage them for you via the `vault_add` tool once connected.
108
+
109
+ ### Claude Code
110
+
111
+ ```bash
112
+ claude mcp add quantflow -- uv run qf-mcp
113
+ ```
114
+
115
+ ### Claude Desktop
116
+
117
+ Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
118
+
119
+ ```json
120
+ {
121
+ "mcpServers": {
122
+ "quantflow": {
123
+ "command": "uv",
124
+ "args": ["run", "qf-mcp"]
125
+ }
126
+ }
127
+ }
128
+ ```
129
+
130
+ ### Available tools
131
+
132
+ | Tool | Description |
133
+ |---|---|
134
+ | `vault_keys` | List stored API keys |
135
+ | `vault_add` | Add or update an API key |
136
+ | `vault_delete` | Delete an API key |
137
+ | `stock_indices` | List stock market indices |
138
+ | `stock_search` | Search companies by name or symbol |
139
+ | `stock_profile` | Get company profile |
140
+ | `stock_prices` | Get OHLC price history |
141
+ | `sector_performance` | Sector performance and PE ratios |
142
+ | `crypto_instruments` | List Deribit instruments |
143
+ | `crypto_historical_volatility` | Historical volatility from Deribit |
144
+ | `crypto_term_structure` | Volatility term structure |
145
+ | `crypto_implied_volatility` | Implied volatility surface |
146
+ | `crypto_prices` | Crypto OHLC price history |
147
+ | `ascii_chart` | ASCII chart for any stock or crypto symbol |
148
+ | `fred_subcategories` | Browse FRED categories |
149
+ | `fred_series` | List series in a FRED category |
150
+ | `fred_data` | Fetch FRED observations |
@@ -0,0 +1,42 @@
1
+ import os
2
+ from pathlib import Path
3
+
4
+ import marimo
5
+ from fastapi import FastAPI, APIRouter
6
+ from fastapi.staticfiles import StaticFiles
7
+
8
+ APP_PATH = Path(__file__).parent
9
+ PORT = int(os.environ.get("MICRO_SERVICE_PORT", "8001"))
10
+ status_router = APIRouter()
11
+
12
+
13
+ def crate_app() -> FastAPI:
14
+ # Create a marimo asgi app
15
+ server = marimo.create_asgi_app(include_code=True)
16
+ for path in APP_PATH.glob("*.py"):
17
+ if path.name.startswith("_"):
18
+ continue
19
+ dashed = path.stem.replace("_", "-")
20
+ server = server.with_app(path=f"/{dashed}", root=f"./app/{path.name}")
21
+ # Create a FastAPI app
22
+ app = FastAPI()
23
+ app.include_router(status_router)
24
+ app.mount("/examples", server.build())
25
+ app.mount("/", StaticFiles(directory=APP_PATH / "docs", html=True), name="static")
26
+ return app
27
+
28
+ @status_router.get("/status")
29
+ async def service_status() -> dict:
30
+ return {"status": "ok"}
31
+
32
+
33
+ @status_router.get("/ready")
34
+ async def service_ready() -> dict:
35
+ return {"status": "ok"}
36
+
37
+
38
+ # Run the server
39
+ if __name__ == "__main__":
40
+ import uvicorn
41
+
42
+ uvicorn.run(crate_app(), host="0.0.0.0", port=PORT)