dxFeed Graal CXX API
Loading...
Searching...
No Matches
SessionFilter Struct Reference

A filter for sessions used by various search methods. More...

#include <SessionFilter.hpp>

Public Member Functions

 SessionFilter (SessionFilterEnum code, std::string name, std::optional< SessionType > type, std::optional< bool > trading) noexcept
 Creates filter with specified type and trading flag conditions.
 
template<typename Session >
bool accept (Session session) const noexcept
 Tests whether or not the specified session is an acceptable result.
 

Static Public Attributes

static const SessionFilter ANY {SessionFilterEnum::ANY, "ANY", std::nullopt, std::nullopt}
 Accepts any session - useful for pure schedule navigation.
 
static const SessionFilter TRADING {SessionFilterEnum::TRADING, "TRADING", std::nullopt, true}
 Accepts trading sessions only - those with (Session::isTrading() == true).
 
static const SessionFilter NON_TRADING {SessionFilterEnum::NON_TRADING, "NON_TRADING", std::nullopt, false}
 Accepts non-trading sessions only - those with (Session::isTrading() == false).
 
static const SessionFilter NO_TRADING
 Accepts any session with type SessionType::NO_TRADING.
 
static const SessionFilter PRE_MARKET
 Accepts any session with type SessionType::PRE_MARKET.
 
static const SessionFilter REGULAR {SessionFilterEnum::REGULAR, "REGULAR", SessionType::REGULAR, std::nullopt}
 Accepts any session with type SessionType::REGULAR.
 
static const SessionFilter AFTER_MARKET
 Accepts any session with type SessionType::AFTER_MARKET.
 

Protected Attributes

std::optional< SessionTypetype_
 Required type, std::nullopt if not relevant.
 
std::optional< bool > trading_
 Required trading flag, std::nullopt if not relevant.
 

Friends

struct Session
 
struct Schedule
 
struct Day
 

Detailed Description

A filter for sessions used by various search methods.

This class provides predefined filters for certain Session attributes, although users can create their own filters to suit their needs.

Please note that sessions can be either trading or non-trading, and this distinction can be either based on rules (e.g. weekends) or dictated by special occasions (e.g. holidays). Different filters treat this distinction differently - some accept only trading sessions, some only non-trading, and some ignore type of session altogether.

Constructor & Destructor Documentation

◆ SessionFilter()

SessionFilter::SessionFilter ( SessionFilterEnum code,
std::string name,
std::optional< SessionType > type,
std::optional< bool > trading )
noexcept

Creates filter with specified type and trading flag conditions.

Both parameters specify what value corresponding attributes should have. If some parameter is std::nullopt then corresponding attribute is ignored (any value is accepted).

Parameters
codeThe enum code
nameThe enum name
typerequired type, std::nullopt if not relevant
tradingrequired trading flag, std::nullopt if not relevant

Member Function Documentation

◆ accept()

template<typename Session >
bool SessionFilter::accept ( Session session) const
inlinenoexcept

Tests whether or not the specified session is an acceptable result.

Parameters
sessionthe session to be tested
Returns
true if specified session is accepted