dxFeed Graal CXX API v4.2.0
Loading...
Searching...
No Matches
OptionChainsBuilder< T > Class Template Reference

Builder class for a set of option chains grouped by product or underlying symbol. More...

#include <OptionChainsBuilder.hpp>

Public Member Functions

 OptionChainsBuilder ()=default
 Creates new option chains builder.
 
void setProduct (const std::string &product)
 Changes product for futures and options on futures (underlying asset name).
 
void setUnderlying (const std::string &underlying)
 Changes primary underlying symbol for options.
 
void setExpiration (std::int32_t expiration)
 Changes day id of expiration.
 
void setLastTrade (std::int32_t lastTrade)
 Changes day id of last trading day.
 
void setMultiplier (double multiplier)
 Changes market value multiplier.
 
void setSPC (double spc)
 Changes shares per contract for options.
 
void setAdditionalUnderlyings (const std::string &additionalUnderlyings)
 Changes additional underlyings for options, including additional cash.
 
void setMMY (const std::string &mmy)
 Changes maturity month-year as provided for corresponding FIX tag (200).
 
void setOptionType (const std::string &optionType)
 Changes type of option.
 
void setExpirationStyle (const std::string &expirationStyle)
 Changes the expiration cycle style, such as "Weeklys", "Quarterlys".
 
void setSettlementStyle (const std::string &settlementStyle)
 Changes settlement price determination style, such as "Open", "Close".
 
void setCFI (const std::string &cfi)
 Changes Classification of Financial Instruments code.
 
void setStrike (double strike)
 Changes strike price for options.
 
void addOption (std::shared_ptr< T > option)
 Adds an option instrument to this builder.
 
const std::unordered_map< std::string, OptionChain< T > > & getChains ()
 Returns a view of chains created by this builder.
 

Static Public Member Functions

template<typename Collection, typename Element = std::decay_t<decltype(std::begin(Collection()))>, typename Profile = std::decay_t<decltype(*Element())>>
static OptionChainsBuilder< InstrumentProfilebuild (const Collection &instruments)
 Builds options chains for all options from the given collections of instrument profiles.
 

Detailed Description

template<class T>
class OptionChainsBuilder< T >

Builder class for a set of option chains grouped by product or underlying symbol.

Threads and clocks

This class is NOT thread-safe and cannot be used from multiple threads without external synchronization.

Template Parameters
TThe type of option instrument instances.

Member Function Documentation

◆ addOption()

template<class T>
void OptionChainsBuilder< T >::addOption ( std::shared_ptr< T > option)
inline

Adds an option instrument to this builder.

Option is added to chains for the currently set product and/or underlying to the series that corresponding to all other currently set attributes. This method is safe in the sense that is ignores illegal state of the builder. It only adds an option when all the following conditions are met:

All the attributes remain set as before after the call to this method, but chains are updated correspondingly.

Parameters
optionThe option to add.

◆ build()

template<class T>
template<typename Collection, typename Element = std::decay_t<decltype(std::begin(Collection()))>, typename Profile = std::decay_t<decltype(*Element())>>
static OptionChainsBuilder< InstrumentProfile > OptionChainsBuilder< T >::build ( const Collection & instruments)
inlinestatic

Builds options chains for all options from the given collections of instrument profiles.

Template Parameters
CollectionThe collection type.
Parameters
instrumentsThe collection of instrument profiles.
Returns
The builder with all the options from instruments collection.

◆ getChains()

template<class T>
const std::unordered_map< std::string, OptionChain< T > > & OptionChainsBuilder< T >::getChains ( )
inline

Returns a view of chains created by this builder.

It updates as new options are added with addOption method.

Returns
The view of chains created by this builder.

◆ setAdditionalUnderlyings()

template<class T>
void OptionChainsBuilder< T >::setAdditionalUnderlyings ( const std::string & additionalUnderlyings)
inline

Changes additional underlyings for options, including additional cash.

It shall use following format:

<VALUE> ::= <empty> | <LIST>
<LIST> ::= <AU> | <AU> <semicolon> <space> <LIST>
<AU> ::= <UNDERLYING> <space> <SPC>
the list shall be sorted by <UNDERLYING>.

Example: "SE 50", "FIS 53; US$ 45.46".

Parameters
additionalUnderlyingsThe additional underlyings for options, including additional cash.

◆ setCFI()

template<class T>
void OptionChainsBuilder< T >::setCFI ( const std::string & cfi)
inline

Changes Classification of Financial Instruments code.

It is a mandatory field as it is the only way to distinguish Call/Put option type, American/European exercise, Cash/Physical delivery. It shall use six-letter CFI code from ISO 10962 standard. It is allowed to use 'X' extensively and to omit trailing letters (assumed to be 'X'). See ISO 10962 on Wikipedia.

Example: "OC" for generic call, "OP" for generic put.

Parameters
cfiCFI code.

◆ setExpiration()

template<class T>
void OptionChainsBuilder< T >::setExpiration ( std::int32_t expiration)
inline

Changes day id of expiration.

Example: day_util::#getDayIdByYearMonthDay() "dxfcpp::day_util::getDayIdByYearMonthDay"(20090117).

Parameters
expirationThe day id of expiration.

◆ setExpirationStyle()

template<class T>
void OptionChainsBuilder< T >::setExpirationStyle ( const std::string & expirationStyle)
inline

Changes the expiration cycle style, such as "Weeklys", "Quarterlys".

Parameters
expirationStyleThe expiration cycle style.

◆ setLastTrade()

template<class T>
void OptionChainsBuilder< T >::setLastTrade ( std::int32_t lastTrade)
inline

Changes day id of last trading day.

Example: day_util::#getDayIdByYearMonthDay() "dxfcpp::day_util::getDayIdByYearMonthDay"(20090116).

Parameters
lastTradeThe day id of last trading day.

◆ setMMY()

template<class T>
void OptionChainsBuilder< T >::setMMY ( const std::string & mmy)
inline

Changes maturity month-year as provided for corresponding FIX tag (200).

It can use several different formats depending on data source:

  • YYYYMM – if only year and month are specified
  • YYYYMMDD – if full date is specified
  • YYYYMMwN – if week number (within a month) is specified
Parameters
mmyThe maturity month-year as provided for corresponding FIX tag (200).

◆ setMultiplier()

template<class T>
void OptionChainsBuilder< T >::setMultiplier ( double multiplier)
inline

Changes market value multiplier.

Example: 100, 33.2.

Parameters
multiplierThe market value multiplier.

◆ setOptionType()

template<class T>
void OptionChainsBuilder< T >::setOptionType ( const std::string & optionType)
inline

Changes type of option.

It shall use one of following values:

  • STAN = Standard Options
  • LEAP = Long-term Equity AnticiPation Securities
  • SDO = Special Dated Options
  • BINY = Binary Options
  • FLEX = FLexible EXchange Options
  • VSO = Variable Start Options
  • RNGE = Range
Parameters
optionTypeThe type of option.

◆ setProduct()

template<class T>
void OptionChainsBuilder< T >::setProduct ( const std::string & product)
inline

Changes product for futures and options on futures (underlying asset name).

Example: "/YG".

Parameters
productThe product for futures and options on futures (underlying asset name).

◆ setSettlementStyle()

template<class T>
void OptionChainsBuilder< T >::setSettlementStyle ( const std::string & settlementStyle)
inline

Changes settlement price determination style, such as "Open", "Close".

Parameters
settlementStyleThe settlement price determination style.

◆ setSPC()

template<class T>
void OptionChainsBuilder< T >::setSPC ( double spc)
inline

Changes shares per contract for options.

Example: 1, 100.

Parameters
spcThe shares per contract for options.

◆ setStrike()

template<class T>
void OptionChainsBuilder< T >::setStrike ( double strike)
inline

Changes strike price for options.

Example: 80, 22.5.

Parameters
strikeThe strike price for options.

◆ setUnderlying()

template<class T>
void OptionChainsBuilder< T >::setUnderlying ( const std::string & underlying)
inline

Changes primary underlying symbol for options.

Example: "C", "/YGM9"

Parameters
underlyingThe primary underlying symbol for options.