finmc is a Python library for Monte Carlo Simulation.
Project description
finmc
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.3.tar.gz
(15.5 kB
view details)
Built Distribution
finmc-0.0.3-py3-none-any.whl
(17.8 kB
view details)
File details
Details for the file finmc-0.0.3.tar.gz
.
File metadata
- Download URL: finmc-0.0.3.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6009b31109381d9eebff3784684e8c25421d16429d813249e8552e3b323b0c4a |
|
MD5 | 05f97d10314821e6c0dbc8ed40d349bc |
|
BLAKE2b-256 | 467b9d224bb53eff0dd066245183302ee6e8ca88822f4399524d81fc2a605a00 |
File details
Details for the file finmc-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: finmc-0.0.3-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8f2f84fa2182c0f19b19ebf73c7d94dbd83ee9ec9d1696948c49a656599a155 |
|
MD5 | 107fc0d8910a28c587d17eaeff75794c |
|
BLAKE2b-256 | b24d1c85bd56ba8df6f54afd249cb5ed2f1b9c34668e1116d3e5bea02371b72e |