FinancialToolbox.jl

Useful functions for Black–Scholes Model in the Julia Language
Popularity
46 Stars
Updated Last
3 Months Ago
Started In
July 2017

FinancialToolbox

status CI codecov

This is a Julia package containing some useful Financial functions for Pricing and Risk Management under the Black and Scholes Model.
The syntax is the same of the Matlab Financial Toolbox.

It currently contains the following functions:

  • blsprice : Black & Scholes Price for European Options.
  • blsbin : Black & Scholes Price for Binary European Options.
  • blkprice : Black Price for European Options.
  • blsdelta : Black & Scholes Delta sensitivity for European Options.
  • blsgamma : Black & Scholes Gamma sensitivity for European Options.
  • blstheta : Black & Scholes Theta sensitivity for European Options.
  • blsvega : Black & Scholes Vega sensitivity for European Options.
  • blsrho : Black & Scholes Rho sensitivity for European Options.
  • blslambda: Black & Scholes Lambda sensitivity for European Options.
  • blspsi : Black & Scholes Psi sensitivity for European Options.
  • blsvanna : Black & Scholes Vanna sensitivity for European Options.
  • blsimpv : Black & Scholes Implied Volatility for European Options.
  • blkimpv : Black Implied Volatility for European Options.

Currently supports classical numerical input and other less common like:

It also contains some functions that could be useful for the Dates Management:

  • yearfrac : fraction of years between two Dates (currently only the first seven convention of Matlab are supported).
  • daysact : number of days between two Dates.

The module is standalone.

How to Install

To install the package simply type on the Julia REPL the following:

Pkg.add("FinancialToolbox")

How to Test

After the installation, to test the package type on the Julia REPL the following:

Pkg.test("FinancialToolbox")

Example of Usage

The following example is the pricing of a European Call Option with underlying varying according to the Black Scholes Model, given the implied volatility. After that it is possible to check the result computing the inverse of the Black Scholes formula.

#Import the Package
using FinancialToolbox

#Define input data
spot=10;K=10;r=0.02;T=2.0=0.2;d=0.01;

#Call the function
Price=blsprice(spot,K,r,T,σ,d)
#Price=1.1912013169995816

#Check the Result
Volatility=blsimpv(spot,K,r,T,Price,d)
#Volatility=0.20000000000000002

Used By Packages

No packages found.