Mastering Python for Finance - Second Edition (2024)

The Cox-Ingersoll-Ross (CIR) model is a one-factor model that was proposed to address the negative interest rates found in the Vasicek model. The process is given as follows:

Mastering Python for Finance - Second Edition (1)

The term Mastering Python for Finance - Second Edition (2) increases the standard deviation as the short-rate increases. Now the vasicek() function can be rewritten as the CIR model in Python:

In [ ]: import math import numpy 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])*\ ...

Get Mastering Python for Finance - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.

Mastering Python for Finance - Second Edition (2024)
Top Articles
Latest Posts
Article information

Author: Rob Wisoky

Last Updated:

Views: 6026

Rating: 4.8 / 5 (48 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Rob Wisoky

Birthday: 1994-09-30

Address: 5789 Michel Vista, West Domenic, OR 80464-9452

Phone: +97313824072371

Job: Education Orchestrator

Hobby: Lockpicking, Crocheting, Baton twirling, Video gaming, Jogging, Whittling, Model building

Introduction: My name is Rob Wisoky, I am a smiling, helpful, encouraging, zealous, energetic, faithful, fantastic person who loves writing and wants to share my knowledge and understanding with you.