dxFeed Graal CXX API
|
Candle event with open, high, low, close prices and other information for a specific period. More...
#include <Candle.hpp>
Public Types | |
using | Ptr = std::shared_ptr<Candle> |
The alias to a type of shared pointer to the Candle object. | |
using | Unique = std::unique_ptr<Candle> |
The alias to a type of unique pointer to the Candle object. | |
Public Types inherited from EventTypeWithSymbol< CandleSymbol > | |
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 TimeSeriesEvent | |
using | Ptr = std::shared_ptr<TimeSeriesEvent> |
The alias to a type of shared pointer to the TimeSeriesEvent object. | |
Public Types inherited from IndexedEvent | |
using | Ptr = std::shared_ptr<IndexedEvent> |
The alias to a type of shared pointer to the IndexedEvent 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). | |
Candle () noexcept=default | |
Creates new candle with default values. | |
Candle (CandleSymbol eventSymbol) noexcept | |
Creates new candle with the specified candle event symbol. | |
const CandleSymbol & | getEventSymbol () const &noexcept override |
Returns symbol of this event. | |
const std::optional< CandleSymbol > & | getEventSymbolOpt () const &noexcept override |
Returns symbol of this event. | |
void | setEventSymbol (const CandleSymbol &eventSymbol) noexcept override |
Changes event symbol that identifies this event type in subscription. | |
Candle & | withEventSymbol (const CandleSymbol &eventSymbol) noexcept |
Changes event's symbol and returns the current candle. | |
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. | |
Candle & | withEventTime (std::int64_t eventTime) noexcept |
Changes event's creation time and returns the current candle. | |
std::int32_t | getEventFlags () const noexcept override |
Returns transactional event flags. | |
EventFlagsMask | getEventFlagsMask () const noexcept override |
Returns transactional event flags. | |
void | setEventFlags (std::int32_t eventFlags) noexcept override |
Changes transactional event flags. | |
Candle & | withEventFlags (std::int32_t eventFlags) noexcept |
Changes transactional event flags and returns the current candle. | |
void | setEventFlags (const EventFlagsMask &eventFlags) noexcept override |
Changes transactional event flags. | |
Candle & | withEventFlags (const EventFlagsMask &eventFlags) noexcept |
Changes transactional event flags and returns the current candle. | |
void | setIndex (std::int64_t index) override |
Changes unique per-symbol index of this event. | |
Candle & | withIndex (std::int64_t index) noexcept |
Changes unique per-symbol index of this event. | |
std::int64_t | getIndex () const noexcept override |
Returns unique per-symbol index of this event. | |
std::int64_t | getTime () const noexcept override |
Returns timestamp of the event in milliseconds. | |
void | setTime (std::int64_t time) noexcept |
Changes timestamp of the event in milliseconds. | |
Candle & | withTime (std::int64_t time) noexcept |
Changes timestamp of the event in milliseconds. | |
std::int32_t | getSequence () const noexcept |
Returns the sequence number of this event to distinguish events that have the same time. | |
void | setSequence (std::int32_t sequence) |
Changes sequence number of this event. | |
Candle & | withSequence (std::int32_t sequence) noexcept |
Changes sequence number of this event. | |
std::int64_t | getCount () const noexcept |
Returns total number of original trade (or quote) events in this candle. | |
void | setCount (std::int64_t count) noexcept |
Changes total number of original trade (or quote) events in this candle. | |
Candle & | withCount (std::int64_t count) noexcept |
Changes total number of original trade (or quote) events in this candle. | |
double | getOpen () const noexcept |
Returns the first (open) price of this candle. | |
void | setOpen (double open) noexcept |
Changes the first (open) price of this candle. | |
Candle & | withOpen (double open) noexcept |
Changes the first (open) price of this candle. | |
double | getHigh () const noexcept |
Returns the maximal (high) price of this candle. | |
void | setHigh (double high) noexcept |
Changes the maximal (high) price of this candle. | |
Candle & | withHigh (double high) noexcept |
Changes the maximal (high) price of this candle. | |
double | getLow () const noexcept |
Returns the minimal (low) price of this candle. | |
void | setLow (double low) noexcept |
Changes the minimal (low) price of this candle. | |
Candle & | withLow (double low) noexcept |
Changes the minimal (low) price of this candle. | |
double | getClose () const noexcept |
Returns the last (close) price of this candle. | |
void | setClose (double close) noexcept |
Changes the last (close) price of this candle. | |
Candle & | withClose (double close) noexcept |
Changes the last (close) price of this candle. | |
double | getVolume () const noexcept |
Returns total volume in this candle. | |
void | setVolume (double volume) noexcept |
Changes total volume in this candle. | |
Candle & | withVolume (double volume) noexcept |
Changes total volume in this candle. | |
double | getVWAP () const noexcept |
Returns volume-weighted average price (VWAP) in this candle. | |
void | setVWAP (double vwap) noexcept |
Changes volume-weighted average price (VWAP) in this candle. | |
Candle & | withVWAP (double vwap) noexcept |
Changes volume-weighted average price (VWAP) in this candle. | |
double | getBidVolume () const noexcept |
Returns bid volume in this candle. | |
void | setBidVolume (double bidVolume) noexcept |
Changes bid volume in this candle. | |
Candle & | withBidVolume (double bidVolume) noexcept |
Changes bid volume in this candle. | |
double | getAskVolume () const noexcept |
Returns ask volume in this candle. | |
void | setAskVolume (double askVolume) noexcept |
Changes ask volume in this candle. | |
Candle & | withAskVolume (double askVolume) noexcept |
Changes ask volume in this candle. | |
double | getImpVolatility () const noexcept |
Returns the implied volatility. | |
void | setImpVolatility (double impVolatility) |
Changes the implied volatility. | |
Candle & | withImpVolatility (double impVolatility) noexcept |
Changes implied volatility. | |
double | getOpenInterest () const noexcept |
Returns the open interest. | |
void | setOpenInterest (double openInterest) noexcept |
Changes the open interest. | |
Candle & | withOpenInterest (double openInterest) noexcept |
Changes the open interest. | |
std::string | toString () const noexcept override |
Returns a string representation of the current object. | |
Public Member Functions inherited from EventType | |
std::string | toString () const noexcept override |
Returns a string representation of the current object. | |
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. | |
Public Member Functions inherited from TimeSeriesEvent | |
const IndexedEventSource & | getSource () const &noexcept override |
Returns the source identifier for this event, which is always DEFAULT for time-series events. | |
std::int64_t | getIndex () const noexcept override |
Returns unique per-symbol index of this event. | |
virtual std::int64_t | getEventId () const noexcept |
Returns unique per-symbol index of this event. | |
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 EventTypeEnum & | TYPE = EventTypeEnum::CANDLE |
Type identifier and additional information about the current event class. | |
static constexpr std::uint32_t | MAX_SEQUENCE = (1U << 22U) - 1U |
Maximum allowed sequence value. | |
Static Public Attributes inherited from IndexedEvent | |
static const EventFlag | TX_PENDING = EventFlag::TX_PENDING |
0x01 - A bitmask to get transaction pending indicator from the value of eventFlags property. | |
static const EventFlag | REMOVE_EVENT = EventFlag::REMOVE_EVENT |
0x02 - A bitmask to get removal indicator from the value of eventFlags property. | |
static const EventFlag | SNAPSHOT_BEGIN = EventFlag::SNAPSHOT_BEGIN |
0x04 - A bitmask to get snapshot begin indicator from the value of eventFlags property. | |
static const EventFlag | SNAPSHOT_END = EventFlag::SNAPSHOT_END |
0x08 - A bitmask to get snapshot end indicator from the value of eventFlags property. | |
static const EventFlag | SNAPSHOT_SNIP = EventFlag::SNAPSHOT_SNIP |
0x10 - A bitmask to get snapshot snip indicator from the value of eventFlags property. | |
static const EventFlag | SNAPSHOT_MODE = EventFlag::SNAPSHOT_MODE |
0x40 - A bitmask to set snapshot mode indicator into the value of eventFlags property. | |
Candle event with open, high, low, close prices and other information for a specific period.
Candles are build with a specified CandlePeriod using a specified CandlePrice type with a data taken from the specified CandleExchange from the specified CandleSession with further details of aggregation provided by CandleAlignment.
Event symbol of the candle is represented with CandleSymbol class. Since the `Candle is a time-series event, it is typically subscribed to using DXFeedTimeSeriesSubscription class that handles the necessarily wrapping of the symbol into TimeSeriesSubscriptionSymbol to specify a subscription time range.
Some candle sources provide a consistent view of the set of known candles. The corresponding information is carried in eventFlags property. The logic behind this property is detailed in IndexedEvent class documentation. Multiple event sources for the same symbol are not supported for candles, thus source property is always DEFAULT.
TimeSeriesEventModel class handles all the snapshot and transaction logic and conveniently represents a list current of time-series events order by their time. It relies on the code of AbstractIndexedEventModel to handle this logic. Use the source code of AbstractIndexedEventModel for clarification on transactions and snapshot logic.
Publishing of candle events follows the general rules explained in TimeSeriesEvent class documentation.
This event is implemented on top of QDS record TradeHistory
for tick candles with CandlePeriod::TICK, records Trade.<period>
for a certain set of popular periods, and QDS record Candle
for arbitrary custom periods, with a set of Candle{<attributes>}
records for a popular combinations of custom candle symbol attributes like CandlePrice for an efficient support of bid-ask charting.
|
inlineexplicitnoexcept |
Creates new candle with the specified candle event symbol.
eventSymbol | candle event symbol. |
|
static |
Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
graalNative | The pointer to the dxFeed Graal SDK structure. |
|
static |
Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
graalNative | The pointer to the dxFeed Graal SDK structure. |
std::invalid_argument |
|
inlinenoexcept |
Returns ask volume in this candle.
|
inlinenoexcept |
Returns bid volume in this candle.
|
inlinenoexcept |
Returns the last (close) price of this candle.
|
inlinenoexcept |
Returns total number of original trade (or quote) events in this candle.
|
inlineoverridevirtualnoexcept |
Returns transactional event flags.
See EventFlag "Event Flags" section.
Implements IndexedEvent.
|
inlineoverridevirtualnoexcept |
Returns transactional event flags.
See EventFlag "Event Flags" section.
Implements IndexedEvent.
|
inlineoverridevirtualnoexcept |
Returns symbol of this event.
dxfcpp::CandleSymbol{"<null>"}
) Implements EventTypeWithSymbol< CandleSymbol >.
|
inlineoverridevirtualnoexcept |
Returns symbol of this event.
std::nullopt
. Implements EventTypeWithSymbol< CandleSymbol >.
|
inlineoverridevirtualnoexcept |
Returns time when 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 a 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.
Default implementation returns 0.
Reimplemented from EventType.
|
inlinenoexcept |
Returns the maximal (high) price of this candle.
|
inlinenoexcept |
Returns the implied volatility.
|
inlineoverridevirtualnoexcept |
Returns unique per-symbol index of this event.
Implements IndexedEvent.
|
inlinenoexcept |
Returns the minimal (low) price of this candle.
|
inlinenoexcept |
Returns the first (open) price of this candle.
|
inlinenoexcept |
Returns the open interest.
|
inlinenoexcept |
Returns the sequence number of this event to distinguish events 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 Candle::MAX_SEQUENCE.
References MAX_SEQUENCE.
Referenced by setTime().
|
inlineoverridevirtualnoexcept |
Returns timestamp of the event in milliseconds.
Implements TimeSeriesEvent.
|
inlinenoexcept |
Returns total volume in this candle.
|
inlinenoexcept |
|
inlinenoexcept |
Changes ask volume in this candle.
askVolume | Ask volume in this candle. |
Referenced by withAskVolume().
|
inlinenoexcept |
Changes bid volume in this candle.
bidVolume | Bid volume in this candle. |
Referenced by withBidVolume().
|
inlinenoexcept |
Changes the last (close) price of this candle.
close | The last (close) price of this candle. |
Referenced by withClose().
|
inlinenoexcept |
Changes total number of original trade (or quote) events in this candle.
count | Total number of original trade (or quote) events in this candle. |
Referenced by withCount().
|
inlineoverridevirtualnoexcept |
Changes transactional event flags.
See EventFlag "Event Flags" section.
eventFlags | transactional event flags' mask. |
Implements IndexedEvent.
References EventFlagsMask::getMask().
Referenced by withEventFlags().
|
inlineoverridevirtualnoexcept |
Changes transactional event flags.
See EventFlag "Event Flags" section.
eventFlags | transactional event flags. |
Implements IndexedEvent.
Referenced by withEventFlags().
|
inlineoverridevirtualnoexcept |
Changes event symbol that identifies this event type in subscription.
eventSymbol | event symbol. |
Implements EventTypeWithSymbol< CandleSymbol >.
Referenced by withEventSymbol().
|
inlineoverridevirtualnoexcept |
Changes event creation time.
Default implementation does nothing.
eventTime | the difference, measured in milliseconds, between the event creation time and midnight, January 1, 1970 UTC. |
Reimplemented from EventType.
Referenced by withEventTime().
|
inlinenoexcept |
Changes the maximal (high) price of this candle.
high | The maximal (high) price of this candle. |
Referenced by withHigh().
|
inline |
Changes the implied volatility.
impVolatility | The implied volatility. |
Referenced by withImpVolatility().
|
inlineoverridevirtual |
Changes unique per-symbol index of this event.
index | unique per-symbol index of this event. |
Implements IndexedEvent.
Referenced by withIndex().
|
inlinenoexcept |
Changes the minimal (low) price of this candle.
low | The minimal (low) price of this candle. |
Referenced by withLow().
|
inlinenoexcept |
Changes the first (open) price of this candle.
open | The first (open) price of this candle. |
Referenced by withOpen().
|
inlinenoexcept |
Changes the open interest.
openInterest | The open interest. |
Referenced by withOpenInterest().
|
inline |
Changes sequence number of this event.
sequence | the sequence. |
std::invalid_argument | if sequence is below zero or above MAX_SEQUENCE. |
References MAX_SEQUENCE.
Referenced by withSequence().
|
inlinenoexcept |
Changes timestamp of the event in milliseconds.
time | timestamp of the event in milliseconds. |
References getSequence().
Referenced by withTime().
|
inlinenoexcept |
Changes total volume in this candle.
volume | Total volume in this candle. |
Referenced by withVolume().
|
inlinenoexcept |
Changes volume-weighted average price (VWAP) in this candle.
vwap | Volume-weighted average price (VWAP) in this candle. |
Referenced by withVWAP().
|
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.
Implements EventType.
References toString().
|
overridevirtualnoexcept |
Returns a string representation of the current object.
Reimplemented from SharedEntity.
Referenced by toGraal().
|
inlinenoexcept |
Changes ask volume in this candle.
Returns the current candle.
askVolume | Ask volume in this candle. |
References setAskVolume().
|
inlinenoexcept |
Changes bid volume in this candle.
Returns the current candle.
bidVolume | Bid volume in this candle. |
References setBidVolume().
|
inlinenoexcept |
Changes the last (close) price of this candle.
Returns the current candle.
close | The last (close) price of this candle. |
References setClose().
|
inlinenoexcept |
Changes total number of original trade (or quote) events in this candle.
Returns the current candle.
count | Total number of original trade (or quote) events in this candle. |
References setCount().
|
inlinenoexcept |
Changes transactional event flags and returns the current candle.
See EventFlag "Event Flags" section.
eventFlags | transactional event flags' mask. |
References setEventFlags().
|
inlinenoexcept |
Changes transactional event flags and returns the current candle.
See EventFlag "Event Flags" section.
eventFlags | transactional event flags. |
References setEventFlags().
|
inlinenoexcept |
Changes event's symbol and returns the current candle.
eventSymbol | The symbol of this event. |
References setEventSymbol().
|
inlinenoexcept |
Changes event's creation time and returns the current candle.
eventTime | the difference, measured in milliseconds, between the event creation time and midnight, January 1, 1970 UTC. |
References setEventTime().
|
inlinenoexcept |
Changes the maximal (high) price of this candle.
Returns the current candle.
high | The maximal (high) price of this candle. |
References setHigh().
|
inlinenoexcept |
Changes implied volatility.
Returns the current candle.
impVolatility | The implied volatility. |
References setImpVolatility().
|
inlinenoexcept |
Changes unique per-symbol index of this event.
Returns the current candle.
index | unique per-symbol index of this candle. |
References setIndex().
|
inlinenoexcept |
Changes the minimal (low) price of this candle.
Returns the current candle.
low | The minimal (low) price of this candle. |
References setLow().
|
inlinenoexcept |
Changes the first (open) price of this candle.
Returns the current candle.
open | The first (open) price of this candle. |
References setOpen().
|
inlinenoexcept |
Changes the open interest.
Returns the current candle.
openInterest | The open interest. |
References setOpenInterest().
|
inlinenoexcept |
Changes sequence number of this event.
Returns the current candle.
sequence | the sequence. |
References setSequence().
|
inlinenoexcept |
Changes timestamp of the event in milliseconds.
Returns the current candle.
time | timestamp of the event in milliseconds. |
References setTime().
|
inlinenoexcept |
Changes total volume in this candle.
Returns the current candle.
volume | Total volume in this candle. |
References setVolume().
|
inlinenoexcept |
Changes volume-weighted average price (VWAP) in this candle.
Returns the current candle.
vwap | Volume-weighted average price (VWAP) in this candle. |
References setVWAP().
|
staticconstexpr |
Maximum allowed sequence value.
Referenced by getSequence(), and setSequence().