File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -131,14 +131,10 @@ void MarketRiskReport::initialise() {
131131 if (hisScenGen_) {
132132 // Build the filtered historical scenario generator
133133 if (requireRiskFactorPnl_){
134- // hisScenGen_ = QuantLib::ext::make_shared<HistoricalScenarioGenerator>(
135- // timePeriods());
136134 hisScenGen_->setRiskFactorBreakdown (true );
137- }else {
138- hisScenGen_ = QuantLib::ext::make_shared<HistoricalScenarioGeneratorWithFilteredDates>(
139- timePeriods (), hisScenGen_);
140135 }
141-
136+ hisScenGen_ = QuantLib::ext::make_shared<HistoricalScenarioGeneratorWithFilteredDates>(
137+ timePeriods (), hisScenGen_);
142138
143139 if (fullRevalArgs_ && fullRevalArgs_->simMarket_ )
144140 hisScenGen_->baseScenario () = fullRevalArgs_->simMarket_ ->baseScenario ();
Original file line number Diff line number Diff line change @@ -340,6 +340,11 @@ void HistoricalScenarioGeneratorWithFilteredDates::reset() {
340340}
341341
342342QuantLib::ext::shared_ptr<Scenario> HistoricalScenarioGeneratorWithFilteredDates::next (const Date& d) {
343+
344+ // Access and propagate the current key from the underlying generator
345+ auto key = this ->getCurrentKey ();
346+ gen_->setCurrentKey (key);
347+
343348 while (i_orig_ < gen_->numScenarios () && !isRelevantScenario_[i_orig_]) {
344349 gen_->next (d);
345350 ++i_orig_;
Original file line number Diff line number Diff line change @@ -177,6 +177,7 @@ class HistoricalScenarioGenerator : public ScenarioGenerator {
177177 void setRiskFactorBreakdown (const bool b) { riskFactorBreakdown_ = b; }
178178 bool isRiskFactorBreakdown () const {return riskFactorBreakdown_; }
179179 virtual void setCurrentKey (const RiskFactorKey& k);
180+ RiskFactorKey getCurrentKey () const { return currentKey_;}
180181 virtual void setIterator (const Size& k);
181182
182183protected:
You can’t perform that action at this time.
0 commit comments