Future Pricer
- torchquantlib.core.asset_pricing.money.future_pricer.future_pricer(spot: Tensor, domestic_rate: Tensor, foreign_rate: Tensor, expiry: Tensor) Tensor[source]
Calculate the theoretical price of a futures contract.
This function computes the fair price of a futures contract using the cost-of-carry model. It assumes continuous compounding and no dividends or storage costs.
- Parameters:
spot (Tensor) – The current spot price of the underlying asset.
domestic_rate (Tensor) – The domestic risk-free interest rate (as a decimal).
foreign_rate (Tensor) – The foreign risk-free interest rate (as a decimal).
expiry (Tensor) – The time to expiration of the futures contract (in years).
- Returns:
The theoretical futures price.
- Return type:
Tensor
- Formula:
Futures Price = Spot Price * e^(domestic_rate - foreign_rate * time to expiry)
Note
This model assumes perfect markets with no transaction costs or taxes.
For commodities or dividend-paying stocks, additional factors would need to be considered in the pricing model.
This module provides implementation for pricing futures contracts.
- torchquantlib.core.asset_pricing.money.future_pricer.future_pricer(spot: Tensor, domestic_rate: Tensor, foreign_rate: Tensor, expiry: Tensor) Tensor[source]
Calculate the theoretical price of a futures contract.
This function computes the fair price of a futures contract using the cost-of-carry model. It assumes continuous compounding and no dividends or storage costs.
- Parameters:
spot (Tensor) – The current spot price of the underlying asset.
domestic_rate (Tensor) – The domestic risk-free interest rate (as a decimal).
foreign_rate (Tensor) – The foreign risk-free interest rate (as a decimal).
expiry (Tensor) – The time to expiration of the futures contract (in years).
- Returns:
The theoretical futures price.
- Return type:
Tensor
- Formula:
Futures Price = Spot Price * e^(domestic_rate - foreign_rate * time to expiry)
Note
This model assumes perfect markets with no transaction costs or taxes.
For commodities or dividend-paying stocks, additional factors would need to be considered in the pricing model.
Usage Example
import torch
from torchquantlib.core.asset_pricing.money.future_pricer import future_pricer
spot = torch.tensor(100.0)
rate = torch.tensor(0.05)
expiry = torch.tensor(1.0)
futures_price = future_pricer(spot, rate, expiry)
print(f"Futures Price: {futures_price.item():.2f}")
Formula
The theoretical price of a futures contract is calculated using the following formula:
- Where:
Spot Price is the current market price of the underlying asset
risk-free rate is the annualized risk-free interest rate
time to expiry is the time until the futures contract expires (in years)
- Note:
This model assumes perfect markets with no transaction costs or taxes.
For commodities or dividend-paying stocks, additional factors would need to be considered in the pricing model.
The formula uses continuous compounding.
Limitations
The future pricer implemented in this module has some limitations:
It assumes continuous compounding, which may not always reflect real-world scenarios.
It does not account for dividends, which can affect the futures price for stock index futures.
It does not consider storage costs or convenience yields, which are important factors for commodity futures.
The model assumes perfect markets without transaction costs, taxes, or other frictions.
For more complex scenarios or specific types of futures contracts, you may need to modify the pricing model or use more advanced techniques.