Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CommodityPositionInstrumentWrapperEngine Class Reference

#include <ored/portfolio/commodityposition.hpp>

+ Inheritance diagram for CommodityPositionInstrumentWrapperEngine:
+ Collaboration diagram for CommodityPositionInstrumentWrapperEngine:

Public Member Functions

void calculate () const override
 

Detailed Description

Definition at line 131 of file commodityposition.hpp.

Member Function Documentation

◆ calculate()

void calculate ( ) const
override

Definition at line 194 of file commodityposition.cpp.

194 {
195 Real result = 0.0;
196 Date today = Settings::instance().evaluationDate();
197 for (Size i = 0; i < arguments_.commodities_.size(); ++i) {
198 // TODO: if refering spot price need lookup the spot date instead of today
199 // for future settlement the fixing date is not relvant, always lookup future expiry date
200 Real tmp = arguments_.quantity_ * arguments_.commodities_[i]->fixing(today, true);
201 if (!arguments_.fxConversion_[i].empty()) {
202 tmp *= arguments_.fxConversion_[i]->value();
203 }
204 result += tmp * arguments_.weights_[i];
205 }
206 if (!arguments_.npvCcyConversion_.empty()) {
207 result *= arguments_.npvCcyConversion_->value();
208 }
209 results_.value = result;
210}
const Instrument::results * results_
Swap::arguments * arguments_