dxFeed Graal CXX API v9.0.0
Loading...
Searching...
No Matches
OrderImbalance Class Referencefinal

Order imbalance event provides information about order book statistics during auctions. More...

#include <OrderImbalance.hpp>

Inheritance diagram for OrderImbalance:

Public Types

using Ptr = std::shared_ptr<OrderImbalance>
 The alias to a type of shared pointer to the OrderImbalance object.
using Unique = std::unique_ptr<OrderImbalance>
 The alias to a type of unique pointer to the OrderImbalance 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 = std::shared_ptr<EventTypeWithSymbol<std::string>>
 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 * toGraal () const override
 Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
void assign (std::shared_ptr< EventType > event) override
 Replaces the contents of the event.
 OrderImbalance () noexcept
 Creates new order imbalance event with default values.
 OrderImbalance (StringParam eventSymbol)
 Creates a new order imbalance event with the specified event symbol.
OrderImbalance & withEventSymbol (StringParam eventSymbol)
 Changes an event's symbol and returns the current order imbalance.
OrderImbalance & withEventTime (std::int64_t eventTime) noexcept
 Changes event's creation time and returns the current order imbalance.
const OrderSource & getSource () const &
 Returns source of this event.
void setSource (const OrderSource &source) noexcept
 Changes source of this event.
OrderImbalance & withSource (const OrderSource &source) noexcept
 Changes source of this event.
std::int64_t getTimeSequence () const noexcept
 Returns time and sequence of the order imbalance packaged into a single long value.
void setTimeSequence (std::int64_t timeSequence) noexcept
 Changes time and sequence of the order imbalance.
OrderImbalance & withTimeSequence (std::int64_t timeSequence) noexcept
 Changes time and sequence of the order imbalance.
std::int64_t getTime () const noexcept
 Returns time of the order imbalance event.
void setTime (std::int64_t time) noexcept
 Changes time of the order imbalance event.
OrderImbalance & withTime (std::int64_t time) noexcept
 Changes time of the order imbalance event.
std::int32_t getSequence () const noexcept
 Returns sequence number of this event to distinguish order imbalance events that have the same time.
void setSequence (std::int32_t sequence)
 Changes sequence number of this event.
OrderImbalance & withSequence (std::int32_t sequence)
 Changes sequence number of this event.
double getRefPrice () const noexcept
 Returns the reference price.
void setRefPrice (double refPrice) noexcept
 Changes the reference price.
OrderImbalance & withRefPrice (double refPrice) noexcept
 Changes the reference price.
double getPairedSize () const noexcept
 Returns the paired size.
void setPairedSize (double pairedSize) noexcept
 Changes the paired size.
OrderImbalance & withPairedSize (double pairedSize) noexcept
 Changes the paired size.
double getImbalanceSize () const noexcept
 Returns the imbalance size.
void setImbalanceSize (double imbalanceSize) noexcept
 Changes the imbalance size.
OrderImbalance & withImbalanceSize (double imbalanceSize) noexcept
 Changes the imbalance size.
double getNearPrice () const noexcept
 Returns the near price.
void setNearPrice (double nearPrice) noexcept
 Changes the near price.
OrderImbalance & withNearPrice (double nearPrice) noexcept
 Changes the near price.
double getFarPrice () const noexcept
 Returns the far price.
void setFarPrice (double farPrice) noexcept
 Changes the far price.
OrderImbalance & withFarPrice (double farPrice) noexcept
 Changes the far price.
const ImbalanceSide & getImbalanceSide () const &noexcept
 Returns the imbalance side.
void setImbalanceSide (const ImbalanceSide &side) noexcept
 Changes the imbalance side.
OrderImbalance & withImbalanceSide (const ImbalanceSide &side) noexcept
 Changes the imbalance side.
const AuctionType & getAuctionType () const &noexcept
 Returns the auction type.
void setAuctionType (const AuctionType &type) noexcept
 Changes the auction type.
OrderImbalance & withAuctionType (const AuctionType &type) noexcept
 Changes the auction type.
std::string toString () const override
 Returns a string representation of the current object.
Public Member Functions inherited from MarketEvent
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 (StringParam eventSymbol) 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 SharedEntity
template<typename T>
bool is () const noexcept
 Checks that the object is of type T: its dynamic type is T or derived from T.
template<typename T>
std::shared_ptr< T > sharedAs () noexcept
 Returns a pointer to the current object wrapped in a smart pointer to type T or std::shared_ptr<T>{nullptr} if the object is not managed by std::shared_ptr.
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 or std::shared_ptr<T>{nullptr} if the object is not managed by std::shared_ptr.
Public Member Functions inherited from Entity
virtual ~Entity () noexcept
 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 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::ORDER_IMBALANCE
 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 (StringParam eventSymbol)
 Protected constructor for concrete implementation classes that initializes eventSymbol property.

Detailed Description

Order imbalance event provides information about order book statistics during auctions.

These events describe the imbalance between buy and sell orders for specific security, along with reference pricing information that reflects the current auction state. The event includes metrics such as paired size, imbalance shares, and hypothetical pricing scenarios.

Properties

OrderImbalance event has the following properties:

  • eventSymbol - symbol of this event;
  • source - source of this event;
  • time - time of the order imbalance event;
  • sequence - sequence of the order imbalance event;
  • refPrice - reference price for imbalance calculation;
  • pairedSize - total number of shares eligible to be matched at reference price;
  • imbalanceSize - number of shares not matched at reference price;
  • nearPrice - hypothetical price for all interest on the book;
  • farPrice - hypothetical price for auction interest only;
  • imbalanceSide - side of the order imbalance;
  • auctionType - type of auction.

Implementation details

This event is implemented on top of QDS records OrderImbalance#<source-id>, where <source-id> is up to 4 ASCII characters with a mnemonic for the source like "NUAM".

Constructor & Destructor Documentation

◆ OrderImbalance()

OrderImbalance::OrderImbalance ( StringParam eventSymbol)
explicit

Creates a new order imbalance event with the specified event symbol.

Parameters
eventSymbolThe event symbol.

Member Function Documentation

◆ assign()

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

Replaces the contents of the event.

Parameters
eventthe event to use as a source.

Reimplemented from MarketEvent.

References MarketEvent::assign().

◆ freeGraal()

void OrderImbalance::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

◆ fromGraal()

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

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

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

◆ getAuctionType()

const AuctionType & OrderImbalance::getAuctionType ( ) const &
noexcept

Returns the auction type.

Returns
the auction type.

◆ getFarPrice()

double OrderImbalance::getFarPrice ( ) const
noexcept

Returns the far price.

The far price is a hypothetical price at which only auction interest (all auction orders) on the book could trade if the closure happened now. Far price is usually further from the reference price than the near price.

Returns
the far price.

◆ getImbalanceSide()

const ImbalanceSide & OrderImbalance::getImbalanceSide ( ) const &
noexcept

Returns the imbalance side.

Returns
the imbalance side.

◆ getImbalanceSize()

double OrderImbalance::getImbalanceSize ( ) const
noexcept

Returns the imbalance size.

The imbalance size is the number of shares that are not matched at the reference price.

Returns
the imbalance size.

◆ getNearPrice()

double OrderImbalance::getNearPrice ( ) const
noexcept

Returns the near price.

The near price is a hypothetical price at which all interest (all orders) on the book could trade if the closure happened now, including auction and imbalance offset interest.

Returns
the near price.

◆ getPairedSize()

double OrderImbalance::getPairedSize ( ) const
noexcept

Returns the paired size.

The paired size is the total number of shares that are eligible to be matched at the reference price.

Returns
the paired size.

◆ getRefPrice()

double OrderImbalance::getRefPrice ( ) const
noexcept

Returns the reference price.

The reference price is the price for which the number of paired shares and number of imbalance shares are calculated. Usually, this is the consolidated last sale price before the auction or imbalance event started.

Returns
the reference price.

◆ getSequence()

std::int32_t OrderImbalance::getSequence ( ) const
noexcept

Returns sequence number of this event to distinguish order imbalance 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 ::MAX_SEQUENCE.

Returns
sequence of this order imbalance event.

◆ getSource()

const OrderSource & OrderImbalance::getSource ( ) const &

Returns source of this event.

Returns
source of this event.

◆ getTime()

std::int64_t OrderImbalance::getTime ( ) const
noexcept

Returns time of the order imbalance event.

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

Returns
time of the order imbalance event.

◆ getTimeSequence()

std::int64_t OrderImbalance::getTimeSequence ( ) const
noexcept

Returns time and sequence of the order imbalance packaged into a single long value.

Returns
time and sequence of the order imbalance.

◆ setAuctionType()

void OrderImbalance::setAuctionType ( const AuctionType & type)
noexcept

Changes the auction type.

Parameters
typethe auction type.

◆ setFarPrice()

void OrderImbalance::setFarPrice ( double farPrice)
noexcept

Changes the far price.

Parameters
farPricethe far price.

◆ setImbalanceSide()

void OrderImbalance::setImbalanceSide ( const ImbalanceSide & side)
noexcept

Changes the imbalance side.

Parameters
sidethe imbalance side.

◆ setImbalanceSize()

void OrderImbalance::setImbalanceSize ( double imbalanceSize)
noexcept

Changes the imbalance size.

Parameters
imbalanceSizethe imbalance size.

◆ setNearPrice()

void OrderImbalance::setNearPrice ( double nearPrice)
noexcept

Changes the near price.

Parameters
nearPricethe near price.

◆ setPairedSize()

void OrderImbalance::setPairedSize ( double pairedSize)
noexcept

Changes the paired size.

Parameters
pairedSizethe paired size.

◆ setRefPrice()

void OrderImbalance::setRefPrice ( double refPrice)
noexcept

Changes the reference price.

Parameters
refPricethe reference price.

◆ setSequence()

void OrderImbalance::setSequence ( std::int32_t sequence)

Changes sequence number of this event.

Parameters
sequencethe sequence.
Exceptions
InvalidArgumentExceptionif the sequence is below zero or above ::MAX_SEQUENCE.
See also
OrderImbalance::getSequence()

◆ setSource()

void OrderImbalance::setSource ( const OrderSource & source)
noexcept

Changes source of this event.

Parameters
sourcesource of this event.

Referenced by withSource().

◆ setTime()

void OrderImbalance::setTime ( std::int64_t time)
noexcept

Changes time of the order imbalance event.

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

Parameters
timetime of the order imbalance event.

◆ setTimeSequence()

void OrderImbalance::setTimeSequence ( std::int64_t timeSequence)
noexcept

Changes time and sequence of the order imbalance.

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

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

◆ toGraal()

void * OrderImbalance::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 OrderImbalance::toString ( ) const
overridevirtual

Returns a string representation of the current object.

Returns
a string representation

Reimplemented from EventType.

◆ withAuctionType()

OrderImbalance & OrderImbalance::withAuctionType ( const AuctionType & type)
noexcept

Changes the auction type.

Returns the current order imbalance.

Parameters
typethe auction type.
Returns
The current order imbalance.

◆ withEventSymbol()

OrderImbalance & OrderImbalance::withEventSymbol ( StringParam eventSymbol)

Changes an event's symbol and returns the current order imbalance.

Parameters
eventSymbolThe symbol of this event.
Returns
The current order imbalance.

◆ withEventTime()

OrderImbalance & OrderImbalance::withEventTime ( std::int64_t eventTime)
noexcept

Changes event's creation time and returns the current order imbalance.

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

◆ withFarPrice()

OrderImbalance & OrderImbalance::withFarPrice ( double farPrice)
noexcept

Changes the far price.

Returns the current order imbalance.

Parameters
farPricethe far price.
Returns
The current order imbalance.

◆ withImbalanceSide()

OrderImbalance & OrderImbalance::withImbalanceSide ( const ImbalanceSide & side)
noexcept

Changes the imbalance side.

Returns the current order imbalance.

Parameters
sidethe imbalance side.
Returns
The current order imbalance.

◆ withImbalanceSize()

OrderImbalance & OrderImbalance::withImbalanceSize ( double imbalanceSize)
noexcept

Changes the imbalance size.

Returns the current order imbalance.

Parameters
imbalanceSizethe imbalance size.
Returns
The current order imbalance.

◆ withNearPrice()

OrderImbalance & OrderImbalance::withNearPrice ( double nearPrice)
noexcept

Changes the near price.

Returns the current order imbalance.

Parameters
nearPricethe near price.
Returns
The current order imbalance.

◆ withPairedSize()

OrderImbalance & OrderImbalance::withPairedSize ( double pairedSize)
noexcept

Changes the paired size.

Returns the current order imbalance.

Parameters
pairedSizethe paired size.
Returns
The current order imbalance.

◆ withRefPrice()

OrderImbalance & OrderImbalance::withRefPrice ( double refPrice)
noexcept

Changes the reference price.

Returns the current order imbalance.

Parameters
refPricethe reference price.
Returns
The current order imbalance.

◆ withSequence()

OrderImbalance & OrderImbalance::withSequence ( std::int32_t sequence)

Changes sequence number of this event.

Returns the current order imbalance.

Parameters
sequencethe sequence.
Returns
The current order imbalance.
Exceptions
InvalidArgumentExceptionif the sequence is below zero or above ::MAX_SEQUENCE.
See also
OrderImbalance::getSequence()

◆ withSource()

OrderImbalance & OrderImbalance::withSource ( const OrderSource & source)
noexcept

Changes source of this event.

Returns the current order imbalance.

Parameters
sourcesource of this event.
Returns
The current order imbalance.

References setSource().

◆ withTime()

OrderImbalance & OrderImbalance::withTime ( std::int64_t time)
noexcept

Changes time of the order imbalance event.

Returns the current order imbalance.

Parameters
timetime of the order imbalance event.
Returns
The current order imbalance.

◆ withTimeSequence()

OrderImbalance & OrderImbalance::withTimeSequence ( std::int64_t timeSequence)
noexcept

Changes time and sequence of the order imbalance.

Returns the current order imbalance.

Parameters
timeSequencethe time and sequence.
Returns
The current order imbalance.

Member Data Documentation

◆ MAX_SEQUENCE

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

Maximum allowed sequence value.

See also
OrderImbalance::setSequence()