Logo
Reference manual - version ored_version
Public Member Functions | List of all members
DateGrid Class Reference

Simulation Date Grid. More...

#include <ored/utilities/dategrid.hpp>

Public Member Functions

 DateGrid ()
 Build a date grid with a single date equal to Settings::instance().evaluationDate()
 
 DateGrid (const std::string &grid, const QuantLib::Calendar &gridCalendar=QuantLib::TARGET(), const QuantLib::DayCounter &dayCounter=QuantLib::ActualActual(QuantLib::ActualActual::ISDA))
 
 DateGrid (const std::vector< QuantLib::Period > &tenors, const QuantLib::Calendar &gridCalendar=QuantLib::TARGET(), const QuantLib::DayCounter &dayCounter=QuantLib::ActualActual(QuantLib::ActualActual::ISDA))
 Build a date grid from the given vector of tenors.
 
 DateGrid (const std::vector< QuantLib::Date > &dates, const QuantLib::Calendar &gridCalendar=QuantLib::TARGET(), const QuantLib::DayCounter &dayCounter=QuantLib::ActualActual(QuantLib::ActualActual::ISDA))
 Build a date grid from an explicit set of dates, sorted in ascending order.
 
QuantLib::Size size () const
 The size of the date grid.
 
void truncate (const QuantLib::Date &d, bool overrun=true)
 Truncate the grid up to the given date. More...
 
void truncate (QuantLib::Size length)
 Truncate the grid to the given length.
 
void addCloseOutDates (const QuantLib::Period &p=QuantLib::Period(2, QuantLib::Weeks))
 

Inspectors

const std::vector< QuantLib::Period > & tenors () const
 
const std::vector< QuantLib::Date > & dates () const
 
const std::vector< bool > & isValuationDate () const
 
const std::vector< bool > & isCloseOutDate () const
 
std::vector< QuantLib::Date > valuationDates () const
 
std::vector< QuantLib::Date > closeOutDates () const
 
const QuantLib::Calendar & calendar () const
 
const QuantLib::DayCounter & dayCounter () const
 
const std::vector< QuantLib::Time > & times () const
 Returns the times from Settings::instance().evaluationDate to each Date using the day counter.
 
const QuantLib::TimeGrid & timeGrid () const
 Returns the time grid associated with the vector of times (plus t=0)
 
QuantLib::TimeGrid valuationTimeGrid () const
 Returns the time grid associated with the vector of valuation times (plus t=0)
 
QuantLib::TimeGrid closeOutTimeGrid () const
 Returns the time grid associated with the vector of close-out times (plus t=0)
 
const QuantLib::Date & operator[] (QuantLib::Size i) const
 Accessor methods.
 

Detailed Description

Simulation Date Grid.

Utility for building a simulation date grid.

Constructor & Destructor Documentation

◆ DateGrid()

DateGrid ( const std::string &  grid,
const QuantLib::Calendar &  gridCalendar = QuantLib::TARGET(),
const QuantLib::DayCounter &  dayCounter = QuantLib::ActualActual(QuantLib::ActualActual::ISDA) 
)

Build a date grid from a string which can be of the form 40,1M or 1D,2D,1W,2W,3Y,5Y or a fixed name (ALPHA, BETA) indicating a hard coded grid structure

Member Function Documentation

◆ truncate()

void truncate ( const QuantLib::Date &  d,
bool  overrun = true 
)

Truncate the grid up to the given date.

If overrun is true, we make sure the last date in the grid is greater than the portfolio maturity, even though every scenario portfolio NPV will be 0 at this point we may need the market data. If overrun is false, the last date in the grid is the last date where the portfolio is live.

◆ addCloseOutDates()

void addCloseOutDates ( const QuantLib::Period &  p = QuantLib::Period(2, QuantLib::Weeks))

Add close out dates. If 0D is given, the valuation dates itself are treated as close out dates. The first date is a valuation date only and the last date is a close out date only then, all other dates are both valuation and close out dates.