A Python package for calculating option Greeks and implied volatility.
Project description
volg
A Python package for calculating option Greeks and implied volatility.
Installation
pip install volg
Features
- Calculate implied volatility (IV) using binary search method
- Compute option Greeks (Delta, Gamma, Vega, Theta, etc.)
- Calculate exposures (Delta exposure, Gamma exposure, etc.)
- Support for both call and put options
Usage
import volg
# Calculate implied volatility
iv = volg.greek.iv(spot_price, strike_price, interest_rate, days_to_expiry, option_price, flag='C')
# Calculate Greeks
greeks = volg.greek.greeks(spot_price, strike_price, interest_rate, days_to_expiry, option_price, flag='C')
# Process a dataframe with option data
df = volg.greek.compute_greeks_vectorized(df)
df = volg.greek.compute_exposure(df)
Alternative import style:
from volg import greek
# Calculate implied volatility
iv = greek.iv(spot_price, strike_price, interest_rate, days_to_expiry, option_price, flag='C')
# Calculate implied volatility using vectorized method on df columns
df['iv'] = greek.iv_vectorized(df['sfut_price'], df['strike_price'], 0, df['dte'], df['close_ce'], flag='C')
# Calculate Greeks
greeks = greek.greeks(spot_price, strike_price, interest_rate, days_to_expiry, option_price, flag='C')
#Option to calculate greeks in vectorized on dataframe
column_mapping = {
"sfut_price": "future_price",
"strike_price": "strike_price",
"dte": "dte",
"count": "count",
"ce_ltp": "close_ce",
"pe_ltp": "close_pe"
}
greek_df = greek.compute_greeks_vectorized(df, columns=column_mapping)
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
volg-0.1.6.tar.gz
(5.2 kB
view details)
Built Distribution
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
volg-0.1.6-py3-none-any.whl
(6.6 kB
view details)
File details
Details for the file volg-0.1.6.tar.gz.
File metadata
- Download URL: volg-0.1.6.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efa9872217577316c5efbf8e39c3386c33cfaf840adb9d3c8fb1412f75bfa0a1
|
|
| MD5 |
a02428538e06df7f696d1a7b4556e6cc
|
|
| BLAKE2b-256 |
772a69d97b161f2b08427d2c798bcf5573069c2b9fc7240e9fe87bb944741acc
|
File details
Details for the file volg-0.1.6-py3-none-any.whl.
File metadata
- Download URL: volg-0.1.6-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8177a49761385b1d0d2e0744c618ffd35900d80e1c2a98ea95dd6e23ef9c8ffc
|
|
| MD5 |
08b8b4d776c49ed78e276360bcff6f80
|
|
| BLAKE2b-256 |
3928d201884167fab059f47fcef8607b7673bcd966578b786b11bd9862367120
|