Skip to main content

A package for pricing OTC options using a vectorized Monte Carlo method.

Project description

Monte Carlo Method for Option Pricing

UPDATE: 19th November 2025

    pip install pyoptmc --upgrade

This is a package for pricing path-dependent options using Monte Carlo Simulation under Black-Scholes market dynamics.

This package relies heavily on NumPy for the implementation of vectorization, which significantly boosts algorithm speed. It also uses joblib to implement parallel computation.

Example

import datetime
import pyoptmc as opt
calendar = opt.Calendar()

start_date = datetime.date(2025, 11, 5)
ko_ob_dates = calendar.periodic(start_date, '1M', 13, "next")[1:]

mc = opt.MonteCarlo(100, 1000000)
bs = opt.BlackScholes(0.03, 0, 0.265, 244)
end_date = ko_ob_dates[-1]

dcn = opt.PhoenixProd(
    start_date= start_date,
    end_date = end_date,
    initial_price = 100.0,
    settlement_barrier = 80.0,
    settlement_dates = ko_ob_dates,
    settlement_coupon_rate = 0.15,
    ko_barrier = 100.0,
    ko_ob_dates = ko_ob_dates,
    ki_barrier = 80.0,
    ki_ob_dates = "daily",
    calendar = calendar)

print(dcn.value(start_date, 100.0, True, mc, bs, request_greeks=True))

# {'PV': np.float64(-0.16274331381605528), 'Delta': np.float64(0.2390255106366182), 'Gamma': np.float64(-0.031593825237697534), 'Rho': np.float64(0.020117531945007528), 'Vega': np.float64(-0.23208919587396326), 'Theta': np.float64(0.04311655912199197)}

fcn = opt.PhoenixProd(
    start_date=start_date,
    end_date=end_date,
    initial_price=100.0,
    settlement_barrier=0.0,
    settlement_dates=ko_ob_dates,
    settlement_coupon_rate=0.15,
    ko_barrier=100.0,
    ko_ob_dates=ko_ob_dates,
    ki_barrier=80.0,
    ki_ob_dates=[end_date],
    calendar=calendar)

print(fcn.value(start_date, 100.0, False, mc, bs, request_greeks=True))
# {'PV': np.float64(1.6827002150401873), 'Delta': np.float64(-0.007450531928672407), 'Gamma': np.float64(-0.011540440160383967), 'Rho': np.float64(0.011854131363408455), 'Vega': np.float64(-0.1869648625597277), 'Theta': np.float64(0.017297330302293138)}

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

pyoptmc-0.14.4.tar.gz (38.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyoptmc-0.14.4-py3-none-any.whl (43.5 kB view details)

Uploaded Python 3

File details

Details for the file pyoptmc-0.14.4.tar.gz.

File metadata

  • Download URL: pyoptmc-0.14.4.tar.gz
  • Upload date:
  • Size: 38.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for pyoptmc-0.14.4.tar.gz
Algorithm Hash digest
SHA256 492c8a4f768ea4fb2039556ecd669b229bfef5cfc19b436e0514e1bd464d428a
MD5 23173a77bb52b3a429a3346562d29460
BLAKE2b-256 23e5960be7f53f7f0e13e7a041cc7283dcd8bc5b1b0ec5fdaf624d892597c645

See more details on using hashes here.

File details

Details for the file pyoptmc-0.14.4-py3-none-any.whl.

File metadata

  • Download URL: pyoptmc-0.14.4-py3-none-any.whl
  • Upload date:
  • Size: 43.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for pyoptmc-0.14.4-py3-none-any.whl
Algorithm Hash digest
SHA256 60220b5ed00da12a3393458b6db743ce33885b836f8004c7ea3cdd3e6eb384fc
MD5 9fd8dd965efbb4a36f3391a8b479d7e3
BLAKE2b-256 051032f07f3625e1219f24567fd39646e7430272b0a6fad78c09a18cf0fcd35a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page