Python Forum
Final Projet - Credit Risk
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Final Projet - Credit Risk
#1
Smile 
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 :

"""
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 Rolleyes
Reply


Messages In This Thread
Final Projet - Credit Risk - by Rauchvant - Nov-16-2020, 02:22 PM
RE: Final Projet - Credit Risk - by DPaul - Nov-16-2020, 03:49 PM
RE: Final Projet - Credit Risk - by Rauchvant - Nov-16-2020, 03:58 PM
RE: Final Projet - Credit Risk - by Rauchvant - Nov-18-2020, 03:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help needed, stuck at the final output extricate 0 1,590 Jun-20-2020, 05:35 AM
Last Post: extricate
  Final Project (Databases, GUI, and Classes) poochenthecreator 1 1,733 Apr-27-2020, 09:58 PM
Last Post: deanhystad
  School projet robalexx 1 1,999 May-03-2019, 10:41 AM
Last Post: heiner55
  Final Project Help hyg71886 6 4,074 Feb-07-2019, 01:30 AM
Last Post: micseydel
  Trouble with edX Python Final sarah_mb_sues 11 13,948 Jun-19-2018, 10:36 AM
Last Post: cryomick
  Final problem Truman 4 4,132 Jan-22-2018, 11:42 PM
Last Post: Truman
  Regular Expressions in Files (find all phone numbers and credit card numbers) Amirsalar 2 4,185 Dec-05-2017, 09:48 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020