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

Uploaded Source

Built Distribution

finmc-0.0.6-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: finmc-0.0.6.tar.gz
  • Upload date:
  • Size: 18.8 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.6.tar.gz
Algorithm Hash digest
SHA256 82405efc8940958813f2c74ae77f731c51aac302d05b91b6ef9e9becae66e519
MD5 6e00b100aeec6c6a334195b932c89e58
BLAKE2b-256 9c192b78abd3fd3b03156bd56dfcac53e2648b72dcd1a9f5829c063c4af4293f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: finmc-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 23.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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 99ca006e34d71c52025aadba03c52f253b49a5a9b534b7cd06571aa8445bb5ae
MD5 ec0d51e99352951733409377f9642129
BLAKE2b-256 ecb79971fd8f124b34d9708b99b912773bd89845fc950f128553bcaf2bf723cf

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