dxFeed Graal CXX API
Loading...
Searching...
No Matches
Quote Class Referencefinal

Quote event is a snapshot of the best bid and ask prices, and other fields that change with each quote. More...

#include <Quote.hpp>

+ Inheritance diagram for Quote:

Public Types

using Ptr = std::shared_ptr<Quote>
 The alias to a type of shared pointer to the Quote object.
 
using Unique = std::unique_ptr<Quote>
 The alias to a type of unique pointer to the Quote object.
 
- Public Types inherited from MarketEvent
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
 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 Types inherited from LastingEvent
using Ptr = std::shared_ptr<LastingEvent>
 The alias to a type of shared pointer to the LastingEvent object.
 

Public Member Functions

void * toGraal () const override
 Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
 
 Quote () noexcept=default
 Creates new quote event with default values.
 
 Quote (std::string eventSymbol) noexcept
 Creates new quote event with the specified event symbol.
 
QuotewithEventSymbol (const std::string &eventSymbol) noexcept
 Changes event's symbol and returns the current quote.
 
QuotewithEventTime (std::int64_t eventTime) noexcept
 Changes event's creation time and returns the current quote.
 
std::int32_t getSequence () const noexcept
 Returns sequence number of this quote to distinguish quotes that have the same time.
 
void setSequence (std::int32_t sequence)
 Changes sequence number of this quote.
 
QuotewithSequence (std::int32_t sequence) noexcept
 Changes sequence number of this quote and returns the current quote.
 
std::int64_t getTime () const noexcept
 Returns time of the last bid or ask change.
 
std::int64_t getTimeNanos () const noexcept
 Returns time of the last bid or ask change in nanoseconds.
 
std::int32_t getTimeNanoPart () const noexcept
 Returns microseconds and nanoseconds part of time of the last bid or ask change.
 
void setTimeNanoPart (std::int32_t timeNanoPart) noexcept
 Changes microseconds and nanoseconds part of time of the last bid or ask change.
 
QuotewithTimeNanoPart (std::int32_t timeNanoPart) noexcept
 Changes microseconds and nanoseconds part of time of the last bid or ask change and returns the current quote.
 
std::int64_t getBidTime () const noexcept
 Returns time of the last bid change.
 
void setBidTime (std::int64_t bidTime) noexcept
 Changes time of the last bid change.
 
QuotewithBidTime (std::int64_t bidTime) noexcept
 Changes time of the last bid change and returns the current quote.
 
std::int16_t getBidExchangeCode () const noexcept
 Returns bid exchange code.
 
std::string getBidExchangeCodeString () const noexcept
 Returns bid exchange code as UTF8 string.
 
void setBidExchangeCode (char bidExchangeCode) noexcept
 Changes bid exchange code.
 
QuotewithBidExchangeCode (char bidExchangeCode) noexcept
 Changes bid exchange code and returns the current quote.
 
void setBidExchangeCode (std::int16_t bidExchangeCode) noexcept
 Changes bid exchange code.
 
QuotewithBidExchangeCode (std::int16_t bidExchangeCode) noexcept
 Changes bid exchange code and returns the current quote.
 
double getBidPrice () const noexcept
 Returns bid price.
 
void setBidPrice (double bidPrice) noexcept
 Changes bid price.
 
QuotewithBidPrice (double bidPrice) noexcept
 Changes bid price and returns the current quote.
 
double getBidSize () const noexcept
 Returns bid size.
 
void setBidSize (double bidSize) noexcept
 Changes bid size.
 
QuotewithBidSize (double bidSize) noexcept
 Changes bid size and returns the current quote.
 
std::int64_t getAskTime () const noexcept
 Returns time of the last ask change.
 
void setAskTime (std::int64_t askTime) noexcept
 Changes time of the last ask change.
 
QuotewithAskTime (std::int64_t askTime) noexcept
 Changes time of the last ask change and returns the current quote.
 
std::int16_t getAskExchangeCode () const noexcept
 Returns ask exchange code.
 
std::string getAskExchangeCodeString () const noexcept
 Returns ask exchange code as UTF8 string.
 
void setAskExchangeCode (char askExchangeCode) noexcept
 Changes ask exchange code.
 
QuotewithAskExchangeCode (char askExchangeCode) noexcept
 Changes ask exchange code and returns the current quote.
 
void setAskExchangeCode (std::int16_t askExchangeCode) noexcept
 Changes ask exchange code.
 
QuotewithAskExchangeCode (std::int16_t askExchangeCode) noexcept
 Changes ask exchange code and returns the current quote.
 
double getAskPrice () const
 Returns ask price.
 
void setAskPrice (double askPrice)
 Changes ask price.
 
QuotewithAskPrice (double askPrice) noexcept
 Changes ask price and returns the current quote.
 
double getAskSize () const
 Returns ask size.
 
void setAskSize (double askSize)
 Changes ask size.
 
QuotewithAskSize (double askSize) noexcept
 Changes ask size and returns the current quote.
 
std::string toString () const noexcept override
 Returns a string representation of the current object.
 
- Public Member Functions inherited from 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 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 Entity
virtual ~Entity () noexcept=default
 The default virtual d-tor.
 

Static Public Member Functions

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

Static Public Attributes

static const EventTypeEnumTYPE = EventTypeEnum::QUOTE
 Type identifier and additional information about the current event class.
 
static constexpr std::uint32_t MAX_SEQUENCE = (1U << 22U) - 1U
 Maximum allowed sequence value.
 

Additional Inherited Members

- Protected Member Functions inherited from MarketEvent
 MarketEvent (std::string eventSymbol) noexcept
 Protected constructor for concrete implementation classes that initializes eventSymbol property.
 

Detailed Description

Quote event is a snapshot of the best bid and ask prices, and other fields that change with each quote.

It represents the most recent information that is available about the best quote on the market at any given moment of time.

Bid corresponds to the best (maximal price) order to buy, ask corresponds to the best (minimal price) order to sell.

Constructor & Destructor Documentation

◆ Quote()

Quote::Quote ( std::string eventSymbol)
inlineexplicitnoexcept

Creates new quote event with the specified event symbol.

Parameters
eventSymbolThe event symbol.

Member Function Documentation

◆ freeGraal()

void Quote::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.

◆ fromGraal()

std::shared_ptr< Quote > Quote::fromGraal ( void * graalNative)
static

Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.

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

◆ getAskExchangeCode()

std::int16_t Quote::getAskExchangeCode ( ) const
noexcept

Returns ask exchange code.

Returns
The ask exchange code.

◆ getAskExchangeCodeString()

std::string Quote::getAskExchangeCodeString ( ) const
noexcept

Returns ask exchange code as UTF8 string.

Returns
The ask exchange code as UTF8 string.

◆ getAskPrice()

double Quote::getAskPrice ( ) const
inline

Returns ask price.

Returns
The ask price.

◆ getAskSize()

double Quote::getAskSize ( ) const
inline

Returns ask size.

Returns
The ask size

◆ getAskTime()

std::int64_t Quote::getAskTime ( ) const
inlinenoexcept

Returns time of the last ask change.

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

This time is always transmitted with seconds precision, so the result of this method is usually a multiple of 1000.

Returns
The time of the last ask change.

◆ getBidExchangeCode()

std::int16_t Quote::getBidExchangeCode ( ) const
noexcept

Returns bid exchange code.

Returns
The bid exchange code.

◆ getBidExchangeCodeString()

std::string Quote::getBidExchangeCodeString ( ) const
noexcept

Returns bid exchange code as UTF8 string.

Returns
The bid exchange code as UTF8 string.

◆ getBidPrice()

double Quote::getBidPrice ( ) const
inlinenoexcept

Returns bid price.

Returns
The bid price.

◆ getBidSize()

double Quote::getBidSize ( ) const
inlinenoexcept

Returns bid size.

Returns
The bid size

◆ getBidTime()

std::int64_t Quote::getBidTime ( ) const
inlinenoexcept

Returns time of the last bid change.

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

This time is always transmitted with seconds precision, so the result of this method is usually a multiple of 1000.

Returns
The time of the last bid change.

◆ getSequence()

std::int32_t Quote::getSequence ( ) const
inlinenoexcept

Returns sequence number of this quote to distinguish quotes 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 Quote::MAX_SEQUENCE.

Returns
sequence of this quote.

References MAX_SEQUENCE.

◆ getTime()

std::int64_t Quote::getTime ( ) const
inlinenoexcept

Returns time of the last bid or ask change.

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

Returns
The time of the last bid or ask change.

Referenced by getTimeNanos().

◆ getTimeNanoPart()

std::int32_t Quote::getTimeNanoPart ( ) const
inlinenoexcept

Returns microseconds and nanoseconds part of time of the last bid or ask change.

Returns
The microseconds and nanoseconds part of time of the last bid or ask change.

◆ getTimeNanos()

std::int64_t Quote::getTimeNanos ( ) const
inlinenoexcept

Returns time of the last bid or ask change in nanoseconds.

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

Returns
The time of the last bid or ask change in nanoseconds.

References getTime().

◆ setAskExchangeCode() [1/2]

void Quote::setAskExchangeCode ( char askExchangeCode)
noexcept

Changes ask exchange code.

Parameters
askExchangeCodeThe ask exchange code.

Referenced by withAskExchangeCode().

◆ setAskExchangeCode() [2/2]

void Quote::setAskExchangeCode ( std::int16_t askExchangeCode)
noexcept

Changes ask exchange code.

Parameters
askExchangeCodeThe ask exchange code.

Referenced by withAskExchangeCode().

◆ setAskPrice()

void Quote::setAskPrice ( double askPrice)
inline

Changes ask price.

Parameters
askPriceThe ask price.

Referenced by withAskPrice().

◆ setAskSize()

void Quote::setAskSize ( double askSize)
inline

Changes ask size.

Parameters
askSizeThe ask size.

Referenced by withAskSize().

◆ setAskTime()

void Quote::setAskTime ( std::int64_t askTime)
inlinenoexcept

Changes time of the last ask change.

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

You can set the actual millisecond-precision time here to publish event and the millisecond part will make the Quote::getTime() of this quote even precise up to a millisecond.

Parameters
askTimeThe time of the last ask change.

Referenced by withAskTime().

◆ setBidExchangeCode() [1/2]

void Quote::setBidExchangeCode ( char bidExchangeCode)
noexcept

Changes bid exchange code.

Parameters
bidExchangeCodeThe bid exchange code.

Referenced by withBidExchangeCode().

◆ setBidExchangeCode() [2/2]

void Quote::setBidExchangeCode ( std::int16_t bidExchangeCode)
noexcept

Changes bid exchange code.

Parameters
bidExchangeCodebid exchange code.

Referenced by withBidExchangeCode().

◆ setBidPrice()

void Quote::setBidPrice ( double bidPrice)
inlinenoexcept

Changes bid price.

Parameters
bidPriceThe bid price.

Referenced by withBidPrice().

◆ setBidSize()

void Quote::setBidSize ( double bidSize)
inlinenoexcept

Changes bid size.

Parameters
bidSizeThe bid size.

Referenced by withBidSize().

◆ setBidTime()

void Quote::setBidTime ( std::int64_t bidTime)
inlinenoexcept

Changes time of the last bid change.

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

You can set the actual millisecond-precision time here to publish event and the millisecond part will make the Quote::getTime() of this quote even precise up to a millisecond.

Parameters
bidTimeThe time of the last bid change.

Referenced by withBidTime().

◆ setSequence()

void Quote::setSequence ( std::int32_t sequence)
inline

Changes sequence number of this quote.

Parameters
sequenceThe sequence.
See also
Quote::getSequence()

References MAX_SEQUENCE.

Referenced by withSequence().

◆ setTimeNanoPart()

void Quote::setTimeNanoPart ( std::int32_t timeNanoPart)
inlinenoexcept

Changes microseconds and nanoseconds part of time of the last bid or ask change.

This method changes Quote::getTimeNanos() result.

Parameters
timeNanoPartThe microseconds and nanoseconds part of time of the last bid or ask change.

Referenced by withTimeNanoPart().

◆ toGraal()

void * Quote::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

Implements EventType.

◆ toString()

std::string Quote::toString ( ) const
overridevirtualnoexcept

Returns a string representation of the current object.

Returns
A string representation.

Reimplemented from EventType.

◆ withAskExchangeCode() [1/2]

Quote & Quote::withAskExchangeCode ( char askExchangeCode)
inlinenoexcept

Changes ask exchange code and returns the current quote.

Parameters
askExchangeCodeThe ask exchange code.
Returns
The current quote

References setAskExchangeCode().

◆ withAskExchangeCode() [2/2]

Quote & Quote::withAskExchangeCode ( std::int16_t askExchangeCode)
inlinenoexcept

Changes ask exchange code and returns the current quote.

Parameters
askExchangeCodeThe ask exchange code.
Returns
The current quote.

References setAskExchangeCode().

◆ withAskPrice()

Quote & Quote::withAskPrice ( double askPrice)
inlinenoexcept

Changes ask price and returns the current quote.

Parameters
askPriceThe ask price.
Returns
The current quote

References setAskPrice().

◆ withAskSize()

Quote & Quote::withAskSize ( double askSize)
inlinenoexcept

Changes ask size and returns the current quote.

Parameters
askSizeThe ask size.
Returns
The current quote.

References setAskSize().

◆ withAskTime()

Quote & Quote::withAskTime ( std::int64_t askTime)
inlinenoexcept

Changes time of the last ask change and returns the current quote.

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

You can set the actual millisecond-precision time here to publish event and the millisecond part will make the Quote::getTime() of this quote even precise up to a millisecond.

Parameters
askTimeThe time of the last ask change.
Returns
The current quote.

References setAskTime().

◆ withBidExchangeCode() [1/2]

Quote & Quote::withBidExchangeCode ( char bidExchangeCode)
inlinenoexcept

Changes bid exchange code and returns the current quote.

Parameters
bidExchangeCodeThe bid exchange code.
Returns
The current quote

References setBidExchangeCode().

◆ withBidExchangeCode() [2/2]

Quote & Quote::withBidExchangeCode ( std::int16_t bidExchangeCode)
inlinenoexcept

Changes bid exchange code and returns the current quote.

Parameters
bidExchangeCodeThe bid exchange code.
Returns
The current quote.

References setBidExchangeCode().

◆ withBidPrice()

Quote & Quote::withBidPrice ( double bidPrice)
inlinenoexcept

Changes bid price and returns the current quote.

Parameters
bidPriceThe bid price.
Returns
The current quote

References setBidPrice().

◆ withBidSize()

Quote & Quote::withBidSize ( double bidSize)
inlinenoexcept

Changes bid size and returns the current quote.

Parameters
bidSizeThe bid size.
Returns
The current quote.

References setBidSize().

◆ withBidTime()

Quote & Quote::withBidTime ( std::int64_t bidTime)
inlinenoexcept

Changes time of the last bid change and returns the current quote.

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

You can set the actual millisecond-precision time here to publish event and the millisecond part will make the Quote::getTime() of this quote even precise up to a millisecond.

Parameters
bidTimeThe time of the last bid change.
Returns
The current quote.

References setBidTime().

◆ withEventSymbol()

Quote & Quote::withEventSymbol ( const std::string & eventSymbol)
inlinenoexcept

Changes event's symbol and returns the current quote.

Parameters
eventSymbolThe symbol of this event.
Returns
The current quote.

References MarketEvent::setEventSymbol().

◆ withEventTime()

Quote & Quote::withEventTime ( std::int64_t eventTime)
inlinenoexcept

Changes event's creation time and returns the current quote.

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

References MarketEvent::setEventTime().

◆ withSequence()

Quote & Quote::withSequence ( std::int32_t sequence)
inlinenoexcept

Changes sequence number of this quote and returns the current quote.

Parameters
sequenceThe sequence.
Returns
The current quote.
See also
Quote::getSequence()

References setSequence().

◆ withTimeNanoPart()

Quote & Quote::withTimeNanoPart ( std::int32_t timeNanoPart)
inlinenoexcept

Changes microseconds and nanoseconds part of time of the last bid or ask change and returns the current quote.

This method changes Quote::getTimeNanos() result.

Parameters
timeNanoPartThe microseconds and nanoseconds part of time of the last bid or ask change.
Returns
The current quote.

References setTimeNanoPart().

Member Data Documentation

◆ MAX_SEQUENCE

std::uint32_t Quote::MAX_SEQUENCE = (1U << 22U) - 1U
staticconstexpr

Maximum allowed sequence value.

See also
Quote::setSequence()

Referenced by getSequence(), and setSequence().