I've converted the following formula for a Banking regulatory regulation, to help calculate how much money the bank needs to set aside:
I know it's not the perfect code, but it outputs the correct values. Could anyone give me some pointers on how to make the operation more Pythonic?
def capital_requirement(r, lgd, pd, madj, tenor):
'''Returns the capital requirement.'''
madjcoeff = 1.5
tsub = 2.5
a1 = (stat.norm.ppf(pd) + r**0.5 * stat.norm.ppf(0.999)) / ((1 - r)**0.5)
b1 = lgd * stat.norm.cdf(a1) - lgd * pd
return b1 * (1 + ((tenor - tsub) * madj)) / (1- madjcoeff * madj)