Skip to main content

finmc is a Python library for Monte Carlo Simulation.

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

finmc-0.0.8.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

finmc-0.0.8-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file finmc-0.0.8.tar.gz.

File metadata

  • Download URL: finmc-0.0.8.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for finmc-0.0.8.tar.gz
Algorithm Hash digest
SHA256 7c9ef316cde43e9cd31ee769807a89530e169e80ee1d6788fee2f6b5e94c4c36
MD5 a586da633275d67c23fe10eac9dcedc5
BLAKE2b-256 6f7efe38c71a36e0bc35946595aad0b45cc4868c16c12d50e019159473c84353

See more details on using hashes here.

File details

Details for the file finmc-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: finmc-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for finmc-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 3b0ba48504cd1fc4b4c15074960a2b95dafe8cec3eb8a2eb54955d897557ce57
MD5 2583bb761454e82916ba3ce4f7ca1025
BLAKE2b-256 a1a4a112cab1c60a9ff074e80dbe538653a3353f524f4a0533b1c197e7db7ee3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page