dxFeed Graal CXX API v5.0.0
Loading...
Searching...
No Matches
AdditionalUnderlyings Struct Reference

Represents a set of additional underlyings for a given option. More...

#include <AdditionalUnderlyings.hpp>

+ Inheritance diagram for AdditionalUnderlyings:

Public Types

using Ptr = std::shared_ptr<AdditionalUnderlyings>
 The alias to a type of shared pointer to the AdditionalUnderlyings object.
 
using Unique = std::unique_ptr<AdditionalUnderlyings>
 The alias to a type of unique pointer to the AdditionalUnderlyings 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

std::string getText () const
 Returns textual representation of additional underlyings in the format:
 
std::unordered_map< std::string, double > getMap () const
 Returns internal representation of additional underlyings as a map from the underlying symbol to its SPC.
 
double getSPC (const StringLike &symbol) const
 Returns SPC for a specified underlying symbol or 0 is specified symbol is not found.
 
bool operator== (const AdditionalUnderlyings &other) const
 Returns true if this object is equal to other object.
 
bool operator== (const AdditionalUnderlyings::Ptr &other) const
 Returns true if this object is equal to other object.
 
std::size_t hashCode () const noexcept
 
std::string toString () const override
 Returns a string representation of the current object.
 
- Public Member Functions inherited from SharedEntity
template<typename T>
bool is () const noexcept
 Checks that the 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 valueOf (const StringLike &text)
 Returns an instance of additional underlyings for specified textual representation.
 
template<typename MapLikeType>
requires (!std::convertible_to<MapLikeType, StringLike>)
static Ptr valueOf (const MapLikeType &map)
 Returns an instance of additional underlyings for specified internal representation.
 
static double getSPC (const StringLike &text, const StringLike &symbol)
 Returns SPC for a specified underlying symbol or 0 is specified symbol is not found.
 
- Static Public Member Functions inherited from RequireMakeShared< AdditionalUnderlyings >
static auto createShared (Args &&...args)
 Creates a smart pointer to an object.
 

Static Public Attributes

static const Ptr EMPTY
 Empty additional underlyings - it has empty text and empty map.
 

Detailed Description

Represents a set of additional underlyings for a given option.

Each additional underlying has an associated parameter called SPC (shares per contract) that specifies how many shares of additional underlying are delivered during settlement of the option. In cases when the option delivers additional cash, the SPC specifies an amount of how much cash is delivered.

See AdditionalUnderlyings::getText() and AdditionalUnderlyings::getMap() for details about used formats and representations.

Member Function Documentation

◆ getMap()

std::unordered_map< std::string, double > AdditionalUnderlyings::getMap ( ) const

Returns internal representation of additional underlyings as a map from the underlying symbol to its SPC.

Returns
The internal representation.

◆ getSPC() [1/2]

double AdditionalUnderlyings::getSPC ( const StringLike & symbol) const

Returns SPC for a specified underlying symbol or 0 is specified symbol is not found.

Parameters
symbolThe underlying symbol.
Returns
The SPC for the symbol.

◆ getSPC() [2/2]

double AdditionalUnderlyings::getSPC ( const StringLike & text,
const StringLike & symbol )
static

Returns SPC for a specified underlying symbol or 0 is specified symbol is not found.

This method is equivalent to the expression "valueOf(text)->getSPC(symbol)" except it does not check the correctness of format.

Parameters
textThe text on which AdditionalUnderlying will be built.
symbolThe underlying symbol.
Returns
SPC by the text and symbol.

◆ getText()

std::string AdditionalUnderlyings::getText ( ) const

Returns textual representation of additional underlyings in the format:

TEXT ::= "" | LIST
LIST ::= AU | AU "; " LIST
AU ::= UNDERLYING " " SPC

Where UNDERLYING is a symbol of an underlying instrument and SPC is a number of shares per contract of that underlying. All additional underlyings are listed in the alphabetical order of the underlying symbol. In cases when the option settles with additional cash, the underlying symbol will specify cash symbol and SPC will specify the amount of cash.

Returns
The textual representation of the additional underlyings.

◆ hashCode()

std::size_t AdditionalUnderlyings::hashCode ( ) const
noexcept
Returns
A hash code value for this object.

◆ operator==() [1/2]

bool AdditionalUnderlyings::operator== ( const AdditionalUnderlyings & other) const

Returns true if this object is equal to other object.

Parameters
otherAnother object
Returns
true if this object is equal to other object

◆ operator==() [2/2]

bool AdditionalUnderlyings::operator== ( const AdditionalUnderlyings::Ptr & other) const
inline

Returns true if this object is equal to other object.

Parameters
otherAnother object
Returns
true if this object is equal to other object

◆ toString()

std::string AdditionalUnderlyings::toString ( ) const
overridevirtual

Returns a string representation of the current object.

Returns
A string representation

Reimplemented from SharedEntity.

◆ valueOf() [1/2]

template<typename MapLikeType>
requires (!std::convertible_to<MapLikeType, StringLike>)
AdditionalUnderlyings::Ptr AdditionalUnderlyings::valueOf ( const MapLikeType & map)
static

Returns an instance of additional underlyings for specified internal representation.

See AdditionalUnderlyings::getMap() for details about internal representation.

Template Parameters
MapLikeTypeThe type of map. std::map<K, V>, std::unordered_map<K, V>, QMap<K, V>, std::vector<std::pair<K, V>> etc. excluding the type std::initializer_list<std::pair<K, V>>. Where K is a string-like type and V is a type convertible to double.
Parameters
mapThe map-like container.
Returns
An instance of additional underlyings.
Exceptions
JavaException("IllegalArgumentException")if data contains invalid values.

◆ valueOf() [2/2]

AdditionalUnderlyings::Ptr AdditionalUnderlyings::valueOf ( const StringLike & text)
static

Returns an instance of additional underlyings for specified textual representation.

See AdditionalUnderlyings::getText() for format specification.

Parameters
textThe textual representation.
Exceptions
JavaException("IllegalArgumentException")if text uses wrong format or contains invalid values.