First of all, thank you for a great risk library, it’s very useful!
I have a question regarding the possibility to calculate a portfolio’s NPV using a valuation date which is different from the market date. QuantLib allows this for swap legs with the following function (+ it gives the flexibility of providing a different settlement date as well):
Real npv(const Leg& leg,
const YieldTermStructure& discountCurve,
Date settlementDate = Date(),
Date npvDate = Date());
Is there a similar parameter that we can set in the NPV analytic xml node to do so?
I guess QL does not have this flexibility for all instrument types (only swap legs) so it would require more work than just exposing the existing QL features.
Would it not be possible to just “roll” down all the market curves (including vol surfaces?), like I guess it is done in the MC simulation but without the stochastic part?
My end goal would be to see the MTM of a portfolio evolve through time (and possibly calculate it for a specific date), assuming the current market forwards realise. I can always simulate a large number of NPV paths and average them but that seems like an overkill for simple forward-implied MTM valuation. Is there any other way to do this?
you could indeed use the simulation framework to achieve what you are looking for. The easiest way is changing the relevant simulation.xml such that the simulation model calibration is skipped, and it is initialized to zero volatility. Then choose a small number of paths (I don’t recall whether 1 is sufficient) and run XVA analytics. The combination of the EPE and ENE profiles will provide you with the NPV evolution “along the forward curve” until maturity. I have used that approach in the past. If you need more help when you try that, let me know.