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.5.tar.gz
(18.3 kB
view details)
Built Distribution
finmc-0.0.5-py3-none-any.whl
(22.7 kB
view details)
File details
Details for the file finmc-0.0.5.tar.gz
.
File metadata
- Download URL: finmc-0.0.5.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb52889775165ea7ccdf9331d1de4827a09dd4052a1fd4fe58a2394558f87ec9 |
|
MD5 | 24a03976524ca31ad012bedf5fe06fbc |
|
BLAKE2b-256 | 37d31682873356c83b785e5544ed14f6d68edae765cbc6706dbc3a473512c429 |
File details
Details for the file finmc-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: finmc-0.0.5-py3-none-any.whl
- Upload date:
- Size: 22.7 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 | 775e2e844f4aff710b32c52c49b108f8fc16e466d65fdbd43b93e47517662b93 |
|
MD5 | 865d5eabe1b1a8037660c45f4b4f1366 |
|
BLAKE2b-256 | d491821864eaa063ef4c1cea9b6681351f112f4dac1b1c620c10846e5ef582fd |