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.

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

Uploaded Source

Built Distribution

finmc-0.0.4-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for finmc-0.0.4.tar.gz
Algorithm Hash digest
SHA256 b7f1201f8c19f17347d1a71e5f60e094896d15918ce6810cfdb4b8936eb4f34d
MD5 f0f72cddb5596d74d27b981ad68f835f
BLAKE2b-256 e1ca55268e9302f403105564c0ad3263887b72430890a62cf38bb98e4bec5309

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for finmc-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3a49a482156fde72f85159f65067b5b4e68a7c44297c6db08fd04c9a666e7422
MD5 d70b5fa45ecf7d7ec6fa21091f5cd535
BLAKE2b-256 532429dedf739974eb882926a8491b4fe145cba3f5d4af52ce24782c7c53ea02

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