# OptionGreeksGPU
OptionGreeksGPU is a high-performance, GPU-accelerated library designed to calculate option Greeks for a large number of contracts quickly and efficiently. By leveraging the power of modern GPU architectures, OptionGreeksGPU can compute Greeks for 1648 option contracts in just 0.20 seconds (after warmup), offering a significant performance improvement over traditional CPU-based methods.
Features
• Fast Computation: Utilizes GPU acceleration to dramatically reduce computation times for option Greeks.
• Easy Integration: Designed to easily integrate with existing Python financial analysis workflows.
• Comprehensive: Supports a wide range of Greeks calculations, including Delta, Gamma, Theta, Vega, and Rho.
# Installation
Before installing OptionGreeksGPU, ensure you have a CUDA-compatible GPU and the appropriate CUDA Toolkit installed on your system.
To install OptionGreeksGPU, run the following command:
pip install OptionGreeksGPU
# Usage
Here’s a quick example of how to use OptionGreeksGPU (see test.py for exact operation) to compute Greeks for option contracts:
from OptionGreeksGPU.GreeksGPU import calculate_option_metrics
import pandas as pd
### Load your option contracts data (shared in test directory)
df = pd.read_csv('OpGreeksTestInput.csv', parse_dates=['expiry', 'DT'])
### Prepare the data
optionData = df[['strike', 'last_price_Und', 'last_price_CE', 'GreekRef_CE', 'last_price_PE', 'GreekRef_PE']].to_numpy()
interestRate = 5
daysToExpiration = 30 # Example: 30 days to expiration
### Calculate the Greeks
Data = calculate_option_metrics(option_data=optionData, days_to_expiry=daysToExpiration, interest_rate=interestRate)
### Convert the result to a DataFrame
Result_DF = pd.DataFrame(np.column_stack(Data), columns=['call_IVs', 'call_deltas', 'call_delta2s', 'call_vegas', 'call_gammas', 'call_thetas', 'call_rhos', 'put_IVs', 'put_deltas', 'put_delta2s', 'put_vegas', 'put_gammas', 'put_thetas', 'put_rhos'])
### Save or use the results
Result_DF.to_csv('OpGreeksTestOutput.csv')
# Performance
• CPU (multiprocessing): ~8 minutes for 1648 option contracts. (using mibian library in multiprocessing 12 cores)
• GPU (OptionGreeksGPU): 0.20 seconds for 1648 option contracts (after warmup).
# Contributing
Contributions are welcome! If you’d like to contribute, please fork the repository, create a feature branch, and submit a pull request.
# License
OptionGreeksGPU is licensed under the GNU General Public License v3.0. See the LICENSE file for more details.
# Support
If you encounter any problems or have any suggestions, please open an issue on the project’s GitHub page.
Raw data
{
"_id": null,
"home_page": "https://github.com/SalilBhasinOfficial/OptionGreeksGPU.git",
"name": "OptionGreeksGPU",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "options greeks computation gpu acceleration finance options trading quantitative finance risk management financial engineering option pricing CUDA GPU computing high performance computing derivatives trading volatility hedging strategies investment analysis trading algorithms financial markets black-scholes algorithmic trading portfolio optimization market analysis",
"author": "Salil Bhasin",
"author_email": "salilbhasinofficial@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/66/07/fc95fe23d936db9e64797fd115cd1dee4fbb7aef72eb3242e24a494493be/OptionGreeksGPU-1.0.0.tar.gz",
"platform": null,
"description": "# OptionGreeksGPU\n\nOptionGreeksGPU is a high-performance, GPU-accelerated library designed to calculate option Greeks for a large number of contracts quickly and efficiently. By leveraging the power of modern GPU architectures, OptionGreeksGPU can compute Greeks for 1648 option contracts in just 0.20 seconds (after warmup), offering a significant performance improvement over traditional CPU-based methods.\n\nFeatures\n\n\t\u2022\tFast Computation: Utilizes GPU acceleration to dramatically reduce computation times for option Greeks.\n\t\u2022\tEasy Integration: Designed to easily integrate with existing Python financial analysis workflows.\n\t\u2022\tComprehensive: Supports a wide range of Greeks calculations, including Delta, Gamma, Theta, Vega, and Rho.\n\n# Installation\n\nBefore installing OptionGreeksGPU, ensure you have a CUDA-compatible GPU and the appropriate CUDA Toolkit installed on your system.\n\nTo install OptionGreeksGPU, run the following command:\n\npip install OptionGreeksGPU\n\n# Usage\n\nHere\u2019s a quick example of how to use OptionGreeksGPU (see test.py for exact operation) to compute Greeks for option contracts:\n\nfrom OptionGreeksGPU.GreeksGPU import calculate_option_metrics\nimport pandas as pd\n\n### Load your option contracts data (shared in test directory)\ndf = pd.read_csv('OpGreeksTestInput.csv', parse_dates=['expiry', 'DT'])\n\n### Prepare the data\noptionData = df[['strike', 'last_price_Und', 'last_price_CE', 'GreekRef_CE', 'last_price_PE', 'GreekRef_PE']].to_numpy()\ninterestRate = 5\ndaysToExpiration = 30 # Example: 30 days to expiration\n\n### Calculate the Greeks\nData = calculate_option_metrics(option_data=optionData, days_to_expiry=daysToExpiration, interest_rate=interestRate)\n\n### Convert the result to a DataFrame\nResult_DF = pd.DataFrame(np.column_stack(Data), columns=['call_IVs', 'call_deltas', 'call_delta2s', 'call_vegas', 'call_gammas', 'call_thetas', 'call_rhos', 'put_IVs', 'put_deltas', 'put_delta2s', 'put_vegas', 'put_gammas', 'put_thetas', 'put_rhos'])\n\n### Save or use the results\nResult_DF.to_csv('OpGreeksTestOutput.csv')\n\n# Performance\n\n\t\u2022\tCPU (multiprocessing): ~8 minutes for 1648 option contracts. (using mibian library in multiprocessing 12 cores)\n\t\u2022\tGPU (OptionGreeksGPU): 0.20 seconds for 1648 option contracts (after warmup).\n\n# Contributing\n\nContributions are welcome! If you\u2019d like to contribute, please fork the repository, create a feature branch, and submit a pull request.\n\n# License\n\nOptionGreeksGPU is licensed under the GNU General Public License v3.0. See the LICENSE file for more details.\n\n# Support\n\nIf you encounter any problems or have any suggestions, please open an issue on the project\u2019s GitHub page.\n",
"bugtrack_url": null,
"license": "",
"summary": "GPU-accelerated computation of option Greeks",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/SalilBhasinOfficial/OptionGreeksGPU.git"
},
"split_keywords": [
"options",
"greeks",
"computation",
"gpu",
"acceleration",
"finance",
"options",
"trading",
"quantitative",
"finance",
"risk",
"management",
"financial",
"engineering",
"option",
"pricing",
"cuda",
"gpu",
"computing",
"high",
"performance",
"computing",
"derivatives",
"trading",
"volatility",
"hedging",
"strategies",
"investment",
"analysis",
"trading",
"algorithms",
"financial",
"markets",
"black-scholes",
"algorithmic",
"trading",
"portfolio",
"optimization",
"market",
"analysis"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b9aa238c0bee8d28a15124c451a4c15c0bc14a2704305aaf9d8bf9d4d5906179",
"md5": "5636f7d1b7bc9335a0a56b22c7eeaf59",
"sha256": "5e4cc43368bc7b53003be5b932a8cab6dfeee705c434d52c049ad1b44f1292cc"
},
"downloads": -1,
"filename": "OptionGreeksGPU-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5636f7d1b7bc9335a0a56b22c7eeaf59",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 17116,
"upload_time": "2024-02-29T03:57:26",
"upload_time_iso_8601": "2024-02-29T03:57:26.875649Z",
"url": "https://files.pythonhosted.org/packages/b9/aa/238c0bee8d28a15124c451a4c15c0bc14a2704305aaf9d8bf9d4d5906179/OptionGreeksGPU-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6607fc95fe23d936db9e64797fd115cd1dee4fbb7aef72eb3242e24a494493be",
"md5": "8673932fa0f91c9189494fe14f589cc9",
"sha256": "2f69b7333b33439e137cb41fae90e151a371adbba0c811bc785102c9905d8a99"
},
"downloads": -1,
"filename": "OptionGreeksGPU-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "8673932fa0f91c9189494fe14f589cc9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 16946,
"upload_time": "2024-02-29T03:57:29",
"upload_time_iso_8601": "2024-02-29T03:57:29.657676Z",
"url": "https://files.pythonhosted.org/packages/66/07/fc95fe23d936db9e64797fd115cd1dee4fbb7aef72eb3242e24a494493be/OptionGreeksGPU-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-29 03:57:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SalilBhasinOfficial",
"github_project": "OptionGreeksGPU",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "optiongreeksgpu"
}