25VarReport::VarReport(
const std::string& baseCurrency,
const QuantLib::ext::shared_ptr<Portfolio>& portfolio,
26 const std::string& portfolioFilter,
const vector<Real>& p, boost::optional<ore::data::TimePeriod> period,
27 const QuantLib::ext::shared_ptr<HistoricalScenarioGenerator>& hisScenGen,
28 std::unique_ptr<SensiRunArgs> sensiArgs, std::unique_ptr<FullRevalArgs> fullRevalArgs,
const bool breakdown)
29 :
MarketRiskReport(baseCurrency, portfolio, portfolioFilter, period, hisScenGen, std::move(sensiArgs), std::move(fullRevalArgs), nullptr, breakdown), p_(p) {
33 QL_REQUIRE(reports->reports().size() == 1,
"We should only report for VAR report");
34 QuantLib::ext::shared_ptr<Report> report = reports->reports().at(0);
36 report->addColumn(
"Portfolio",
string()).addColumn(
"RiskClass",
string()).addColumn(
"RiskType",
string());
37 for (Size i = 0; i <
p_.size(); ++i)
38 report->addColumn(
"Quantile_" + std::to_string(
p_[i]),
double(), 6);
44 const ext::shared_ptr<MarketRiskGroupBase>& riskGroup,
45 const ext::shared_ptr<TradeGroupBase>& tradeGroup) {
47 QL_REQUIRE(reports->reports().size() == 1,
"We should only report for VAR report");
48 QuantLib::ext::shared_ptr<Report> report = reports->reports().at(0);
50 auto rg = ext::dynamic_pointer_cast<MarketRiskGroup>(riskGroup);
51 auto tg = ext::dynamic_pointer_cast<TradeGroup>(tradeGroup);
53 std::vector<Real> var;
55 for (
auto q : quantiles)
60 report->add(tg->portfolioId());
63 for (
auto const& v : var)
QuantLib::ext::shared_ptr< VarCalculator > varCalculator_
void createReports(const QuantLib::ext::shared_ptr< MarketRiskReport::Reports > &reports) override
VarReport(const std::string &baseCurrency, const QuantLib::ext::shared_ptr< Portfolio > &portfolio, const std::string &portfolioFilter, const vector< Real > &p, boost::optional< ore::data::TimePeriod > period, const QuantLib::ext::shared_ptr< HistoricalScenarioGenerator > &hisScenGen=nullptr, std::unique_ptr< SensiRunArgs > sensiArgs=nullptr, std::unique_ptr< FullRevalArgs > fullRevalArgs=nullptr, const bool breakdown=false)
const std::vector< Real > & p() const
void writeReports(const QuantLib::ext::shared_ptr< MarketRiskReport::Reports > &report, const QuantLib::ext::shared_ptr< MarketRiskGroupBase > &riskGroup, const QuantLib::ext::shared_ptr< TradeGroupBase > &tradeGroup) override
virtual void createVarCalculator()=0
Filter close_enough(const RandomVariable &x, const RandomVariable &y)
std::string to_string(const LocationInfo &l)
Base class for a var calculation.