Fundamental pricing question regarding Numeraires

Posted by vgdev on
URL: http://quantlib.414.s1.nabble.com/Fundamental-pricing-question-regarding-Numeraires-tp16607.html

Hi,

Can someone please explain to me what is going on in the three last line of code in Matthias Gronckis blog post (https://ipythonquant.wordpress.com/2015/05/02/exposure-simulation-pfe-and-cva-for-multi-callable-swaps-bermudan-swaptions-part-1-of-3/ )about CVA/exposure for bermudan swaptions? I am confused about how he deals with discount factors and numeraires.

# Apply payoff function
npv[npv < 0] = 0
# Deflate NPV
npv = npv / numeraires[:,-1]
npv = np.mean(npv) * numeraires[0,0]

Why does he need to deflate the NPV? And what does the syntax numeraires[:,-1] do? I am programming something similar in C++, so I would really appreciate a few comments about this.

Thanks!