Option Functionality - OrangeCardinal/FINpy GitHub Wiki

This module holds all functions related to option pricing, and calculating the option greeks.

Initial Setup

from finpy.options.greeks import price_european_call

Price a European call (via Black-Scholes-Merton)

asset_price = 100
strike      = 90
risk_free_interest = .05
dividend_rate = 2.0
sigma = .4
option_price = price_european_call(asset_price, strike,risk_free_interest, dividend_rate,sigma)
example  = "Stock Price   : {0}\n".format(asset_price)
example += "Strike        : {0}\n".format(strike)
example += "Interest      : {0}\n".format(risk_free_interest)
example += "Dividend Rate : {0}\n".format(dividend_rate)
example += "Sigma         : {0}\n".format(sigma)
example += "Option Price = {0}".format(option_price)

print(example)

Price a European call (via Monte Carlo Simulation)

asset_price = 100
strike      = 90
risk_free_interest = .05
dividend_rate = 2.0
sigma = .4
num_trials = 500
option_price, std_dev = price_european_call_monte_carlo(asset_price, strike,risk_free_interest, dividend_rate,sigma, num_trials)

example  = "Stock Price   : {0}\n".format(asset_price)
example += "Strike        : {0}\n".format(strike)
example += "Interest      : {0}\n".format(risk_free_interest)
example += "Dividend Rate : {0}\n".format(dividend_rate)
example += "Sigma         : {0}\n".format(sigma)
example += "Option Price   = {0}".format(option_price)
example += "Option Std Dev = {0}".format(std_dev)

print(example)