Cox-Ingersoll-Ross (CIR) Model
- class torchquantlib.models.interest_rate.cir.CIR(kappa_init=0.1, theta_init=0.05, sigma_init=0.01, r0_init=0.03)[source]
Bases:
StochasticModelCox-Ingersoll-Ross (CIR) interest rate model.
This model describes the evolution of interest rates using the following stochastic differential equation: dr = κ(θ - r)dt + σ√r dW
where: r is the interest rate κ (kappa) is the speed of mean reversion θ (theta) is the long-term mean level σ (sigma) is the volatility W is a Wiener process
- __init__(kappa_init=0.1, theta_init=0.05, sigma_init=0.01, r0_init=0.03)[source]
Initialize the CIR model.
- Parameters:
kappa_init (float) – Initial value for speed of mean reversion.
theta_init (float) – Initial value for long-term mean level.
sigma_init (float) – Initial value for volatility.
r0_init (float) – Initial interest rate.
- simulate(S0, T, N, steps=100)[source]
Simulate interest rate paths using the CIR model.
- Parameters:
S0 (float) – Initial asset price (not used in this model, included for consistency).
T (float) – Time horizon for simulation.
N (int) – Number of simulation paths.
steps (int) – Number of time steps in each path.
- Returns:
Simulated interest rates at time T.
- Return type:
torch.Tensor
- _apply_constraints()[source]
Apply constraints to model parameters to ensure they remain in valid ranges.
- simulate(S0, T, N, steps=100)[source]
Simulate interest rate paths using the CIR model.
- Parameters:
S0 (float) – Initial asset price (not used in this model, included for consistency).
T (float) – Time horizon for simulation.
N (int) – Number of simulation paths.
steps (int) – Number of time steps in each path.
- Returns:
Simulated interest rates at time T.
- Return type:
torch.Tensor
Class Methods
- __init__(kappa_init=0.1, theta_init=0.05, sigma_init=0.01, r0_init=0.03)
Initialize the CIR model.
- param float kappa_init:
Initial value for speed of mean reversion.
- param float theta_init:
Initial value for long-term mean level.
- param float sigma_init:
Initial value for volatility.
- param float r0_init:
Initial interest rate.
- simulate(S0, T, N, steps=100)
Simulate interest rate paths using the CIR model.
- param float S0:
Initial asset price (not used in this model, included for consistency).
- param float T:
Time horizon for simulation.
- param int N:
Number of simulation paths.
- param int steps:
Number of time steps in each path.
- return:
Simulated interest rates at time T.
- rtype:
torch.Tensor
- _apply_constraints()
Apply constraints to model parameters to ensure they remain in valid ranges.