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

Commodity options on prompt future (with maturity=expiry) priced in the Schwartz model. More...

#include <qle/pricingengines/commodityschwartzfutureoptionengine.hpp>

+ Inheritance diagram for CommoditySchwartzFutureOptionEngine:
+ Collaboration diagram for CommoditySchwartzFutureOptionEngine:

Public Member Functions

 CommoditySchwartzFutureOptionEngine (const QuantLib::ext::shared_ptr< CommoditySchwartzModel > &model)
 
void calculate () const override
 

Private Attributes

QuantLib::ext::shared_ptr< CommoditySchwartzModelmodel_
 

Detailed Description

Commodity options on prompt future (with maturity=expiry) priced in the Schwartz model.

Definition at line 36 of file commodityschwartzfutureoptionengine.hpp.

Constructor & Destructor Documentation

◆ CommoditySchwartzFutureOptionEngine()

CommoditySchwartzFutureOptionEngine ( const QuantLib::ext::shared_ptr< CommoditySchwartzModel > &  model)

Definition at line 25 of file commodityschwartzfutureoptionengine.cpp.

26 : model_(model) {}
QuantLib::ext::shared_ptr< CommoditySchwartzModel > model_

Member Function Documentation

◆ calculate()

void calculate ( ) const
override

Definition at line 28 of file commodityschwartzfutureoptionengine.cpp.

28 {
29
30 QL_REQUIRE(arguments_.exercise->type() == Exercise::European, "only European options are allowed");
31
32 QuantLib::ext::shared_ptr<StrikedTypePayoff> payoff = QuantLib::ext::dynamic_pointer_cast<StrikedTypePayoff>(arguments_.payoff);
33 QL_REQUIRE(payoff != NULL, "only striked payoff is allowed");
34
35 QuantLib::ext::shared_ptr<CommoditySchwartzParametrization> param = model_->parametrization();
36
37 Date expiry = arguments_.exercise->lastDate();
38 Time T = param->priceCurve()->timeFromReference(expiry);
39 if (T <= 0.0) {
40 // option is expired, we do not value any possibly non settled
41 // flows, i.e. set the npv to zero in this case
42 results_.value = 0.0;
43 return;
44 }
45 Real forward = param->priceCurve()->price(expiry);
46 // Var[ln F(T,T)] = Var[X(T)] = V(0,T) - V(T,T)
47 Real variance = param->VtT(0,T) - param->VtT(T,T);
48 BlackCalculator black(payoff, forward, std::sqrt(variance), 1.0);
49 results_.value = black.value();
50
51} // calculate()
const Instrument::results * results_
Definition: cdsoption.cpp:81
RandomVariable variance(const RandomVariable &r)
RandomVariable black(const RandomVariable &omega, const RandomVariable &t, const RandomVariable &strike, const RandomVariable &forward, const RandomVariable &impliedVol)
Swap::arguments * arguments_
+ Here is the call graph for this function:

Member Data Documentation

◆ model_

QuantLib::ext::shared_ptr<CommoditySchwartzModel> model_
private

Definition at line 42 of file commodityschwartzfutureoptionengine.hpp.