Class for loading historical scenarios.
More...
#include <orea/scenario/historicalscenarioloader.hpp>
Class for loading historical scenarios.
Definition at line 37 of file historicalscenarioloader.hpp.
◆ HistoricalScenarioLoader() [1/4]
◆ HistoricalScenarioLoader() [2/4]
Constructor that loads scenarios, read from scenarioReader
, between startDate
and endDate
.
- Warning:
- The scenarios coming from
scenarioReader
must be in ascending order. If not, an exception is thrown.
- Parameters
-
scenarioReader | A scenario reader that feeds the loader with scenarios |
startDate | The first date to load a a scenario for |
endDate | The last date to load a scenario for |
calendar | Calendar to use when advancing dates |
◆ HistoricalScenarioLoader() [3/4]
Constructor that loads scenarios, read from scenarioReader
, for given dates
- Parameters
-
scenarioReader | A scenario reader that feeds the loader with scenarios |
dates | The first date to load a a scenario for |
◆ HistoricalScenarioLoader() [4/4]
Constructor that loads scenarios from a vector
- Parameters
-
scenarios | A vector of scenarios |
dates | The first date to load a a scenario for |
Definition at line 115 of file historicalscenarioloader.cpp.
117 {
118 for (const auto& s : scenarios) {
119 Date scenarioDate = s->asof();
120
121 auto it =
dates.find(scenarioDate);
122 if (it ==
dates.end())
123 continue;
124 else {
126 dates_.push_back(scenarioDate);
127 }
129 break;
130 }
131}
std::vector< QuantLib::Date > dates_
std::vector< QuantLib::Date > & dates()
Set historical scenario dates.
std::vector< QuantLib::ext::shared_ptr< ore::analytics::Scenario > > historicalScenarios_
◆ getHistoricalScenario()
QuantLib::ext::shared_ptr< Scenario > getHistoricalScenario |
( |
const QuantLib::Date & |
date | ) |
const |
Get a Scenario for a given date.
Definition at line 31 of file historicalscenarioloader.cpp.
31 {
33
35 QL_REQUIRE(it !=
dates_.end(),
"HistoricalScenarioLoader can't find an index for date " << date);
36
37 Size index = std::distance(
dates_.begin(), it);
39};
◆ numScenarios()
QuantLib::Size numScenarios |
( |
| ) |
const |
◆ historicalScenarios() [1/2]
◆ historicalScenarios() [2/2]
◆ dates() [1/2]
std::vector< QuantLib::Date > & dates |
( |
| ) |
|
◆ dates() [2/2]
const std::vector< QuantLib::Date > & dates |
( |
| ) |
const |
◆ historicalScenarios_
◆ dates_
std::vector<QuantLib::Date> dates_ |
|
protected |