dxFeed Graal CXX API v4.0.0
Loading...
Searching...
No Matches
TimeSeriesSubscriptionSymbol Class Referencefinal

Represents subscription to time-series of events. More...

#include <TimeSeriesSubscriptionSymbol.hpp>

+ Inheritance diagram for TimeSeriesSubscriptionSymbol:

Public Member Functions

 TimeSeriesSubscriptionSymbol (const SymbolWrapper &eventSymbol, std::int64_t fromTime)
 Creates time-series subscription symbol with a specified event symbol and subscription time.
 
std::int64_t getFromTime () const
 Returns the subscription time.
 
void * toGraal () const override
 Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
 
std::string toString () const override
 Returns string representation of this time-series subscription symbol.
 
- Public Member Functions inherited from IndexedEventSubscriptionSymbol
 IndexedEventSubscriptionSymbol (const SymbolWrapper &eventSymbol, const IndexedEventSource &source)
 Creates indexed event subscription symbol with a specified event symbol and source.
 
virtual const std::unique_ptr< SymbolWrapper > & getEventSymbol () const
 Returns the wrapped event symbol (CandleSymbol, WildcardSymbol, etc).
 
virtual const std::unique_ptr< IndexedEventSource > & getSource () const
 Returns indexed event source.
 

Static Public Member Functions

static void freeGraal (void *graalNative)
 Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
 
static TimeSeriesSubscriptionSymbol fromGraal (void *graalNative)
 Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure (recursively if necessary).
 

Additional Inherited Members

- Protected Member Functions inherited from IndexedEventSubscriptionSymbol
- Static Protected Member Functions inherited from IndexedEventSubscriptionSymbol
static void freeGraal (void *graalNative)
 Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
 
static IndexedEventSubscriptionSymbol fromGraal (void *graalNative)
 Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure (recursively if necessary).
 

Detailed Description

Represents subscription to time-series of events.

This is symbol is observed by ObservableSubscriptionChangeListener methods symbolsAdded and symbolsRemoved when time-series subscription is created via DXFeedTimeSeriesSubscription class.

Instances of this class can be used with DXFeedSubscription to specify subscription for time series events from a specific time. By default, subscribing to time-series events by their event symbol object, the subscription is performed to a stream of new events as they happen only.

TimeSeriesEvent represents a special subtype of IndexedEvent. The source identifier of a time-series event is always zero and thus

Equality and hash codes

This is a FilteredSubscriptionSymbol. Time-series subscription symbols are compared based on their eventSymbol only. It means, that a set of time-series subscription symbols can contain at most one time-series subscription for each event symbol.

Constructor & Destructor Documentation

◆ TimeSeriesSubscriptionSymbol()

TimeSeriesSubscriptionSymbol::TimeSeriesSubscriptionSymbol ( const SymbolWrapper & eventSymbol,
std::int64_t fromTime )

Creates time-series subscription symbol with a specified event symbol and subscription time.

subscription->addEventListener([](const auto &events) {
for (const auto &e : events) {
if (const auto &q = e->template sharedAs<Quote>()) {
std::cout << q << std::endl;
} else if (const auto &c = e->template sharedAs<Candle>()) {
std::cout << c << std::endl;
}
}
});
auto fromTime = dxfcpp::now();
subscription->addSymbols(
{symbol,
static const EventTypeEnum & TYPE
Type identifier and additional information about the current event class.
Definition Candle.hpp:113
static const EventTypeEnum & TYPE
Type identifier and additional information about the current event class.
Definition Quote.hpp:69
Represents subscription to time-series of events.
Definition TimeSeriesSubscriptionSymbol.hpp:44
std::string toString() const override
Returns string representation of this time-series subscription symbol.
Definition TimeSeriesSubscriptionSymbol.cpp:63
static CandlePeriod valueOf(double value, const CandleType &type) noexcept
Returns candle period with the given value and type.
Definition CandlePeriod.hpp:188
static CandleSymbol valueOf(std::string symbol) noexcept
Converts the given string symbol into the candle symbol object.
Definition CandleSymbol.hpp:291
static const CandleType MINUTE
Certain number of minutes.
Definition CandleType.hpp:13
std::shared_ptr< DXFeedSubscription > createSubscription(const EventTypeEnum &eventType)
Creates new subscription for a single event type that is attached to this feed.
Definition DXFeed.cpp:84
static std::shared_ptr< DXFeed > getInstance()
Returns a default application-wide singleton instance of feed.
Definition DXFeed.cpp:19
Parameters
eventSymbolthe wrapped event symbol (CandleSymbol, WildcardSymbol, etc).
fromTimethe subscription time.

Member Function Documentation

◆ freeGraal()

void TimeSeriesSubscriptionSymbol::freeGraal ( void * graalNative)
static

Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).

Parameters
graalNativeThe pointer to the dxFeed Graal SDK structure.
Exceptions
InvalidArgumentException

References SymbolWrapper::freeGraal().

Referenced by SymbolWrapper::freeGraal().

◆ fromGraal()

TimeSeriesSubscriptionSymbol TimeSeriesSubscriptionSymbol::fromGraal ( void * graalNative)
static

Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure (recursively if necessary).

Parameters
graalNativeThe pointer to the dxFeed Graal SDK structure.
Returns
The object of current type.
Exceptions
InvalidArgumentException

References SymbolWrapper::fromGraal().

Referenced by SymbolWrapper::fromGraal().

◆ getFromTime()

int64_t TimeSeriesSubscriptionSymbol::getFromTime ( ) const

Returns the subscription time.

Returns
the subscription time.

◆ toGraal()

void * TimeSeriesSubscriptionSymbol::toGraal ( ) const
overridevirtual

Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).

Fills the dxFeed Graal SDK structure's fields by the data of the current entity (recursively if necessary). Returns the pointer to the filled structure.

Returns
The pointer to the filled dxFeed Graal SDK structure

Reimplemented from IndexedEventSubscriptionSymbol.

◆ toString()

std::string TimeSeriesSubscriptionSymbol::toString ( ) const
overridevirtual

Returns string representation of this time-series subscription symbol.

Returns
string representation of this time-series subscription symbol.

Reimplemented from IndexedEventSubscriptionSymbol.