dxFeed Graal CXX API
Loading...
Searching...
No Matches
dxfcpp::TradeBase Class Reference

Base class for common fields of Trade} and TradeETH events. More...

#include <TradeBase.hpp>

+ Inheritance diagram for dxfcpp::TradeBase:

Public Member Functions

 TradeBase () noexcept=default
 Creates new trade event with default values.
 
 TradeBase (std::string eventSymbol) noexcept
 Creates new trade event with the specified event symbol.
 
std::int64_t getTimeSequence () const noexcept
 Returns time and sequence of last trade packaged into single long value.
 
void setTimeSequence (std::int64_t timeSequence) noexcept
 Changes time and sequence of last trade.
 
std::int64_t getTime () const noexcept
 Returns time of the last trade.
 
void setTime (std::int64_t time) noexcept
 Changes time of the last trade.
 
std::int64_t getTimeNanos () const noexcept
 Returns time of the last trade in nanoseconds.
 
void setTimeNanos (std::int64_t timeNanos) noexcept
 Changes time of the last trade.
 
void setTimeNanoPart (std::int32_t timeNanoPart) noexcept
 Changes microseconds and nanoseconds time part of the last trade.
 
std::int32_t getTimeNanoPart () const noexcept
 Returns microseconds and nanoseconds time part of the last trade.
 
std::int32_t getSequence () const noexcept
 Returns sequence number of the last trade to distinguish trades that have the same time.
 
void setSequence (std::int32_t sequence) noexcept
 Changes sequence number of the last trade.
 
std::int16_t getExchangeCode () const noexcept
 Returns exchange code of the last trade.
 
std::string getExchangeCodeString () const noexcept
 Returns exchange code of last trade as UTF8 string.
 
void setExchangeCode (char exchangeCode) noexcept
 Changes exchange code of the last trade.
 
void setExchangeCode (std::int16_t exchangeCode) noexcept
 Changes exchange code of the last trade.
 
double getPrice () const noexcept
 Returns price of the last trade.
 
void setPrice (double price) noexcept
 Changes price of the last trade.
 
double getSize () const noexcept
 Returns size of the last trade as floating number with fractions.
 
void setSize (double size) noexcept
 Changes size of the last trade as floating number with fractions.
 
std::int32_t getDayId () const noexcept
 Returns identifier of the current trading day.
 
void setDayId (std::int32_t dayId) noexcept
 Changes identifier of the current trading day.
 
double getDayVolume () const noexcept
 Returns total volume traded for a day as floating number with fractions.
 
void setDayVolume (double dayVolume) noexcept
 Changes total volume traded for a day as floating number with fractions.
 
double getDayTurnover () const noexcept
 Returns total turnover traded for a day.
 
void setDayTurnover (double dayTurnover) noexcept
 Changes total turnover traded for a day.
 
const DirectiongetTickDirection () const &noexcept
 Returns tick direction of the last trade.
 
void setTickDirection (const Direction &direction) noexcept
 Changes tick direction of the last trade.
 
bool isExtendedTradingHours () const noexcept
 Returns whether last trade was in extended trading hours.
 
void setExtendedTradingHours (bool extendedTradingHours) noexcept
 Changes whether last trade was in extended trading hours.
 
double getChange () const noexcept
 Returns change of the last trade.
 
void setChange (double change) noexcept
 Changes change of the last trade.
 
std::string baseFieldsToString () const noexcept
 Returns string representation of this trade event's fields.
 
- Public Member Functions inherited from dxfcpp::MarketEvent
const std::string & getEventSymbol () const &noexcept override
 Returns symbol of this event.
 
const std::optional< std::string > & getEventSymbolOpt () const &noexcept override
 Returns symbol of this event.
 
void setEventSymbol (const std::string &eventSymbol) noexcept override
 Changes symbol of this event.
 
std::int64_t getEventTime () const noexcept override
 Returns time when 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 dxfcpp::EventType
virtual voidtoGraal () const noexcept=0
 Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
 
std::string toString () const noexcept override
 Returns a string representation of the current object.
 
- Public Member Functions inherited from dxfcpp::SharedEntity
template<typename T >
bool is () const noexcept
 Checks that 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 dxfcpp::Entity
virtual ~Entity () noexcept=default
 The default virtual d-tor.
 

Static Public Attributes

static constexpr std::uint32_t MAX_SEQUENCE = (1U << 22U) - 1U
 Maximum allowed sequence value.
 

Additional Inherited Members

- Public Types inherited from dxfcpp::MarketEvent
using Ptr = std::shared_ptr<MarketEvent>
 The alias to a type of shared pointer to the MarketEvent object.
 
- Public Types inherited from dxfcpp::EventTypeWithSymbol< std::string >
using Ptr
 The alias to a type of shared pointer to the EventTypeWithSymbol's child object.
 
- Public Types inherited from dxfcpp::EventType
using Ptr = std::shared_ptr<EventType>
 The alias to a type of shared pointer to the EventType object.
 
- Public Types inherited from dxfcpp::SharedEntity
using Ptr = std::shared_ptr<SharedEntity>
 The alias to a type of shared pointer to the SharedEntity object.
 
- Public Types inherited from dxfcpp::LastingEvent
using Ptr = std::shared_ptr<LastingEvent>
 The alias to a type of shared pointer to the LastingEvent object.
 
- Protected Member Functions inherited from dxfcpp::MarketEvent
 MarketEvent (std::string eventSymbol) noexcept
 Protected constructor for concrete implementation classes that initializes eventSymbol property.
 

Detailed Description

Base class for common fields of Trade} and TradeETH events.

Trade events represent the most recent information that is available about the last trade on the market at any given moment of time.

Trade event represents last trade information for regular trading hours (RTH) with an official volume and turnover for the whole trading day identified by dayId field.

TradeETH event is defined only for symbols (typically stocks and ETFs) with a designated extended trading hours (ETH, pre market and post market trading sessions). It represents last trade price during ETH and also accumulated volume and turnover during ETH for current trading day.

Constructor & Destructor Documentation

◆ TradeBase()

dxfcpp::TradeBase::TradeBase ( std::string eventSymbol)
inlineexplicitnoexcept

Creates new trade event with the specified event symbol.

Parameters
eventSymbolThe event symbol.

Member Function Documentation

◆ baseFieldsToString()

std::string dxfcpp::TradeBase::baseFieldsToString ( ) const
noexcept

Returns string representation of this trade event's fields.

Returns
string representation of this trade event's fields.

◆ getChange()

double dxfcpp::TradeBase::getChange ( ) const
inlinenoexcept

Returns change of the last trade.

Returns
change of the last trade.

◆ getDayId()

std::int32_t dxfcpp::TradeBase::getDayId ( ) const
inlinenoexcept

Returns identifier of the current trading day.

Identifier of the day is the number of days passed since January 1, 1970.

Returns
identifier of the current trading day.

◆ getDayTurnover()

double dxfcpp::TradeBase::getDayTurnover ( ) const
inlinenoexcept

Returns total turnover traded for a day.

Day VWAP can be computed with getDayTurnover() / getDayVolume().

Returns
total turnover traded for a day.

◆ getDayVolume()

double dxfcpp::TradeBase::getDayVolume ( ) const
inlinenoexcept

Returns total volume traded for a day as floating number with fractions.

Returns
total volume traded for a day as floating number with fractions.

◆ getExchangeCode()

std::int16_t dxfcpp::TradeBase::getExchangeCode ( ) const
inlinenoexcept

Returns exchange code of the last trade.

Returns
exchange code of the last trade.

◆ getExchangeCodeString()

std::string dxfcpp::TradeBase::getExchangeCodeString ( ) const
inlinenoexcept

Returns exchange code of last trade as UTF8 string.

Returns
exchange code of last trade as UTF8 string.

◆ getPrice()

double dxfcpp::TradeBase::getPrice ( ) const
inlinenoexcept

Returns price of the last trade.

Returns
price of the last trade.

◆ getSequence()

std::int32_t dxfcpp::TradeBase::getSequence ( ) const
inlinenoexcept

Returns sequence number of the last trade to distinguish trades that have the same time.

This sequence number does not have to be unique and does not need to be sequential. Sequence can range from 0 to TradeBase::MAX_SEQUENCE.

Returns
sequence of the last trade.

◆ getSize()

double dxfcpp::TradeBase::getSize ( ) const
inlinenoexcept

Returns size of the last trade as floating number with fractions.

Returns
size of the last trade as floating number with fractions.

◆ getTickDirection()

const Direction & dxfcpp::TradeBase::getTickDirection ( ) const &
inlinenoexcept

Returns tick direction of the last trade.

Returns
tick direction of the last trade.

◆ getTime()

std::int64_t dxfcpp::TradeBase::getTime ( ) const
inlinenoexcept

Returns time of the last trade.

Time is measured in milliseconds between the current time and midnight, January 1, 1970 UTC.

Returns
time of the last trade.

◆ getTimeNanoPart()

std::int32_t dxfcpp::TradeBase::getTimeNanoPart ( ) const
inlinenoexcept

Returns microseconds and nanoseconds time part of the last trade.

Returns
microseconds and nanoseconds time part of the last trade.

◆ getTimeNanos()

std::int64_t dxfcpp::TradeBase::getTimeNanos ( ) const
inlinenoexcept

Returns time of the last trade in nanoseconds.

Time is measured in nanoseconds between the current time and midnight, January 1, 1970 UTC.

Returns
time of the last trade in nanoseconds.

◆ getTimeSequence()

std::int64_t dxfcpp::TradeBase::getTimeSequence ( ) const
inlinenoexcept

Returns time and sequence of last trade packaged into single long value.

Returns
time and sequence of last trade.

◆ isExtendedTradingHours()

bool dxfcpp::TradeBase::isExtendedTradingHours ( ) const
inlinenoexcept

Returns whether last trade was in extended trading hours.

Returns
true if last trade was in extended trading hours.

◆ setChange()

void dxfcpp::TradeBase::setChange ( double change)
inlinenoexcept

Changes change of the last trade.

Parameters
changeprice of the last trade.

◆ setDayId()

void dxfcpp::TradeBase::setDayId ( std::int32_t dayId)
inlinenoexcept

Changes identifier of the current trading day.

Identifier of the day is the number of days passed since January 1, 1970.

Parameters
dayIdidentifier of the current trading day.

◆ setDayTurnover()

void dxfcpp::TradeBase::setDayTurnover ( double dayTurnover)
inlinenoexcept

Changes total turnover traded for a day.

Parameters
dayTurnovertotal turnover traded for a day.

◆ setDayVolume()

void dxfcpp::TradeBase::setDayVolume ( double dayVolume)
inlinenoexcept

Changes total volume traded for a day as floating number with fractions.

Parameters
dayVolumetotal volume traded for a day as floating number with fractions.

◆ setExchangeCode() [1/2]

void dxfcpp::TradeBase::setExchangeCode ( char exchangeCode)
inlinenoexcept

Changes exchange code of the last trade.

Parameters
exchangeCodeexchange code of the last trade.

◆ setExchangeCode() [2/2]

void dxfcpp::TradeBase::setExchangeCode ( std::int16_t exchangeCode)
inlinenoexcept

Changes exchange code of the last trade.

Parameters
exchangeCodeexchange code of the last trade.

◆ setExtendedTradingHours()

void dxfcpp::TradeBase::setExtendedTradingHours ( bool extendedTradingHours)
inlinenoexcept

Changes whether last trade was in extended trading hours.

Parameters
extendedTradingHourstrue if last trade was in extended trading hours.

◆ setPrice()

void dxfcpp::TradeBase::setPrice ( double price)
inlinenoexcept

Changes price of the last trade.

Parameters
priceprice of the last trade.

◆ setSequence()

void dxfcpp::TradeBase::setSequence ( std::int32_t sequence)
inlinenoexcept

Changes sequence number of the last trade.

Parameters
sequencethe sequence.
See also
TradeBase::getSequence()

◆ setSize()

void dxfcpp::TradeBase::setSize ( double size)
inlinenoexcept

Changes size of the last trade as floating number with fractions.

Parameters
sizesize of the last trade as floating number with fractions.

◆ setTickDirection()

void dxfcpp::TradeBase::setTickDirection ( const Direction & direction)
inlinenoexcept

Changes tick direction of the last trade.

Parameters
directiontick direction of the last trade.

◆ setTime()

void dxfcpp::TradeBase::setTime ( std::int64_t time)
inlinenoexcept

Changes time of the last trade.

Time is measured in milliseconds between the current time and midnight, January 1, 1970 UTC.

Parameters
timetime of the last trade.

◆ setTimeNanoPart()

void dxfcpp::TradeBase::setTimeNanoPart ( std::int32_t timeNanoPart)
inlinenoexcept

Changes microseconds and nanoseconds time part of the last trade.

Parameters
timeNanoPartmicroseconds and nanoseconds time part of the last trade.

◆ setTimeNanos()

void dxfcpp::TradeBase::setTimeNanos ( std::int64_t timeNanos)
inlinenoexcept

Changes time of the last trade.

Time is measured in nanoseconds between the current time and midnight, January 1, 1970 UTC.

Parameters
timeNanostime of the last trade in nanoseconds.

◆ setTimeSequence()

void dxfcpp::TradeBase::setTimeSequence ( std::int64_t timeSequence)
inlinenoexcept

Changes time and sequence of last trade.

Do not use this method directly. Change time and/or sequence.

Parameters
timeSequencethe time and sequence.
See also
TradeBase::getTimeSequence()

Member Data Documentation

◆ MAX_SEQUENCE

constexpr std::uint32_t dxfcpp::TradeBase::MAX_SEQUENCE = (1U << 22U) - 1U
staticconstexpr

Maximum allowed sequence value.

See also
TradeBase::setSequence()