Giter VIP home page Giter VIP logo

finoptions-dev's Introduction

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

Implemented Methods

Vanilla Options

  • Black-Scholes-Merton Option
  • Black 1976 Option
  • Miltersen Schwartz Option

American Options

  • Roll-Geske-Whaley Calls on Dividend Paying Stocks
  • Barone-Adesi and Whaley Approximation
  • The Bjerksund and Stensland (1993) American Approximation Option

Garch Options

  • The Heston-Nandi Garch Option Model

Tree Options

  • Cox, Ross and Rubinstein (1979) Binomial Tree Model
  • Jarrow and Rudd (1983) Binomial Tree Model
  • Tian (1993) Binomial Tree Model
  • Trinomial Tree Model

Spread Options

  • Rubinstein Binomial Tree Generic Spread Option Model

Bionomial Tree Spread Options

  • Maximum Spread Option Model
  • Minimum Spread Option Model
  • Spread Option Model
  • Dual-strike Option
  • Reverse dual-strike option
  • Portfolio options
  • Options to exchange one asset for another
  • Relative performance options
  • Product options

Monte Carlo Options

  • Monte Carlo simulation framework (see example)

Notebooks

To see example notebooks, please see github repo found here:

https://github.com/bbcho/finoptions-dev/tree/main/notebooks

finoptions-dev's People

Contributors

bbcho avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.