31#include <ql/indexes/interestrateindex.hpp>
32#include <ql/processes/blackscholesprocess.hpp>
33#include <ql/timegrid.hpp>
65 ModelCGImpl(
const DayCounter& dayCounter,
const Size
size,
const std::vector<std::string>& currencies,
66 const std::vector<std::pair<std::string, QuantLib::ext::shared_ptr<InterestRateIndex>>>& irIndices,
67 const std::vector<std::pair<std::string, QuantLib::ext::shared_ptr<ZeroInflationIndex>>>& infIndices,
68 const std::vector<std::string>& indices,
const std::vector<std::string>& indexCurrencies,
73 std::size_t
dt(
const Date& d1,
const Date& d2)
const override;
74 std::size_t
pay(
const std::size_t amount,
const Date& obsdate,
const Date& paydate,
75 const std::string& currency)
const override;
76 std::size_t
discount(
const Date& obsdate,
const Date& paydate,
const std::string& currency)
const override;
77 std::size_t
eval(
const std::string& index,
const Date& obsdate,
const Date& fwddate,
78 const bool returnMissingMissingAsNull =
false,
79 const bool ignoreTodaysFixing =
false)
const override;
80 std::size_t
fxSpotT0(
const std::string& forCcy,
const std::string& domCcy)
const override;
81 std::size_t
barrierProbability(
const std::string& index,
const Date& obsdate1,
const Date& obsdate2,
82 const std::size_t barrier,
const bool above)
const override;
89 const std::vector<std::vector<std::size_t>>&
randomVariates()
const override;
90 std::vector<std::pair<std::size_t, double>>
modelParameters()
const override;
95 virtual std::size_t
getIndexValue(
const Size indexNo,
const Date& d,
const Date& fwd = Null<Date>())
const = 0;
98 virtual std::size_t
getIrIndexValue(
const Size indexNo,
const Date& d,
const Date& fwd = Null<Date>())
const = 0;
101 virtual std::size_t
getInfIndexValue(
const Size indexNo,
const Date& d,
const Date& fwd)
const = 0;
103 virtual std::size_t
getDiscount(
const Size idx,
const Date& s,
const Date& t)
const = 0;
107 virtual std::size_t
getFxSpot(
const Size idx)
const = 0;
110 const std::size_t barrier,
const bool above)
const = 0;
118 std::vector<std::pair<IndexInfo, QuantLib::ext::shared_ptr<InterestRateIndex>>>
irIndices_;
119 std::vector<std::pair<IndexInfo, QuantLib::ext::shared_ptr<ZeroInflationIndex>>>
infIndices_;
127 std::size_t
addModelParameter(
const std::string&
id, std::function<
double(
void)> f)
const;
138 const QuantLib::ext::shared_ptr<ZeroInflationIndex>& infIndex,
const Size indexNo,
139 const Date& limDate,
const Date& obsdate,
const Date& fwddate,
140 const Date& baseDate)
const;
145 const std::string&
id, std::function<
double(
void)> f);
148Date
getSloppyDate(
const Date& d,
const bool sloppyDates,
const std::set<Date>& dates);
virtual QuantLib::Size size() const
virtual std::size_t getInfIndexValue(const Size indexNo, const Date &d, const Date &fwd) const =0
std::size_t addModelParameter(const std::string &id, std::function< double(void)> f) const
void performCalculations() const override
const std::vector< std::string > currencies_
std::vector< std::vector< size_t > > randomVariates_
std::size_t pay(const std::size_t amount, const Date &obsdate, const Date &paydate, const std::string ¤cy) const override
Real extractT0Result(const RandomVariable &value) const override
std::size_t cgVersion() const override
std::size_t getInflationIndexFixing(const bool returnMissingFixingAsNull, const std::string &indexInput, const QuantLib::ext::shared_ptr< ZeroInflationIndex > &infIndex, const Size indexNo, const Date &limDate, const Date &obsdate, const Date &fwddate, const Date &baseDate) const
std::vector< std::pair< std::size_t, std::function< double(void)> > > & modelParameterFunctors() const override
virtual std::size_t getIrIndexValue(const Size indexNo, const Date &d, const Date &fwd=Null< Date >()) const =0
std::size_t discount(const Date &obsdate, const Date &paydate, const std::string ¤cy) const override
std::vector< std::pair< std::size_t, std::function< double(void)> > > modelParameters_
std::vector< std::pair< IndexInfo, QuantLib::ext::shared_ptr< ZeroInflationIndex > > > infIndices_
virtual std::size_t getFutureBarrierProb(const std::string &index, const Date &obsdate1, const Date &obsdate2, const std::size_t barrier, const bool above) const =0
QuantLib::Date cgEvalDate_
const std::string & baseCcy() const override
std::size_t dt(const Date &d1, const Date &d2) const override
std::vector< IndexInfo > indices_
virtual std::size_t getFxSpot(const Size idx) const =0
virtual std::size_t getIndexValue(const Size indexNo, const Date &d, const Date &fwd=Null< Date >()) const =0
std::size_t barrierProbability(const std::string &index, const Date &obsdate1, const Date &obsdate2, const std::size_t barrier, const bool above) const override
const DayCounter dayCounter_
virtual std::size_t getDiscount(const Size idx, const Date &s, const Date &t) const =0
virtual std::size_t getNumeraire(const Date &s) const =0
std::vector< std::pair< IndexInfo, QuantLib::ext::shared_ptr< InterestRateIndex > > > irIndices_
std::size_t fxSpotT0(const std::string &forCcy, const std::string &domCcy) const override
std::vector< std::pair< std::size_t, double > > modelParameters() const override
const std::vector< std::vector< std::size_t > > & randomVariates() const override
const std::vector< std::string > indexCurrencies_
const IborFallbackConfig iborFallbackConfig_
const std::set< Date > simulationDates_
std::size_t eval(const std::string &index, const Date &obsdate, const Date &fwddate, const bool returnMissingMissingAsNull=false, const bool ignoreTodaysFixing=false) const override
SafeStack< ValueType > value
interface for model against which a script can be run
std::size_t addModelParameter(ComputationGraph &g, std::vector< std::pair< std::size_t, std::function< double(void)> > > &m, const std::string &id, std::function< double(void)> f)
Date getSloppyDate(const Date &d, const bool sloppyDates, const std::set< Date > &dates)
Serializable Credit Default Swap.