finoptions
Python implementation of the R package fOptions for use in energy trading. Changes include coverting the package to OOP as well as Finite Difference Methods for Option greeks for all Options.
Supported by Rpanda Training Solutions
To install package run:
pip install finoptions
Working with finoptions
Vanilla Options are found at the root of the package. For example, to run a Generalized Black Scholes Option:
import finoptions as fo
opt = fo.GBSOption(10.0, 8.0, 1.0, 0.02, 0.01, 0.1)
opt.call() # to get call price
opt.put() # to get put price
opt.summary() # for a printed summary of the option
opt.greeks() # to get the greeks for the option
# to calculate implied volatility, omit the sigma argument and then
# call the volatility method
opt = fo.GBSOption(10.0, 8.0, 1.0, 0.02, 0.01)
opt.volatility(2)
All options follow the same format for calls, puts, greeks and summaries. GBSOption uses the analytic solution to calculate to the greeks, but for all other options the finite difference method is used.
Calculating Options for Multiple Inputs
The vanilla options are capable of calculating calls, puts, vols and greeks for multiple inputs at the same time by passing numpy arrays of values as parameters. Currently this only works for the vanilla options.
import finoptions as fo
import numpy as np
opt = fo.GBSOption(10.0, np.arange(5,15), 1.0, 0.02, 0.01, 0.1)
opt.call() # to get call price
opt.put() # to get put price
opt.summary() # for a printed summary of the option
opt.greeks() # to get the greeks for the option
Notebooks
To see example notebooks, please see github repo found here:
Release files for finoptions 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| finoptions-0.1.5.tar.gz | 32.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| finoptions-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:77.0 kB
Release files / finoptions-0.1.5.tar.gz
| Download URL | finoptions-0.1.5.tar.gz |
|---|---|
| Size | 32.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
459afa71516907c02d15cfb4333e133a54aa0c8105ebfccf549659ea5cce007a
|
|
BLAKE2b-256 checksum How to use checksums |
2b66a7094c8a589b35f8f247bfc2ce65064ff7611bd7e1d331ccd00de82083f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
|
Release files / finoptions-0.1.5-py3-none-any.whl
| Download URL | finoptions-0.1.5-py3-none-any.whl |
|---|---|
| Size | 44.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4cdb855c58b25c788d504f7819dfff7e11b958e433d06c6d3c7b806b90ab17f5
|
|
BLAKE2b-256 checksum How to use checksums |
b9d7d9035c899f08582993cb0c6d6e0d82e3c4e505ba0b5b8fa18e63fe78b5c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
|