Cir Process, Interest Rates, Stochastic Modeling, Mean Reversion, Volatility.
as np def CIR(r0, K, theta, sigma, T=1., N=10, seed=777): np.random.seed(seed) dt = T / float(N) rates = [r0] for i in range(N): dr = K * (theta - rates[-1]) * dt + sigma * math.sqrt(rates[-1]) * np.random.normal() rates.append(rates[-1] + dr) return np.array(rates) # Example usage: r0 = 0.05 #