Hello dear community,
We are a group of 2 persons (me Antoine and my teammate Julien) and we began the Python coding this month. To explain the context of our problem, we study the finance. Today, we work on our final project about Credit Risk. I will show our topic with the example and our work. It's a beginning for us, but we would like tu understand why our program doesn't work and how we can correct the error.
There is a little reading but it's necessary if you want to understand our exercice and what is wrong in our code (and yes I organize my projects like a child with some sticking).
TOPIC :
1 : https://zupimages.net/viewer.php?id=20/47/4092.jpg
2 : https://zupimages.net/viewer.php?id=20/47/8ns9.jpg
At the end of the second picture, it's our first try that you will find below :
We are a group of 2 persons (me Antoine and my teammate Julien) and we began the Python coding this month. To explain the context of our problem, we study the finance. Today, we work on our final project about Credit Risk. I will show our topic with the example and our work. It's a beginning for us, but we would like tu understand why our program doesn't work and how we can correct the error.
There is a little reading but it's necessary if you want to understand our exercice and what is wrong in our code (and yes I organize my projects like a child with some sticking).
TOPIC :
1 : https://zupimages.net/viewer.php?id=20/47/4092.jpg
2 : https://zupimages.net/viewer.php?id=20/47/8ns9.jpg
At the end of the second picture, it's our first try that you will find below :
""" Created on Thu Nov 12 17:17:27 2020 @author: Antoine CHEVALIER """ import numpy as np r = 0.05 T = 1 D = 10 V_O = 12.4 sigma_val = 0.2123 def d1(r,T,D,V_0,sigma_val): return (np.log(V_O/D)+(r+sigma_val**2/2)*T)/sigma_val*np.sqrt(T) a = d1(0.05,1,10,12.4,0.2123) print("d1 =",a) def d2(r,T,D,V_0,sigma_val): return d1(r,T,D,V_O,sigma_val)-sigma_val*np.sqrt(T) b = d2(0.05,1,10,12.4,0.2123) print("d2 =",b) import scipy.integrate as integrate def phi(x): return np.exp(-x**2/2) def N(x): return 1/np.sqrt(2*np.pi)*integrate.quad(phi,-np.inf,x)[0] print ("The default probability of the company is",1-N(b))Thank you for your help, I'm waiting your remarks
