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.
  • The interace is designed for 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.

See complete documentation here.

forward collar

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.7.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

finmc-0.0.7-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: finmc-0.0.7.tar.gz
  • Upload date:
  • Size: 21.2 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.7.tar.gz
Algorithm Hash digest
SHA256 ed0ac06b1ee30cb0a28408442bcb13f16ab40daa71c37d4706958c6f217aa377
MD5 3039d4e30d617f2c0d8239f31e1ecd8b
BLAKE2b-256 08adc8afedfefc926fa2ef10085080aaa7517faaf426b9244d1ab7bda6d836c4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: finmc-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 24.3 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e18fa2c48fb95ecbb760bc5bb3121c416fdff75132618c3d736a0190439a328d
MD5 abf5e46befeef6941f10884100d096f3
BLAKE2b-256 4d4660bbeea5814ea8dffad327abde2629bf4fdb14a99831699423c36ad3c701

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