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.5.tar.gz
(5.0 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.5-py3-none-any.whl
(6.4 kB
view details)
File details
Details for the file volg-0.1.5.tar.gz.
File metadata
- Download URL: volg-0.1.5.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a88879270470b0b640e581a287b8e6d408cc914971fa3af0fe36b98f8d7c8d8e
|
|
| MD5 |
fc18653436baa21ecc3cb07e267bf237
|
|
| BLAKE2b-256 |
1f40ed4b4f9e6c837eee6f537e43f2239aa1880693b13e3f118d1be8cb719293
|
File details
Details for the file volg-0.1.5-py3-none-any.whl.
File metadata
- Download URL: volg-0.1.5-py3-none-any.whl
- Upload date:
- Size: 6.4 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 |
c6811e73a853dad5282bcb766ca8c59b10a5412ab64ac1c46f28681680d46e95
|
|
| MD5 |
eec9031b99c49c692589387a66ff8d9e
|
|
| BLAKE2b-256 |
d98f01940d55072c6f182a402365fc54bce23cc4f464c966f77865dca0a9fcee
|