rcalxrc08 / FinancialToolbox.jl

Useful functions for Black–Scholes Model in the Julia Language
Other
47 stars 11 forks source link
black-scholes european-options julia pricing pricing-derivatives quantitative-finance risk-management

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:

Currently supports classical numerical input and other less common like:

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

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