American Option
- torchquantlib.core.asset_pricing.option.american_option.american_option(option_type: str, spot: Tensor, strike: Tensor, expiry: Tensor, volatility: Tensor, rate: Tensor, num_paths: int, num_steps: int) Tensor[source]
Price an American option using Monte Carlo simulation with the Longstaff-Schwartz method.
- Parameters:
option_type (str) – Type of option - either ‘call’ or ‘put’.
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).
num_paths (int) – Number of Monte Carlo simulation paths.
num_steps (int) – Number of time steps in the simulation.
- Returns:
The price of the American option.
- Return type:
Tensor
Overview
The American Option module provides functionality for pricing and analyzing American-style options using various numerical methods. American options can be exercised at any time up to the expiration date, making them more complex to value than European options.
Key Features
Pricing of American call and put options
Support for various underlying assets (e.g., stocks, indices)
Implementation of multiple pricing methods (e.g., binomial tree, finite difference)
Greeks calculation for risk management
Classes
AmericanOption
Functions
Examples
Here’s a basic example of how to use the AmericanOption class:
from torchquantlib.core.asset_pricing.option.american_option import AmericanOption
# Create an American call option
option = AmericanOption(
underlying=100,
strike=95,
expiry=1.0,
rf_rate=0.05,
volatility=0.2,
option_type='call'
)
# Price the option using the binomial tree method
price = option.price(method='binomial', steps=1000)
print(f"American call option price: {price:.4f}")
# Calculate option Greeks
delta = option.delta()
gamma = option.gamma()
theta = option.theta()
vega = option.vega()
rho = option.rho()
print(f"Delta: {delta:.4f}")
print(f"Gamma: {gamma:.4f}")
print(f"Theta: {theta:.4f}")
print(f"Vega: {vega:.4f}")
print(f"Rho: {rho:.4f}")