Logo
Reference manual - version orea_version
Public Member Functions | List of all members
HistoricalScenarioGeneratorRandom Class Reference

Historical scenario generator generating random scenarios, for testing purposes. More...

#include <orea/scenario/historicalscenariogenerator.hpp>

+ Inheritance diagram for HistoricalScenarioGeneratorRandom:

Public Member Functions

 HistoricalScenarioGeneratorRandom (const boost::shared_ptr< HistoricalScenarioLoader > &historicalScenarioLoader, const boost::shared_ptr< ScenarioFactory > &scenarioFactory, const QuantLib::Calendar &cal, const boost::shared_ptr< ore::data::AdjustmentFactors > &adjFactors=nullptr, const QuantLib::Size mporDays=10, const bool overlapping=true, const ReturnConfiguration &returnConfiguration=ReturnConfiguration())
 
boost::shared_ptr< Scenarionext (const QuantLib::Date &d) override
 
void reset () override
 Reset the generator so calls to next() return the first scenario. More...
 
- Public Member Functions inherited from HistoricalScenarioGenerator
 HistoricalScenarioGenerator (const boost::shared_ptr< HistoricalScenarioLoader > &historicalScenarioLoader, const boost::shared_ptr< ScenarioFactory > &scenarioFactory, const QuantLib::Calendar &cal, const boost::shared_ptr< ore::data::AdjustmentFactors > &adjFactors=nullptr, const Size mporDays=10, const bool overlapping=true, const ReturnConfiguration &returnConfiguration=ReturnConfiguration(), const std::string &labelPrefix="")
 Default constructor. More...
 
boost::shared_ptr< Scenario > & baseScenario ()
 Set base scenario, this also defines the asof date.
 
const boost::shared_ptr< Scenario > & baseScenario () const
 Get base scenario.
 
const QuantLib::Calendar & cal () const
 Get calendar.
 
QuantLib::Size mporDays () const
 Get mpor days.
 
bool overlapping () const
 Are scenarios overlapping.
 
const ReturnConfigurationreturnConfiguration () const
 Return configuration.
 
virtual QuantLib::Real scaling (const RiskFactorKey &key, const QuantLib::Real &keyReturn)
 Scaling.
 
boost::shared_ptr< Scenarionext (const QuantLib::Date &d) override
 Return the next scenario for the given date. More...
 
const std::vector< HistoricalScenarioCalculationDetails > & lastHistoricalScenarioCalculationDetails () const
 Return the calculation details of the last generated scenario *‍/.
 
virtual QuantLib::Size numScenarios () const
 Number of scenarios this generator can generate.
 
virtual void setDates ()
 set the start and end dates, can be overwritten in derived class
 
const std::vector< QuantLib::Date > & startDates () const
 start dates from which the scenarios were generated from
 
const std::vector< QuantLib::Date > & endDates () const
 end dates from which the scenarios were generated from
 
const boost::shared_ptr< HistoricalScenarioLoader > & scenarioLoader () const
 Get the HistoricalScenarioLoader.
 
const boost::shared_ptr< ScenarioFactory > & scenarioFactory () const
 Get the ScenarioFactory.
 
const boost::shared_ptr< ore::data::AdjustmentFactors > & adjFactors () const
 Get the adj factors.
 
std::vector< std::pair< QuantLib::Date, QuantLib::Date > > filteredScenarioDates (const ore::data::TimePeriod &period) const
 Get (start, end) scenario date pairs filtered on the given period.
 
const std::string & labelPrefix () const
 Get the scenario label prefix.
 
- Public Member Functions inherited from ScenarioGenerator
virtual ~ScenarioGenerator ()
 Default destructor.
 
virtual boost::shared_ptr< Scenarionext (const Date &d)=0
 Return the next scenario for the given date.
 

Additional Inherited Members

- Protected Member Functions inherited from HistoricalScenarioGenerator
std::pair< boost::shared_ptr< Scenario >, boost::shared_ptr< Scenario > > scenarioPair ()
 The Scenario Pairs for a given index.
 
QuantLib::Real adjustedPrice (RiskFactorKey key, QuantLib::Date d, QuantLib::Real price)
 Returns the adjusted price. More...
 
- Protected Attributes inherited from HistoricalScenarioGenerator
Size i_
 
boost::shared_ptr< HistoricalScenarioLoaderhistoricalScenarioLoader_
 
std::vector< QuantLib::Date > startDates_
 
std::vector< QuantLib::Date > endDates_
 
boost::shared_ptr< ScenarioFactoryscenarioFactory_
 
boost::shared_ptr< ScenariobaseScenario_
 
std::vector< HistoricalScenarioCalculationDetailscalculationDetails_
 
QuantLib::Calendar cal_
 
QuantLib::Size mporDays_
 

Detailed Description

Historical scenario generator generating random scenarios, for testing purposes.

Constructor & Destructor Documentation

◆ HistoricalScenarioGeneratorRandom()

HistoricalScenarioGeneratorRandom ( const boost::shared_ptr< HistoricalScenarioLoader > &  historicalScenarioLoader,
const boost::shared_ptr< ScenarioFactory > &  scenarioFactory,
const QuantLib::Calendar &  cal,
const boost::shared_ptr< ore::data::AdjustmentFactors > &  adjFactors = nullptr,
const QuantLib::Size  mporDays = 10,
const bool  overlapping = true,
const ReturnConfiguration returnConfiguration = ReturnConfiguration() 
)
Parameters
historicalScenarioLoaderHistorical Scenario Loader containing all scenarios
scenarioFactoryScenario factory to use
calCalendar to use
adjFactorsoptional adjustment factors for stock splits etc
mporDaysMPOR days
overlappingoverlapping scenarios
returnConfigurationreturn configuration

Member Function Documentation

◆ reset()

void reset ( )
overridevirtual

Reset the generator so calls to next() return the first scenario.

This allows re-generation of scenarios if required.

Reimplemented from HistoricalScenarioGenerator.