Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
FutureExpiryCalculator Class Referenceabstract

Base class for classes that perform date calculations for future contracts. More...

#include <qle/time/futureexpirycalculator.hpp>

+ Collaboration diagram for FutureExpiryCalculator:

Public Member Functions

virtual ~FutureExpiryCalculator ()
 
virtual QuantLib::Date nextExpiry (bool includeExpiry=true, const QuantLib::Date &referenceDate=QuantLib::Date(), QuantLib::Natural offset=0, bool forOption=false)=0
 
virtual QuantLib::Date priorExpiry (bool includeExpiry=true, const QuantLib::Date &referenceDate=QuantLib::Date(), bool forOption=false)=0
 
virtual QuantLib::Date expiryDate (const QuantLib::Date &contractDate, QuantLib::Natural monthOffset=0, bool forOption=false)=0
 
virtual QuantLib::Date contractDate (const QuantLib::Date &expiryDate)=0
 
virtual QuantLib::Date applyFutureMonthOffset (const QuantLib::Date &contractDate, Natural futureMonthOffset)=0
 

Detailed Description

Base class for classes that perform date calculations for future contracts.

Definition at line 32 of file futureexpirycalculator.hpp.

Constructor & Destructor Documentation

◆ ~FutureExpiryCalculator()

virtual ~FutureExpiryCalculator ( )
virtual

Definition at line 34 of file futureexpirycalculator.hpp.

34{}

Member Function Documentation

◆ nextExpiry()

virtual QuantLib::Date nextExpiry ( bool  includeExpiry = true,
const QuantLib::Date &  referenceDate = QuantLib::Date(),
QuantLib::Natural  offset = 0,
bool  forOption = false 
)
pure virtual

Given a reference date, referenceDate, return the expiry date of the next futures contract relative to the reference date.

The includeExpiry parameter controls what happens when the referenceDate is equal to the next contract's expiry date. If includeExpiry is true, the contract's expiry date is returned. If includeExpiry is false, the next succeeding contract's expiry is returned.

If forOption is true, the next expiry for the option contract, as opposed to the future contract, is returned.

◆ priorExpiry()

virtual QuantLib::Date priorExpiry ( bool  includeExpiry = true,
const QuantLib::Date &  referenceDate = QuantLib::Date(),
bool  forOption = false 
)
pure virtual

Given a reference date, referenceDate, return the expiry date of the first futures contract prior to the reference date.

The includeExpiry parameter controls what happens when the referenceDate is equal to the prior contract's expiry date. If includeExpiry is true, the contract's expiry date is returned. If includeExpiry is false, the next preceding contract's expiry is returned.

If forOption is true, the prior expiry for the option contract, as opposed to the future contract, is returned.

◆ expiryDate()

virtual QuantLib::Date expiryDate ( const QuantLib::Date &  contractDate,
QuantLib::Natural  monthOffset = 0,
bool  forOption = false 
)
pure virtual

Given a date, contractDate, return the future expiry date associated with that date.

If the future contract has a frequency that is less than monthly, the next available future contract expiry date will be returned. If forOption is true, the next available future option expiry is returned. For future contracts that have a frequency that is less than monthly, the monthOffset parameter is ignored.

If the future contract has a frequency that is monthly or greater, the contract's month and year is taken to be the contractDate month and year, and the expiry date of the future contract that is monthOffset number of months from that month's future contract is returned. If monthOffset is zero, the expiry date of the future contract associated with that month and year is returned. If forOption is true, the expiry date for the option contract, as opposed to the future contract, is returned.

◆ contractDate()

virtual QuantLib::Date contractDate ( const QuantLib::Date &  expiryDate)
pure virtual

Given a futures (not option) expiry date, return a corresponding contract date

◆ applyFutureMonthOffset()

virtual QuantLib::Date applyFutureMonthOffset ( const QuantLib::Date &  contractDate,
Natural  futureMonthOffset 
)
pure virtual

apply a month offset to a given contract date and return the new contract date if the contract frequency is daily or weekly, the input contract date is not modified