Black-Scholes-Merton Model

Overview

The Black-Scholes-Merton module implements the Black-Scholes-Merton model for pricing European and American options on dividend-paying stocks.

Key Features

  • Pricing of European and American call and put options

  • Support for dividend-paying stocks

  • Efficient implementation using PyTorch tensors

Functions

torchquantlib.core.asset_pricing.option.black_scholes_merton.black_scholes_merton(option_type: str, option_style: str, spot: Tensor, strike: Tensor, expiry: Tensor, volatility: Tensor, rate: Tensor, dividend: Tensor) Tensor[source]

Price an option using the Black-Scholes-Merton model.

This function implements the Black-Scholes-Merton model to price European and American options on dividend-paying stocks.

Parameters:
  • option_type (str) – Type of option - either ‘call’ or ‘put’.

  • option_style (str) – Style of option - either ‘european’ or ‘american’.

  • spot (Tensor) – Current price of the underlying asset.

  • strike (Tensor) – Strike price of the option.

  • expiry (Tensor) – Time to expiration in years.

  • volatility (Tensor) – Volatility of the underlying asset.

  • rate (Tensor) – Risk-free interest rate (annualized).

  • dividend (Tensor) – Continuous dividend yield of the underlying asset.

Returns:

The price of the option.

Return type:

Tensor

Note

  • This implementation uses the Black-Scholes-Merton formula for European options.

  • For American options, it uses a simple approximation that may not be accurate in all cases.

  • For more accurate pricing of American options, especially puts on dividend-paying stocks, numerical methods like binomial trees or finite difference methods are recommended.

Price an option using the Black-Scholes-Merton model.

Parameters:
  • option_type (str) – Type of option - either ‘call’ or ‘put’

  • option_style (str) – Style of option - either ‘european’ or ‘american’

  • spot (Tensor) – Current price of the underlying asset

  • strike (Tensor) – Strike price of the option

  • expiry (Tensor) – Time to expiration in years

  • volatility (Tensor) – Volatility of the underlying asset

  • rate (Tensor) – Risk-free interest rate (annualized)

  • dividend (Tensor) – Continuous dividend yield of the underlying asset

Returns:

The price of the option

Return type:

Tensor

Examples

Here’s a basic example of how to use the black_scholes_merton function:

import torch
from torchquantlib.core.asset_pricing.option.black_scholes_merton import black_scholes_merton

# Set option parameters
option_type = 'call'
option_style = 'european'
spot = torch.tensor(100.0)
strike = torch.tensor(95.0)
expiry = torch.tensor(1.0)
volatility = torch.tensor(0.2)
rate = torch.tensor(0.05)
dividend = torch.tensor(0.02)

# Price the option
price = black_scholes_merton(option_type, option_style, spot, strike, expiry, volatility, rate, dividend)
print(f"Black-Scholes-Merton {option_style} {option_type} option price: {price:.4f}")