dxFeed Graal CXX API v5.0.0
Loading...
Searching...
No Matches
MarketEvent Struct Reference

Base class for all market events. More...

#include <MarketEvent.hpp>

+ Inheritance diagram for MarketEvent:

Public Types

using Ptr = std::shared_ptr<MarketEvent>
 The alias to a type of shared pointer to the MarketEvent object.
 
- Public Types inherited from EventTypeWithSymbol< std::string >
using Ptr = std::shared_ptr<EventTypeWithSymbol<std::string>>
 The alias to a type of shared pointer to the EventTypeWithSymbol's child object.
 
using Ptr
 The alias to a type of shared pointer to the EventTypeWithSymbol's child object.
 
- Public Types inherited from EventType
using Ptr = std::shared_ptr<EventType>
 The alias to a type of shared pointer to the EventType object.
 
- Public Types inherited from SharedEntity
using Ptr = std::shared_ptr<SharedEntity>
 The alias to a type of shared pointer to the SharedEntity object.
 

Public Member Functions

void assign (std::shared_ptr< EventType > event) override
 Replaces the contents of the event.
 
const std::string & getEventSymbol () const &noexcept override
 Returns a symbol of this event.
 
const std::optional< std::string > & getEventSymbolOpt () const &noexcept override
 Returns a symbol of this event.
 
void setEventSymbol (const StringLike &eventSymbol) noexcept override
 Changes symbol of this event.
 
std::int64_t getEventTime () const noexcept override
 Returns time when an event was created or zero when time is not available.
 
void setEventTime (std::int64_t eventTime) noexcept override
 Changes event creation time.
 
- Public Member Functions inherited from EventTypeWithSymbol< std::string >
virtual void setEventSymbol (const std::string &eventSymbol) noexcept=0
 Changes the event symbol that identifies this event type in subscription.
 
- Public Member Functions inherited from EventType
virtual void * toGraal () const =0
 Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
 
std::string toString () const override
 Returns a string representation of the current object.
 
- Public Member Functions inherited from SharedEntity
template<typename T>
bool is () const noexcept
 Checks that the pointer to the current type could be converted to type T* In other words: whether type T belongs to the type hierarchy in which the current type resides.
 
template<typename T>
std::shared_ptr< T > sharedAs () noexcept
 Returns a pointer to the current object wrapped in a smart pointer to type T.
 
template<typename T>
std::shared_ptr< T > sharedAs () const noexcept
 Returns a pointer to the current object wrapped in a smart pointer to type T.
 
- Public Member Functions inherited from Entity
virtual ~Entity () noexcept=default
 The default virtual d-tor.
 

Protected Member Functions

 MarketEvent (const StringLike &eventSymbol) noexcept
 Protected constructor for concrete implementation classes that initializes eventSymbol property.
 

Detailed Description

Base class for all market events.

All market events are POCO that extend this class. Market event classes are simple beans with setter and getter methods for their properties and minimal business logic. All market events have eventSymbol property defined by this class.

Constructor & Destructor Documentation

◆ MarketEvent()

DXFCPP_BEGIN_NAMESPACE MarketEvent::MarketEvent ( const StringLike & eventSymbol)
explicitprotectednoexcept

Protected constructor for concrete implementation classes that initializes eventSymbol property.

Parameters
eventSymbolThe event symbol.

Referenced by Greeks::Greeks(), OptionSale::OptionSale(), OrderBase::OrderBase(), Profile::Profile(), Quote::Quote(), Series::Series(), Summary::Summary(), TheoPrice::TheoPrice(), TimeAndSale::TimeAndSale(), TradeBase::TradeBase(), and Underlying::Underlying().

Member Function Documentation

◆ assign()

void MarketEvent::assign ( std::shared_ptr< EventType > event)
overridevirtual

◆ getEventSymbol()

const std::string & MarketEvent::getEventSymbol ( ) const &
overridevirtualnoexcept

Returns a symbol of this event.

Returns
symbol of this event or dxfcpp::String::NUL (std::string{"<null>"})

Implements EventTypeWithSymbol< std::string >.

◆ getEventSymbolOpt()

const std::optional< std::string > & MarketEvent::getEventSymbolOpt ( ) const &
overridevirtualnoexcept

Returns a symbol of this event.

Returns
symbol of this event or std::nullopt.

Implements EventTypeWithSymbol< std::string >.

◆ getEventTime()

std::int64_t MarketEvent::getEventTime ( ) const
overridevirtualnoexcept

Returns time when an event was created or zero when time is not available.

This event time is available only when the corresponding DXEndpoint is created with DXENDPOINT_EVENT_TIME_PROPERTY and the data source has embedded event times. This is typically true only for data events that are read from historical tape files and from OnDemandService. Events that are coming from network connections do not have an embedded event time information, and this method will return zero for them, meaning that event was received just now.

The default implementation returns 0.

Returns
The difference, measured in milliseconds, between the event creation time and midnight, January 1, 1970 UTC or zero when time is not available.

Reimplemented from EventType.

◆ setEventSymbol()

void MarketEvent::setEventSymbol ( const StringLike & eventSymbol)
overridevirtualnoexcept

Changes symbol of this event.

Parameters
eventSymbolThe symbol of this event.

Implements EventTypeWithSymbol< std::string >.

Referenced by OptionSale::withEventSymbol(), Order::withEventSymbol(), Quote::withEventSymbol(), Series::withEventSymbol(), and SpreadOrder::withEventSymbol().

◆ setEventTime()

void MarketEvent::setEventTime ( std::int64_t )
overridevirtualnoexcept

Changes event creation time.

The default implementation does nothing.

Parameters
eventTimethe difference, measured in milliseconds, between the event creation time and midnight, January 1, 1970 UTC.

Reimplemented from EventType.

Referenced by OptionSale::withEventTime(), Order::withEventTime(), Quote::withEventTime(), Series::withEventTime(), and SpreadOrder::withEventTime().