QuantLib_TimeSeries man page

TimeSeries< T, Container > — Container for historical data.


#include <ql/timeseries.hpp>

Public Types

typedef Date key_type

typedef T value_type

Public Member Functions

TimeSeries ()

template<class DateIterator , class ValueIterator > TimeSeries (DateIterator dBegin, DateIterator dEnd, ValueIterator vBegin)

template<class ValueIterator > TimeSeries (const Date &firstDate, ValueIterator begin, ValueIterator end)


Date firstDate () const
returns the first date for which a historical datum exists
Date lastDate () const
returns the last date for which a historical datum exists
Size size () const
returns the number of historical data including null ones
bool empty () const
returns whether the series contains any data

Historical data access

T operator[] (const Date &d) const
returns the (possibly null) datum corresponding to the given date
T & operator[] (const Date &d)


const_iterator find (const Date &)

std::vector< Date > dates () const
returns the dates for which historical data exist
std::vector< T > values () const
returns the historical data


typedef Container::const_iterator const_iterator

typedef const_iterator::iterator_category iterator_category

typedef boost::mpl::if_< boost::mpl::or_< boost::is_same< iterator_category, std::bidirectional_iterator_tag >, boost::is_base_of< std::bidirectional_iterator_tag, iterator_category > >, std::bidirectional_iterator_tag, std::input_iterator_tag >::type enable_reverse

typedef reverse< Container, enable_reverse >::const_reverse_iterator const_reverse_iterator

const_iterator cbegin () const

const_iterator cend () const

const_iterator begin () const

const_iterator end () const

const_reverse_iterator crbegin () const

const_reverse_iterator crend () const

const_reverse_iterator rbegin () const

const_reverse_iterator rend () const

Projection iterators

typedef boost::transform_iterator< projection_time, const_iterator > const_time_iterator

typedef boost::transform_iterator< projection_value, const_iterator > const_value_iterator

typedef boost::transform_iterator< projection_time, const_reverse_iterator > const_reverse_time_iterator

typedef boost::transform_iterator< projection_value, const_reverse_iterator > const_reverse_value_iterator

const_value_iterator cbegin_values () const

const_value_iterator cend_values () const

const_reverse_value_iterator crbegin_values () const

const_reverse_value_iterator crend_values () const

const_time_iterator cbegin_time () const

const_time_iterator cend_time () const

const_reverse_time_iterator crbegin_time () const

const_reverse_time_iterator crend_time () const

Detailed Description

template<class T, class Container = std::map<Date, T>>

class QuantLib::TimeSeries< T, Container >" Container for historical data.

This class acts as a generic repository for a set of historical data. Any single datum can be accessed through its date, while sets of consecutive data can be accessed through iterators.


The Container type must satisfy the requirements set by the C++ standard for associative containers.

Constructor & Destructor Documentation

TimeSeries ()

Default constructor

TimeSeries (DateIterator dBegin, DateIterator dEnd, ValueIterator vBegin)

This constructor initializes the history with a set of values passed as two sequences, the first containing dates and the second containing corresponding values.

TimeSeries (const Date & firstDate, ValueIterator begin, ValueIterator end)

This constructor initializes the history with a set of values. Such values are assigned to a corresponding number of consecutive dates starting from firstDate included.


Generated automatically by Doxygen for QuantLib from the source code.

Referenced By

cbegin(3), cbegin_time(3), cbegin_values(3), cend(3), cend_time(3), cend_values(3), const_reverse_time_iterator(3), const_reverse_value_iterator(3), const_time_iterator(3), crbegin(3), crbegin_time(3), crbegin_values(3), crend(3), crend_time(3), crend_values(3), enable_reverse(3), find(3), firstDate(3), iterator_category(3), key_type(3) and TimeSeries(3) are aliases of QuantLib_TimeSeries(3).

QuantLib Version 1.8.1 Fri Sep 23 2016