24#ifndef quantext_apo_surface_hpp
25#define quantext_apo_surface_hpp
27#include <boost/optional.hpp>
28#include <ql/patterns/lazyobject.hpp>
29#include <ql/quotes/simplequote.hpp>
30#include <ql/termstructures/volatility/equityfx/blackvoltermstructure.hpp>
40class ApoFutureSurface :
public QuantLib::LazyObject,
public QuantLib::BlackVolatilityTermStructure {
43 ApoFutureSurface(
const QuantLib::Date& referenceDate,
const std::vector<QuantLib::Real>& moneynessLevels,
44 const QuantLib::ext::shared_ptr<CommodityIndex>& index,
45 const QuantLib::Handle<PriceTermStructure>& pts,
46 const QuantLib::Handle<QuantLib::YieldTermStructure>& yts,
47 const QuantLib::ext::shared_ptr<FutureExpiryCalculator>& expCalc,
48 const QuantLib::Handle<QuantLib::BlackVolTermStructure>& baseVts,
49 const QuantLib::ext::shared_ptr<FutureExpiryCalculator>& baseExpCalc, QuantLib::Real beta = 0.0,
50 bool flatStrikeExtrapolation =
true,
51 const boost::optional<QuantLib::Period>& maxTenor = boost::none);
55 QuantLib::Date
maxDate()
const override;
60 QuantLib::Real
minStrike()
const override;
61 QuantLib::Real
maxStrike()
const override;
65 void accept(QuantLib::AcyclicVisitor& v)
override;
80 const QuantLib::ext::shared_ptr<BlackVarianceSurfaceMoneyness>&
vts()
const;
86 QuantLib::Volatility
blackVolImpl(QuantLib::Time t, QuantLib::Real strike)
const override;
90 QuantLib::ext::shared_ptr<CommodityIndex>
index_;
97 std::vector<std::vector<QuantLib::ext::shared_ptr<QuantLib::SimpleQuote> > >
vols_;
100 QuantLib::ext::shared_ptr<BlackVarianceSurfaceMoneyness>
vts_;
103 QuantLib::ext::shared_ptr<CommodityAveragePriceOptionBaseEngine>
apoEngine_;
Black volatility surface based on forward moneyness.
Average future price option (APO) surface derived from a future option surface.
std::vector< std::vector< QuantLib::ext::shared_ptr< QuantLib::SimpleQuote > > > vols_
This will keep a handle on the APO vol quotes that are calculated.
void performCalculations() const override
QuantLib::Volatility blackVolImpl(QuantLib::Time t, QuantLib::Real strike) const override
void accept(QuantLib::AcyclicVisitor &v) override
QuantLib::ext::shared_ptr< BlackVarianceSurfaceMoneyness > vts_
The surface that is created to do the work.
QuantLib::Real minStrike() const override
const QuantLib::ext::shared_ptr< BlackVarianceSurfaceMoneyness > & vts() const
QuantLib::ext::shared_ptr< CommodityIndex > index_
QuantLib::Date maxDate() const override
std::vector< QuantLib::Date > apoDates_
The APO schedule dates.
QuantLib::Real maxStrike() const override
QuantLib::ext::shared_ptr< CommodityAveragePriceOptionBaseEngine > apoEngine_
The engine for valuing the APOs.
QuantLib::ext::shared_ptr< FutureExpiryCalculator > baseExpCalc_
commodity average price option engine
commodity index class for holding commodity spot and futures price histories and forwarding.
Base class for classes that perform date calculations for future contracts.
Term structure of prices.