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

Greeks event is a snapshot of the option price, Black-Scholes volatility and greeks. More...

#include <Greeks.hpp>

+ Inheritance diagram for Greeks:

Public Types

using Ptr = std::shared_ptr<Greeks>
 The alias to a type of shared pointer to the Greeks object.
 
using Unique = std::unique_ptr<Greeks>
 The alias to a type of unique pointer to the Greeks 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 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).
 
 Greeks () noexcept=default
 Creates new greeks event with default values.
 
 Greeks (std::string eventSymbol) noexcept
 Creates new greeks event with the specified event symbol.
 
const IndexedEventSourcegetSource () const &noexcept override
 Returns the source of this event.
 
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.
 
void setEventFlags (const EventFlagsMask &eventFlags) noexcept override
 Changes transactional event flags.
 
std::int64_t getIndex () const noexcept override
 Returns unique per-symbol index of this event.
 
void setIndex (std::int64_t index) override
 Changes 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.
 
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.
 
double getPrice () const noexcept
 Returns option market price.
 
void setPrice (double price) noexcept
 Changes option market price.
 
double getVolatility () const noexcept
 Returns Black-Scholes implied volatility of the option.
 
void setVolatility (double volatility) noexcept
 Changes Black-Scholes implied volatility of the option.
 
double getDelta () const noexcept
 Return option delta.
 
void setDelta (double delta) noexcept
 Changes option delta.
 
double getGamma () const noexcept
 Returns option gamma.
 
void setGamma (double gamma) noexcept
 Changes option gamma.
 
double getTheta () const noexcept
 Returns option theta.
 
void setTheta (double theta) noexcept
 Changes option theta.
 
double getRho () const noexcept
 Returns option rho.
 
void setRho (double rho) noexcept
 Changes option rho.
 
double getVega () const noexcept
 Returns option vega.
 
void setVega (double vega) noexcept
 Changes option vega.
 
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.
 
- Public Member Functions inherited from TimeSeriesEvent
const IndexedEventSourcegetSource () 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 EventTypeEnumTYPE = EventTypeEnum::GREEKS
 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.
 

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

Greeks event is a snapshot of the option price, Black-Scholes volatility and greeks.

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

Event flags, transactions and snapshots

Some greeks sources provide a consistent view of the set of known greeks. 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 greeks, 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 Greeks

Publishing of greeks events follows the general rules explained in TimeSeriesEvent class documentation.

Constructor & Destructor Documentation

◆ Greeks()

Greeks::Greeks ( std::string eventSymbol)
inlineexplicitnoexcept

Creates new greeks event with the specified event symbol.

Parameters
eventSymbolThe event symbol.

Member Function Documentation

◆ freeGraal()

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

◆ getDelta()

double Greeks::getDelta ( ) const
inlinenoexcept

Return option delta.

Delta is the first derivative of an option price by an underlying price.

Returns
option delta.

◆ getEventFlags()

std::int32_t Greeks::getEventFlags ( ) const
inlineoverridevirtualnoexcept

Returns transactional event flags.

See EventFlag "Event Flags" section.

Returns
The transactional event flags.

Implements IndexedEvent.

◆ getEventFlagsMask()

EventFlagsMask Greeks::getEventFlagsMask ( ) const
inlineoverridevirtualnoexcept

Returns transactional event flags.

See EventFlag "Event Flags" section.

Returns
The transactional event flags' mask.

Implements IndexedEvent.

◆ getGamma()

double Greeks::getGamma ( ) const
inlinenoexcept

Returns option gamma.

Gamma is the second derivative of an option price by an underlying price.

Returns
option gamma.

◆ getIndex()

std::int64_t Greeks::getIndex ( ) const
inlineoverridevirtualnoexcept

Returns unique per-symbol index of this event.

The index is composed of time and sequence. Changing either time or sequence changes event index.

Returns
unique index of this event.

Implements IndexedEvent.

◆ getPrice()

double Greeks::getPrice ( ) const
inlinenoexcept

Returns option market price.

Returns
option market price.

◆ getRho()

double Greeks::getRho ( ) const
inlinenoexcept

Returns option rho.

Rho is the first derivative of an option price by percentage interest rate.

Returns
option rho.

◆ getSequence()

std::int32_t Greeks::getSequence ( ) const
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 MAX_SEQUENCE.

Returns
The sequence number of this event

References MAX_SEQUENCE.

Referenced by setTime().

◆ getSource()

const IndexedEventSource & Greeks::getSource ( ) const &
inlineoverridevirtualnoexcept

Returns the source of this event.

Returns
The source of this event.

Implements IndexedEvent.

References IndexedEventSource::DEFAULT.

◆ getTheta()

double Greeks::getTheta ( ) const
inlinenoexcept

Returns option theta.

Theta is the first derivative of an option price by a number of days to expiration.

Returns
option theta.

◆ getTime()

std::int64_t Greeks::getTime ( ) const
inlineoverridevirtualnoexcept

Returns timestamp of the event in milliseconds.

Returns
timestamp of the event in milliseconds

Implements TimeSeriesEvent.

◆ getVega()

double Greeks::getVega ( ) const
inlinenoexcept

Returns option vega.

Vega is the first derivative of an option price by percentage volatility.

Returns
option vega.

◆ getVolatility()

double Greeks::getVolatility ( ) const
inlinenoexcept

Returns Black-Scholes implied volatility of the option.

Returns
Black-Scholes implied volatility of the option.

◆ setDelta()

void Greeks::setDelta ( double delta)
inlinenoexcept

Changes option delta.

Parameters
deltaoption delta.

◆ setEventFlags() [1/2]

void Greeks::setEventFlags ( const EventFlagsMask & eventFlags)
inlineoverridevirtualnoexcept

Changes transactional event flags.

See EventFlag "Event Flags" section.

Parameters
eventFlagstransactional event flags' mask.

Implements IndexedEvent.

References EventFlagsMask::getMask().

◆ setEventFlags() [2/2]

void Greeks::setEventFlags ( std::int32_t eventFlags)
inlineoverridevirtualnoexcept

Changes transactional event flags.

See EventFlag "Event Flags" section.

Parameters
eventFlagstransactional event flags.

Implements IndexedEvent.

◆ setGamma()

void Greeks::setGamma ( double gamma)
inlinenoexcept

Changes option gamma.

Parameters
gammaoption gamma.

◆ setIndex()

void Greeks::setIndex ( std::int64_t index)
inlineoverridevirtual

Changes unique per-symbol index of this event.

The index is composed of time and sequence and invocation of this method changes time and sequence. Do not use this method directly. Change time and/or sequence.

Parameters
indexthe event index.
See also
getIndex()

Implements IndexedEvent.

◆ setPrice()

void Greeks::setPrice ( double price)
inlinenoexcept

Changes option market price.

Parameters
priceoption market price.

◆ setRho()

void Greeks::setRho ( double rho)
inlinenoexcept

Changes option rho.

Parameters
rhooption rho.

◆ setSequence()

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

Changes sequence number of this event.

Parameters
sequencethe sequence.
See also
getSequence()

References MAX_SEQUENCE.

◆ setTheta()

void Greeks::setTheta ( double theta)
inlinenoexcept

Changes option theta.

Parameters
thetaoption theta.

◆ setTime()

void Greeks::setTime ( std::int64_t time)
inlinenoexcept

Changes timestamp of the event in milliseconds.

Parameters
timetimestamp of the event in milliseconds.
See also
getTime()

References getSequence().

◆ setVega()

void Greeks::setVega ( double vega)
inlinenoexcept

Changes option vega.

Parameters
vegaoption vega.

◆ setVolatility()

void Greeks::setVolatility ( double volatility)
inlinenoexcept

Changes Black-Scholes implied volatility of the option.

Parameters
volatilityBlack-Scholes implied volatility of the option.

◆ toGraal()

void * Greeks::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 Greeks::toString ( ) const
overridevirtualnoexcept

Returns a string representation of the current object.

Returns
a string representation

Reimplemented from EventType.

Member Data Documentation

◆ MAX_SEQUENCE

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

Maximum allowed sequence value.

See also
setSequence()

Referenced by getSequence(), and setSequence().