Julia Package for Financial Monte Carlo Simulations
Author rcalxrc08
6 Stars
Updated Last
1 Year Ago
Started In
August 2019


Build Statuspipeline status coverage report

This is a Julia package containing some useful Financial function for Pricing and Risk Management for Equity products.

It currently contains the following capabilities:

  • Support for the following Single Name Models:
    • Black Scholes
    • Kou
    • Merton
    • Normal Inverse Gaussian
    • Variance Gamma
    • Heston
    • LogNormal Mixture
  • Support for Multivariate processes through Gaussian Copula
  • Support for non costant zero rates and dividends
  • Support for the following Option families:
    • European Options
    • Barrier Options
    • Asian Options
    • Bermudan Options (Using Longstaff-Schwartz)
    • American Options (Using Longstaff-Schwartz)
  • Partial Support for the following Parallelization:

It also supports the pricing directly from the definition of the Stochastic Differential Equation, using the package DifferentiatialEquations.jl.

Currently supports DualNumbers.jl, ForwardDiff.jl and ReverseDiff.jl for Automatic Differentiation (where it makes sense).

How to Install

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

] add

How to Test

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

] test FinancialMonteCarlo

Hello World: Pricing European Call Option in Black Scholes Model

The following example shows how to price a european call option with underlying varying according to the Black Scholes Model, given the volatility:

#Import the Package
using FinancialMonteCarlo;

#Define Spot Datas
#Define FinancialMonteCarlo Parameters
#Define Model Parameters
#Build the Structs
mcConfig=MonteCarloConfiguration(Nsim,Nstep); #Configurator
underlying=Underlying(S0,d); #Underlying relative data

#Define The Option
#Define the Model

@show EuPrice=pricer(Model,zeroRate,mcConfig,EU_payoff);

Curve Support

Non constant zero rates and dividend are managed. An implied curve is built at time zero, such implied curve is able to return the right implied zero/dividend at a given time, Without the need to carry the integral structure of the curve. No support for multicurrency.

Contracts Algebra

Contracts that refer to the same underlying can be sum togheter in order to build a "new instrument". In this sense assuming the same underlying, the set of contracts form a vectorial space over "Real" Numbers.

Market Data and Multivariate Support

A market data set is a dictionary containing all of the process for which we have a view (or a model). ( "KEY" => MODEL) The portofolio is a dictionary as well but it carries the structure of the portfolio. ( "KEY" => CONTRACTS_ON_MODEL)

Keep in mind

There are few things that you should keep in mind when using this library:

  • First Order Automatic Differentiation is enabled for any kind of option, also for such that there is no sense (e.g. Binary, Barriers).
  • Second Order Automatic Differentiation is enabled for any kind of option but the results are useless most of the time.