High-performance Black-Scholes options pricing and Greeks calculation plugin for Polars
Project description
polars-greeks
High-performance Black-Scholes options pricing and Greeks calculation plugin for Polars.
Built with Rust for maximum performance, providing both DataFrame batch processing and scalar calculation interfaces.
Features
- 🚀 High Performance: Rust implementation with zero-copy data processing
- 📊 Dual API: DataFrame batch processing + scalar direct calculation
- 🎯 Complete Greeks: Delta, Gamma, Theta, Vega, Rho, Vanna, Volga, Charm, Speed, Zomma
- 💾 Memory Efficient: Pre-allocated vectors, avoid unnecessary computations
- ✅ Well Tested: Comprehensive test suite with mathematical accuracy validation
Quick Start
Installation
pip install polars-greeks
DataFrame Batch Processing
import polars as pl
import polars_greeks as greeks
df = pl.DataFrame({
"spot": [100.0, 105.0, 95.0],
"strike": [100.0, 100.0, 100.0],
"time_to_expiry": [0.25, 0.25, 0.25],
"volatility": [0.2, 0.2, 0.2],
"is_call": [True, False, True]
})
result = df.select(
greeks.df(
pl.col("spot"),
strike=pl.col("strike"),
time_to_expiry=pl.col("time_to_expiry"),
volatility=pl.col("volatility"),
r=pl.lit(0.05),
q=pl.lit(0.0),
is_call=pl.col("is_call"),
greeks=["delta", "vega", "gamma", "theta"]
).alias("greeks_result")
).select(
pl.col("greeks_result").struct.field("delta").alias("delta"),
pl.col("greeks_result").struct.field("vega").alias("vega"),
pl.col("greeks_result").struct.field("gamma").alias("gamma"),
pl.col("greeks_result").struct.field("theta").alias("theta")
)
Scalar Direct Calculation
import polars_greeks as greeks
result = greeks.scalar(
spot=100.0,
strike=100.0,
time_to_expiry=0.25,
volatility=0.2,
r=0.05,
q=0.0,
is_call=True,
greeks=["delta", "vega", "gamma"]
)
print(result)
# {'delta': 0.56, 'vega': 19.8, 'gamma': 0.019}
Supported Greeks
- delta: Price sensitivity to underlying asset price changes
- gamma: Delta sensitivity to underlying asset price changes
- theta: Price sensitivity to time decay
- vega: Price sensitivity to volatility changes
- rho: Price sensitivity to interest rate changes
- vanna: Delta sensitivity to volatility changes
- volga: Vega sensitivity to volatility changes
- charm: Delta sensitivity to time decay
- speed: Gamma sensitivity to underlying asset price changes
- zomma: Gamma sensitivity to volatility changes
Performance
- Zero-copy processing: Direct operations on Polars Series
- Batch optimization: Single pass calculation of multiple Greeks
- Selective computation: Only calculate requested Greeks
- Memory efficient: Pre-allocated vectors, no unnecessary allocations
Typical performance: 100K+ calculations per second for multiple Greeks.
Requirements
- Python ≥ 3.8
- Polars ≥ 0.20.0
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polars_greeks-0.1.1.tar.gz.
File metadata
- Download URL: polars_greeks-0.1.1.tar.gz
- Upload date:
- Size: 40.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c0a2aae77c9565c41f5b5b61099a2dd00f5266ce82fa26e15c11613180ed9ca
|
|
| MD5 |
656a0c52c7afaf1dd154412bf8286c83
|
|
| BLAKE2b-256 |
f5fe377a8f56395312bbca9bbfc75ee467148d26e596aab601bdbf8a5a211af0
|
File details
Details for the file polars_greeks-0.1.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: polars_greeks-0.1.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9a4bae3597352ed6b5c60e376785ea868321411440823eebeec935a972fe9cb
|
|
| MD5 |
a128376b7b2fa65cd2adada32207a96f
|
|
| BLAKE2b-256 |
a38a7d5102797ccb06105b7999952a2b436a245e62e3e58e56b78f97abc04f3a
|
File details
Details for the file polars_greeks-0.1.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: polars_greeks-0.1.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cb0d0c94ec12892ed7ce42f17fa44f1e1ce7b0944be483625f805e7edb566fc
|
|
| MD5 |
e10fe62c212bb9c020b03b44c31fd85a
|
|
| BLAKE2b-256 |
caf0848770072114747c679b56be8d0febdbe273c011a9c04f5ed41bc0134d91
|
File details
Details for the file polars_greeks-0.1.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.14, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd2abbc9b5db44c65c03205c090fc87cab4b6a2700a38b67808c598aeb821c8a
|
|
| MD5 |
a52a22273dfa6275c5bbe6fd8d5d3d96
|
|
| BLAKE2b-256 |
59a9eba5b2bcae215f9d79e1bfc7a094380d1b481987ba07be288d4d68d0581f
|
File details
Details for the file polars_greeks-0.1.1-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d5f6fc6a1526c75c2e6006418e91124b5d23f394c36cfcc44adb16910485bd7
|
|
| MD5 |
957a24531ff56235dfae6a8667c2f996
|
|
| BLAKE2b-256 |
a3555affcf8961eed53a5928678916940593e90a02ddf3f9fb8ef248d38aa5be
|
File details
Details for the file polars_greeks-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d61b6066d4ac90c18bfe8eade6257428a7f10873c06a83608d801be5306be34b
|
|
| MD5 |
cde8cb41abab144776ba1ddcd8a7e615
|
|
| BLAKE2b-256 |
74bd314e39585c3e9c53917ee68467f19302bc2d24aab3a00ede7bf8f4e8889c
|
File details
Details for the file polars_greeks-0.1.1-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 9.2 MB
- Tags: CPython 3.13, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bed80210d6fcfedc185e1f97d1b4049524f3c89f0440c8a4c55315ee3fd54c8a
|
|
| MD5 |
bd10c51c4057ae193844a3336e7d254a
|
|
| BLAKE2b-256 |
73da168c9b6646ecf8d37e0a9b74f5cf4c50f0c3f5c58903f8d5e0493e6081cd
|
File details
Details for the file polars_greeks-0.1.1-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c2e6df36e55b193128d18b918a8b2a16addbb37cc69795481c165d09ab2a9ba
|
|
| MD5 |
5175051925526ac4b48aa30d9deb55ab
|
|
| BLAKE2b-256 |
03795200bdabe44960c8fe4e5660e464ae13e97668edb86a32a98acc62ba6fcc
|
File details
Details for the file polars_greeks-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8be7ec1a84e3c5afa4cb7f273c31900b9356d0d813555738c19ee831394e7399
|
|
| MD5 |
e910fd06ea762e21afa8ec135ece79c3
|
|
| BLAKE2b-256 |
a0be83f37a1edb798cc5c26211cd0e12e9497b46505202bd891628ec79551f1e
|
File details
Details for the file polars_greeks-0.1.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 9.2 MB
- Tags: CPython 3.12, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1ba91f73b353987c9ad35f8516dc76ccde938af4a19bf1d44d3bf043c9821cc
|
|
| MD5 |
d9df38007b95f665e654cec16e37fb8a
|
|
| BLAKE2b-256 |
391dd4c678bfa27b1b39e3137e805eae810fa7cf4a7e429fa2a0431e8e226bda
|
File details
Details for the file polars_greeks-0.1.1-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45c8e63dffaacb0dad23bfc3649855e226532fddbfe3b30c108b30530aae392d
|
|
| MD5 |
a8746765309f6635ece09977c02ee585
|
|
| BLAKE2b-256 |
1968ece78654d0f3119668dbc3445605697d10e9a01c7505a6bd71c00f570a3f
|
File details
Details for the file polars_greeks-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22d106942a604968ca5fb8f20e86d5490cf0d4e6702f9bff69c1bb4515081fb8
|
|
| MD5 |
81b223cbf118dbc872740b3aefd986bf
|
|
| BLAKE2b-256 |
e1fea4812f3e5b8dae285ba516731168186b5db5f1f83561b0989e3b8f7faf12
|
File details
Details for the file polars_greeks-0.1.1-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 9.2 MB
- Tags: CPython 3.11, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34ea6de4d3b075575a320e6d246ba91aa65bffdd2d7a07a64d80d22841e56240
|
|
| MD5 |
c01c03f35c6338e51d47b561e06ae1c1
|
|
| BLAKE2b-256 |
90f29fcae6ca546452fe8825ad39123e91e8f6deefdeaee6f1c70e37fa4db87b
|
File details
Details for the file polars_greeks-0.1.1-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a501f4dedf64fb55d1521b59fc0b545484b947ca9ffcab821f24e0c6deaf15ef
|
|
| MD5 |
371f8071823eefea7474db41d095d5dd
|
|
| BLAKE2b-256 |
dd745a6bb0e0c9733d2ad3c575f6f041ac99e82f631911e1142123f69b49a5bb
|
File details
Details for the file polars_greeks-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4196ef9da7ef8e9faa8ab23abd9719828920bacd1363d0b9f36c166c8a906da8
|
|
| MD5 |
22269b8afbdc198d23950d8f6d4e9616
|
|
| BLAKE2b-256 |
c12ec3ac8dc5cd3cb8178c71f4ba1f37a943a0ba0c9d02ddd954d819261eeef2
|
File details
Details for the file polars_greeks-0.1.1-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66f1cc77d106184e06506b1cc3e421aedfa42ce9c32945e023632acab6f6dc28
|
|
| MD5 |
2672e6cf0ffd418fc5885dfc6b7f4f2c
|
|
| BLAKE2b-256 |
70e8ea2241d9a9ec1d11669dfc9c0cea24ff2e8a05ca0850de0625be0a11b2df
|
File details
Details for the file polars_greeks-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5e54151aad55265a5c6abfff24e9aff7eda325db31851a661db0d3c6271255a
|
|
| MD5 |
76c8d996ee6237770eaf544e429a0d02
|
|
| BLAKE2b-256 |
7b727e20797caca0b191c828013895357def8d546108902c238d13637fafed36
|
File details
Details for the file polars_greeks-0.1.1-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 9.2 MB
- Tags: CPython 3.9, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7716cba7b390644a615b33f105a07998c931b92064a15f28aa37f1fb5855f17
|
|
| MD5 |
aad9815be3f1b50b1dcb9e4dfd7654b4
|
|
| BLAKE2b-256 |
20f6c80873eb197ca18158fdb81362461b59f7bbdd0b33403559c9f07191c420
|
File details
Details for the file polars_greeks-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: polars_greeks-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.9 MB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb1522ffe193aa4668b24db062676328f11de5ee100b778fda3642487f374490
|
|
| MD5 |
937f806c1ec8c86627c080a235966c15
|
|
| BLAKE2b-256 |
7a30c643d5443a042f21bf7be2f74ac9132fb61d5f0cf30428aaf89f17f04aff
|