Skip to content

finlib/finmc

Repository files navigation

finmc

CI

This package contains Monte-Carlo implementations of many financial models derived from a common interface class. This interface allows for

  • Shared utilities that can be used for all models for tasks such as calculating implied vol surface.
  • Price Calculators that are model invariant.
  • High performance, even with a large number of paths.
  • New models can be created outside this repositary, by indepedent contributors, and yet be compatible with above utilities and calculators.

Documentation

Notebooks

forward collar
Hull-White with a term structure of rates. Paths of Variance in Heston Model.

All Notebooks

Install it from PyPI

pip install finmc

Example

This is an example of pricing a vanilla option using the local volatility model.

import numpy as np
from finmc.models.localvol import LVMC
from finmc.calc.option import opt_price_mc

# Define Dataset with zero rate curve, and forward curve.
dataset = {
    "MC": {"PATHS": 100_000, "TIMESTEP": 1 / 250},
    "BASE": "USD",
    "ASSETS": {
        "USD":("ZERO_RATES", np.array([[2.0, 0.05]])),
        "SPX": ("FORWARD", np.array([[0.0, 5500], [1.0, 5600]])),
        },
    "LV": {"ASSET": "SPX", "VOL": 0.3},
}

model = LVMC(dataset)
price = opt_price_mc(5500.0, 1.0, "Call", "SPX", model)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors