opengreeks 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.
@@ -0,0 +1,120 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, master]
6
+ tags: ['v*']
7
+ pull_request:
8
+ branches: [main, master]
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ # ---------- Fast PR feedback: cargo test on the zero-dep Rust cores ----------
16
+ rust-test:
17
+ name: Rust core tests
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: dtolnay/rust-toolchain@stable
22
+ - uses: Swatinem/rust-cache@v2
23
+ - name: cargo test (black76_rust + bsm_rust)
24
+ run: cargo test --release -p black76_rust -p bsm_rust
25
+
26
+ # ---------- Parity test on Linux: install package, run bench against py_vollib ----------
27
+ parity-linux:
28
+ name: Parity vs py_vollib (Linux)
29
+ runs-on: ubuntu-latest
30
+ needs: rust-test
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+ - uses: actions/setup-python@v5
34
+ with: { python-version: '3.12' }
35
+ - uses: dtolnay/rust-toolchain@stable
36
+ - uses: Swatinem/rust-cache@v2
37
+ - name: Install baselines + build & install opengreeks
38
+ run: |
39
+ pip install 'py_vollib==1.0.1' 'py_lets_be_rational==1.0.1' numpy
40
+ pip install .
41
+ - name: Run parity + bench
42
+ run: python bench/bench_parity.py
43
+
44
+ # ---------- Build abi3 wheels for all target platforms ----------
45
+ # Both Mac wheels build on Apple Silicon runners (abundant + fast). Maturin
46
+ # cross-compiles the x86_64 wheel cleanly from arm64 hosts — avoids the
47
+ # macos-13 Intel runner pool which routinely queues 15-30 min.
48
+ build-wheels:
49
+ name: Wheel ${{ matrix.target }}
50
+ needs: rust-test
51
+ strategy:
52
+ fail-fast: false
53
+ matrix:
54
+ include:
55
+ - { os: ubuntu-latest, target: x86_64-unknown-linux-gnu, manylinux: '2_28' }
56
+ - { os: ubuntu-latest, target: aarch64-unknown-linux-gnu, manylinux: '2_28' }
57
+ - { os: macos-14, target: x86_64-apple-darwin }
58
+ - { os: macos-14, target: aarch64-apple-darwin }
59
+ - { os: windows-latest, target: x86_64-pc-windows-msvc }
60
+ runs-on: ${{ matrix.os }}
61
+ steps:
62
+ - uses: actions/checkout@v4
63
+ - uses: actions/setup-python@v5
64
+ with: { python-version: '3.12' }
65
+ - name: Build wheel
66
+ uses: PyO3/maturin-action@v1
67
+ with:
68
+ target: ${{ matrix.target }}
69
+ manylinux: ${{ matrix.manylinux || 'auto' }}
70
+ args: --release --out dist --interpreter '3.12'
71
+ sccache: 'true'
72
+ - uses: actions/upload-artifact@v4
73
+ with:
74
+ name: wheels-${{ matrix.target }}
75
+ path: dist/*.whl
76
+
77
+ # ---------- Build sdist ----------
78
+ sdist:
79
+ name: Source distribution
80
+ runs-on: ubuntu-latest
81
+ needs: rust-test
82
+ steps:
83
+ - uses: actions/checkout@v4
84
+ - uses: PyO3/maturin-action@v1
85
+ with:
86
+ command: sdist
87
+ args: --out dist
88
+ - uses: actions/upload-artifact@v4
89
+ with:
90
+ name: sdist
91
+ path: dist/*.tar.gz
92
+
93
+ # ---------- Publish to PyPI on `v*` tag push via OIDC trusted publishing ----------
94
+ publish:
95
+ name: Publish to PyPI
96
+ if: startsWith(github.ref, 'refs/tags/v')
97
+ needs: [parity-linux, build-wheels, sdist]
98
+ runs-on: ubuntu-latest
99
+ environment:
100
+ name: pypi
101
+ url: https://pypi.org/p/opengreeks
102
+ permissions:
103
+ id-token: write
104
+ steps:
105
+ - uses: actions/download-artifact@v4
106
+ with:
107
+ pattern: 'wheels-*'
108
+ path: dist
109
+ merge-multiple: true
110
+ - uses: actions/download-artifact@v4
111
+ with:
112
+ name: sdist
113
+ path: dist
114
+ - name: List artifacts
115
+ run: ls -la dist/
116
+ - name: Publish to PyPI
117
+ uses: pypa/gh-action-pypi-publish@release/v1
118
+ with:
119
+ packages-dir: dist/
120
+ skip-existing: true
@@ -0,0 +1,63 @@
1
+ # ──────────────────────────────────────────────────────────────────────────
2
+ # Rust
3
+ # ──────────────────────────────────────────────────────────────────────────
4
+ target/
5
+ **/target/
6
+
7
+ # Per-crate lockfiles are ignored — the workspace root Cargo.lock is authoritative.
8
+ # (Root Cargo.lock IS committed because we ship cdylib wheels.)
9
+ /black76_rust/Cargo.lock
10
+ /bsm_rust/Cargo.lock
11
+
12
+ # ──────────────────────────────────────────────────────────────────────────
13
+ # Python / maturin
14
+ # ──────────────────────────────────────────────────────────────────────────
15
+ __pycache__/
16
+ *.py[cod]
17
+ *$py.class
18
+ *.so
19
+ *.pyd
20
+ *.egg-info/
21
+ *.egg
22
+ .eggs/
23
+
24
+ # Maturin / build artifacts
25
+ build/
26
+ dist/
27
+ wheels/
28
+ *.whl
29
+
30
+ # Virtual environments
31
+ .venv/
32
+ venv/
33
+ env/
34
+ .env
35
+
36
+ # Testing / type-checking caches
37
+ .pytest_cache/
38
+ .mypy_cache/
39
+ .ruff_cache/
40
+ .tox/
41
+ .coverage
42
+ htmlcov/
43
+
44
+ # ──────────────────────────────────────────────────────────────────────────
45
+ # OS / editor noise
46
+ # ──────────────────────────────────────────────────────────────────────────
47
+ .DS_Store
48
+ Thumbs.db
49
+ *.swp
50
+ *.swo
51
+ *~
52
+
53
+ # VS Code (keep .vscode/ if the team wants shared settings; right now we don't)
54
+ .vscode/
55
+ .VSCodeCounter/
56
+
57
+ # JetBrains
58
+ .idea/
59
+
60
+ # ──────────────────────────────────────────────────────────────────────────
61
+ # Local tooling
62
+ # ──────────────────────────────────────────────────────────────────────────
63
+ .claude/
@@ -0,0 +1,282 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 3
4
+
5
+ [[package]]
6
+ name = "autocfg"
7
+ version = "1.5.0"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
10
+
11
+ [[package]]
12
+ name = "black76_rust"
13
+ version = "0.1.0"
14
+
15
+ [[package]]
16
+ name = "bsm_rust"
17
+ version = "0.1.0"
18
+ dependencies = [
19
+ "black76_rust",
20
+ ]
21
+
22
+ [[package]]
23
+ name = "cfg-if"
24
+ version = "1.0.4"
25
+ source = "registry+https://github.com/rust-lang/crates.io-index"
26
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
27
+
28
+ [[package]]
29
+ name = "heck"
30
+ version = "0.5.0"
31
+ source = "registry+https://github.com/rust-lang/crates.io-index"
32
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
33
+
34
+ [[package]]
35
+ name = "indoc"
36
+ version = "2.0.7"
37
+ source = "registry+https://github.com/rust-lang/crates.io-index"
38
+ checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
39
+ dependencies = [
40
+ "rustversion",
41
+ ]
42
+
43
+ [[package]]
44
+ name = "libc"
45
+ version = "0.2.186"
46
+ source = "registry+https://github.com/rust-lang/crates.io-index"
47
+ checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
48
+
49
+ [[package]]
50
+ name = "matrixmultiply"
51
+ version = "0.3.10"
52
+ source = "registry+https://github.com/rust-lang/crates.io-index"
53
+ checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08"
54
+ dependencies = [
55
+ "autocfg",
56
+ "rawpointer",
57
+ ]
58
+
59
+ [[package]]
60
+ name = "memoffset"
61
+ version = "0.9.1"
62
+ source = "registry+https://github.com/rust-lang/crates.io-index"
63
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
64
+ dependencies = [
65
+ "autocfg",
66
+ ]
67
+
68
+ [[package]]
69
+ name = "ndarray"
70
+ version = "0.16.1"
71
+ source = "registry+https://github.com/rust-lang/crates.io-index"
72
+ checksum = "882ed72dce9365842bf196bdeedf5055305f11fc8c03dee7bb0194a6cad34841"
73
+ dependencies = [
74
+ "matrixmultiply",
75
+ "num-complex",
76
+ "num-integer",
77
+ "num-traits",
78
+ "portable-atomic",
79
+ "portable-atomic-util",
80
+ "rawpointer",
81
+ ]
82
+
83
+ [[package]]
84
+ name = "num-complex"
85
+ version = "0.4.6"
86
+ source = "registry+https://github.com/rust-lang/crates.io-index"
87
+ checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
88
+ dependencies = [
89
+ "num-traits",
90
+ ]
91
+
92
+ [[package]]
93
+ name = "num-integer"
94
+ version = "0.1.46"
95
+ source = "registry+https://github.com/rust-lang/crates.io-index"
96
+ checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
97
+ dependencies = [
98
+ "num-traits",
99
+ ]
100
+
101
+ [[package]]
102
+ name = "num-traits"
103
+ version = "0.2.19"
104
+ source = "registry+https://github.com/rust-lang/crates.io-index"
105
+ checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
106
+ dependencies = [
107
+ "autocfg",
108
+ ]
109
+
110
+ [[package]]
111
+ name = "numpy"
112
+ version = "0.22.1"
113
+ source = "registry+https://github.com/rust-lang/crates.io-index"
114
+ checksum = "edb929bc0da91a4d85ed6c0a84deaa53d411abfb387fc271124f91bf6b89f14e"
115
+ dependencies = [
116
+ "libc",
117
+ "ndarray",
118
+ "num-complex",
119
+ "num-integer",
120
+ "num-traits",
121
+ "pyo3",
122
+ "rustc-hash",
123
+ ]
124
+
125
+ [[package]]
126
+ name = "once_cell"
127
+ version = "1.21.4"
128
+ source = "registry+https://github.com/rust-lang/crates.io-index"
129
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
130
+
131
+ [[package]]
132
+ name = "opengreeks-py"
133
+ version = "0.1.0"
134
+ dependencies = [
135
+ "black76_rust",
136
+ "bsm_rust",
137
+ "numpy",
138
+ "pyo3",
139
+ ]
140
+
141
+ [[package]]
142
+ name = "portable-atomic"
143
+ version = "1.13.1"
144
+ source = "registry+https://github.com/rust-lang/crates.io-index"
145
+ checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
146
+
147
+ [[package]]
148
+ name = "portable-atomic-util"
149
+ version = "0.2.7"
150
+ source = "registry+https://github.com/rust-lang/crates.io-index"
151
+ checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618"
152
+ dependencies = [
153
+ "portable-atomic",
154
+ ]
155
+
156
+ [[package]]
157
+ name = "proc-macro2"
158
+ version = "1.0.106"
159
+ source = "registry+https://github.com/rust-lang/crates.io-index"
160
+ checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
161
+ dependencies = [
162
+ "unicode-ident",
163
+ ]
164
+
165
+ [[package]]
166
+ name = "pyo3"
167
+ version = "0.22.6"
168
+ source = "registry+https://github.com/rust-lang/crates.io-index"
169
+ checksum = "f402062616ab18202ae8319da13fa4279883a2b8a9d9f83f20dbade813ce1884"
170
+ dependencies = [
171
+ "cfg-if",
172
+ "indoc",
173
+ "libc",
174
+ "memoffset",
175
+ "once_cell",
176
+ "portable-atomic",
177
+ "pyo3-build-config",
178
+ "pyo3-ffi",
179
+ "pyo3-macros",
180
+ "unindent",
181
+ ]
182
+
183
+ [[package]]
184
+ name = "pyo3-build-config"
185
+ version = "0.22.6"
186
+ source = "registry+https://github.com/rust-lang/crates.io-index"
187
+ checksum = "b14b5775b5ff446dd1056212d778012cbe8a0fbffd368029fd9e25b514479c38"
188
+ dependencies = [
189
+ "once_cell",
190
+ "target-lexicon",
191
+ ]
192
+
193
+ [[package]]
194
+ name = "pyo3-ffi"
195
+ version = "0.22.6"
196
+ source = "registry+https://github.com/rust-lang/crates.io-index"
197
+ checksum = "9ab5bcf04a2cdcbb50c7d6105de943f543f9ed92af55818fd17b660390fc8636"
198
+ dependencies = [
199
+ "libc",
200
+ "pyo3-build-config",
201
+ ]
202
+
203
+ [[package]]
204
+ name = "pyo3-macros"
205
+ version = "0.22.6"
206
+ source = "registry+https://github.com/rust-lang/crates.io-index"
207
+ checksum = "0fd24d897903a9e6d80b968368a34e1525aeb719d568dba8b3d4bfa5dc67d453"
208
+ dependencies = [
209
+ "proc-macro2",
210
+ "pyo3-macros-backend",
211
+ "quote",
212
+ "syn",
213
+ ]
214
+
215
+ [[package]]
216
+ name = "pyo3-macros-backend"
217
+ version = "0.22.6"
218
+ source = "registry+https://github.com/rust-lang/crates.io-index"
219
+ checksum = "36c011a03ba1e50152b4b394b479826cad97e7a21eb52df179cd91ac411cbfbe"
220
+ dependencies = [
221
+ "heck",
222
+ "proc-macro2",
223
+ "pyo3-build-config",
224
+ "quote",
225
+ "syn",
226
+ ]
227
+
228
+ [[package]]
229
+ name = "quote"
230
+ version = "1.0.45"
231
+ source = "registry+https://github.com/rust-lang/crates.io-index"
232
+ checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
233
+ dependencies = [
234
+ "proc-macro2",
235
+ ]
236
+
237
+ [[package]]
238
+ name = "rawpointer"
239
+ version = "0.2.1"
240
+ source = "registry+https://github.com/rust-lang/crates.io-index"
241
+ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
242
+
243
+ [[package]]
244
+ name = "rustc-hash"
245
+ version = "1.1.0"
246
+ source = "registry+https://github.com/rust-lang/crates.io-index"
247
+ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
248
+
249
+ [[package]]
250
+ name = "rustversion"
251
+ version = "1.0.22"
252
+ source = "registry+https://github.com/rust-lang/crates.io-index"
253
+ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
254
+
255
+ [[package]]
256
+ name = "syn"
257
+ version = "2.0.117"
258
+ source = "registry+https://github.com/rust-lang/crates.io-index"
259
+ checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
260
+ dependencies = [
261
+ "proc-macro2",
262
+ "quote",
263
+ "unicode-ident",
264
+ ]
265
+
266
+ [[package]]
267
+ name = "target-lexicon"
268
+ version = "0.12.16"
269
+ source = "registry+https://github.com/rust-lang/crates.io-index"
270
+ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
271
+
272
+ [[package]]
273
+ name = "unicode-ident"
274
+ version = "1.0.24"
275
+ source = "registry+https://github.com/rust-lang/crates.io-index"
276
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
277
+
278
+ [[package]]
279
+ name = "unindent"
280
+ version = "0.2.4"
281
+ source = "registry+https://github.com/rust-lang/crates.io-index"
282
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
@@ -0,0 +1,30 @@
1
+ [workspace]
2
+ resolver = "2"
3
+ members = ["black76_rust", "bsm_rust"]
4
+ # Future pure-Rust pricing model crates slot in here:
5
+ # "heston_rust", "sabr_rust", ...
6
+
7
+ [package]
8
+ name = "opengreeks-py"
9
+ version = "0.1.0"
10
+ edition = "2021"
11
+ rust-version = "1.75"
12
+ description = "PyO3 bindings — Rust option pricing models exposed as the `opengreeks` Python package"
13
+ license = "MIT"
14
+ publish = false
15
+ readme = "README.md"
16
+
17
+ [lib]
18
+ name = "_opengreeks"
19
+ crate-type = ["cdylib"]
20
+
21
+ [dependencies]
22
+ black76_rust = { path = "black76_rust" }
23
+ bsm_rust = { path = "bsm_rust" }
24
+ pyo3 = { version = "0.22", features = ["extension-module", "abi3-py39"] }
25
+ numpy = "0.22"
26
+
27
+ [profile.release]
28
+ lto = "fat"
29
+ codegen-units = 1
30
+ opt-level = 3
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Marketcalls / Rajandran R
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.