Engine icon indicating copy to clipboard operation
Engine copied to clipboard

Commodity Forwards Notional Resets (bug?)

Open Nick-Git2 opened this issue 2 years ago • 4 comments

Hi there,

I've set up a new commodity forward and run standard stuff similar to Example_24. I've noticed that the notional gets set to the present forward price x quantity similar as if it was resettable daily (see for example notional from NPV of Example_24).

In my opinion, the default for a forward notional should be the forward's agreed price at closure ("strike") x quantity and this notional should not change during the trade's lifetime.

Here's a modified Example_24 (trade's price/"strike" set to 1100) to highlight the issue. Forward from Curve is at 1161.80: grafik

Rgds,

Nick

Nick-Git2 avatar Dec 09 '23 17:12 Nick-Git2

Can you post your portfolio.xml?

rkapl123 avatar Dec 09 '23 18:12 rkapl123

Can you post your portfolio.xml?

It's pretty much an excerpt from portfolio.xml from Example_24. Only "strike" and quantity changed. All other input parameters/files unchanged.

grafik

Nick-Git2 avatar Dec 09 '23 18:12 Nick-Git2

You're right, the problem seems to be in the implementation of CommodityForward::notional()

Real CommodityForward::notional() const {
    // try to get the notional from the additional results of the instrument
    try {
        return instrument_->qlInstrument(true)->result<Real>("currentNotional");
    } catch (const std::exception& e) {
        if (strcmp(e.what(), "currentNotional not provided"))
            ALOG("error when retrieving notional: " << e.what());
    }
    // if not provided, return null
    return Null<Real>();
}

rkapl123 avatar Dec 09 '23 20:12 rkapl123

I agree, the notional should most likely be "quantity x strike" as here

https://github.com/OpenSourceRisk/Engine/blob/master/OREData/ored/portfolio/commodityforward.cpp#L149

In general we set the notional in a way that complies with ISDA recommendations for trade reconciliation. We'll confirm that "quantity x strike" is correct and fix this in the next release. Of course you are welcome to open a PR if you want.

(our internal ref: QPR-12213)

pcaspers avatar Dec 10 '23 10:12 pcaspers