Bond
- torchquantlib.core.asset_pricing.bond.bond_pricer.callable_bond(face_value: tensor, coupon_rate: tensor, rate: tensor, periods: tensor, call_price: tensor, call_period: tensor) tensor[source]
Calculate the price of a callable bond.
- Parameters:
face_value (tensor) – The face value of the bond
coupon_rate (tensor) – The coupon rate (as a decimal)
rate (tensor) – The interest rate (as a decimal)
periods (tensor) – Number of coupon periods
call_price (tensor) – The price at which the bond can be called
call_period (tensor) – The period at which the bond can be called
- Returns:
The price of the callable bond
- Return type:
tensor
- torchquantlib.core.asset_pricing.bond.bond_pricer.convertible_bond(face_value: tensor, coupon_rate: tensor, rate: tensor, periods: tensor, conversion_ratio: tensor, conversion_price: tensor) tensor[source]
Calculate the price of a convertible bond.
- Parameters:
face_value (tensor) – The face value of the bond
coupon_rate (tensor) – The coupon rate (as a decimal)
rate (tensor) – The interest rate (as a decimal)
periods (tensor) – Number of coupon periods
conversion_ratio (tensor) – The number of shares received upon conversion
conversion_price (tensor) – The price of the underlying stock for conversion
- Returns:
The price of the convertible bond
- Return type:
tensor
- torchquantlib.core.asset_pricing.bond.bond_pricer.coupon_bond(face_value: tensor, coupon_rate: tensor, rate: tensor, periods: tensor) tensor[source]
Calculate the price of a coupon-paying bond.
- Parameters:
face_value (tensor) – The face value of the bond
coupon_rate (tensor) – The coupon rate (as a decimal)
rate (tensor) – The interest rate (as a decimal)
periods (tensor) – Number of coupon periods
- Returns:
The price of the coupon bond
- Return type:
tensor
- torchquantlib.core.asset_pricing.bond.bond_pricer.putable_bond(face_value: tensor, coupon_rate: tensor, rate: tensor, periods: tensor, put_price: tensor, put_period: tensor) tensor[source]
Calculate the price of a putable bond.
- Parameters:
face_value (tensor) – The face value of the bond
coupon_rate (tensor) – The coupon rate (as a decimal)
rate (tensor) – The interest rate (as a decimal)
periods (tensor) – Number of coupon periods
put_price (tensor) – The price at which the bond can be put
put_period (tensor) – The period at which the bond can be put
- Returns:
The price of the putable bond
- Return type:
tensor
- torchquantlib.core.asset_pricing.bond.bond_pricer.stochastic_rate_bond(face_value: tensor, coupon_rate: tensor, rate: tensor, periods: tensor) tensor[source]
Calculate the price of a bond with stochastic interest rates.
- Parameters:
face_value (tensor) – The face value of the bond
coupon_rate (tensor) – The coupon rate (as a decimal)
rate (tensor) – A tensor of interest rates for each period
periods (tensor) – Number of coupon periods
- Returns:
The price of the bond with stochastic rates
- Return type:
tensor
- torchquantlib.core.asset_pricing.bond.bond_pricer.zero_coupon_bond(face_value: tensor, rate: tensor, maturity: tensor) tensor[source]
Calculate the price of a zero-coupon bond.
- Parameters:
face_value (tensor) – The face value of the bond
rate (tensor) – The interest rate (as a decimal)
maturity (tensor) – Time to maturity in years
- Returns:
The price of the zero-coupon bond
- Return type:
tensor
- torchquantlib.core.asset_pricing.bond.fixed_income_forward.fixed_income_forward(face_value: Tensor, rate: Tensor, time_to_maturity: Tensor, forward_rate: Tensor) Tensor[source]
Calculate the forward price of a fixed income security.
This function computes the forward price of a fixed income security using the continuous compounding formula. It’s based on the principle that the forward price should reflect the difference between the current interest rate and the forward rate over the time to maturity.
- Parameters:
face_value (Tensor) – The face value (or notional amount) of the fixed income security.
rate (Tensor) – The current interest rate (as a decimal).
time_to_maturity (Tensor) – The time to maturity of the forward contract (in years).
forward_rate (Tensor) – The forward interest rate (as a decimal).
- Returns:
The calculated forward price of the fixed income security.
- Return type:
Tensor
- Formula:
Forward Price = Face Value * e^((Forward Rate - Current Rate) * Time to Maturity)
Note
This function assumes continuous compounding. For discrete compounding, a different formula would be required.