OpenMAMA
Wombat::MamdaOptionChainView Class Reference

A class that represents a "view" of a subset of an option chain. More...

#include <MamdaOptionChainView.h>

Inheritance diagram for Wombat::MamdaOptionChainView:
Wombat::MamdaOptionChainHandler

Public Member Functions

 MamdaOptionChainView (MamdaOptionChain &chain)
 Create a view on the given option chain. More...
 
virtual ~MamdaOptionChainView ()
 Destructor. More...
 
const char * getSymbol () const
 Return the symbol for the option chain. More...
 
void setAtTheMoneyType (MamdaOptionAtTheMoneyCompareType atTheMoneyType)
 Set how the underlying price ("at the money") is determined. More...
 
void setStrikeRangePercent (double percentMargin)
 Set the range of strike prices to be included in the view by percentage variation from the underlying price. More...
 
void setStrikeRangeNumber (int number)
 Set the number of strike prices to be included in the view. More...
 
void setExpirationRangeDays (int expirationDays)
 Set the range of expiration dates to be included in the view by the maximum number of days until expiration. More...
 
void setNumberOfExpirations (int numExpirations)
 Set the number of expiration dates to be included in the view. More...
 
void setJitterMargin (double percentMargin)
 Set a "jitter margin" to avoid having the range jump between different strike prices when the underlying price hovers right on the edge of a range boundary. More...
 
bool isVisible (const MamdaOptionContract &contract) const
 Return whether an option contract falls within this view's parameters. More...
 
const MamdaOptionExpirationDateSetgetExpireDateSet () const
 Return the option expiration date set, which contains the subset of strike prices for the view, and the contracts within the strike price. More...
 
void onOptionChainRecap (MamdaSubscription *subscription, MamdaOptionChainListener &listener, const MamaMsg &msg, MamdaOptionChain &chain)
 Handler option chain recaps and initial values. More...
 
void onOptionContractCreate (MamdaSubscription *subscription, MamdaOptionChainListener &listener, const MamaMsg &msg, MamdaOptionContract &contract, MamdaOptionChain &chain)
 Handler for option chain structural updates. More...
 
void onOptionSeriesUpdate (MamdaSubscription *subscription, MamdaOptionChainListener &listener, const MamaMsg &msg, const MamdaOptionSeriesUpdate &event, MamdaOptionChain &chain)
 Handler for option chain structural updates. More...
 
void onOptionChainGap (MamdaSubscription *subscription, MamdaOptionChainListener &listener, const MamaMsg &msg, MamdaOptionChain &chain)
 Handler for gaps. More...
 
- Public Member Functions inherited from Wombat::MamdaOptionChainHandler
virtual ~MamdaOptionChainHandler ()
 

Detailed Description

A class that represents a "view" of a subset of an option chain.

The view can be restricted to a percentage or number of strike prices around "the money" as well as to a maximum number of days into the future. The view will be adjusted to include strike prices within the range as the underlying price moves. This means that the range of strike prices will change over time. In order to avoid a "jitter" in the range of strike prices when the underlying price hovers right on the edge of a range boundary, the class also provides a "jitter margin" as some percentage of the underlying price (default is 0.5%).

Constructor & Destructor Documentation

◆ MamdaOptionChainView()

Wombat::MamdaOptionChainView::MamdaOptionChainView ( MamdaOptionChain chain)

Create a view on the given option chain.

Multiple views are supported on any given option chain.

Parameters
chainThe MamdaOptionChain on which to provide a view.

◆ ~MamdaOptionChainView()

virtual Wombat::MamdaOptionChainView::~MamdaOptionChainView ( )
virtual

Destructor.

Member Function Documentation

◆ getSymbol()

const char* Wombat::MamdaOptionChainView::getSymbol ( ) const

Return the symbol for the option chain.

Returns
The symbol for the option chain.

◆ setAtTheMoneyType()

void Wombat::MamdaOptionChainView::setAtTheMoneyType ( MamdaOptionAtTheMoneyCompareType  atTheMoneyType)

Set how the underlying price ("at the money") is determined.

Parameters
atTheMoneyTypeThe comparator enumeration to determine how at the money is determined.
See also
MamdaOptionAtTheMoneyCompareType

◆ setStrikeRangePercent()

void Wombat::MamdaOptionChainView::setStrikeRangePercent ( double  percentMargin)

Set the range of strike prices to be included in the view by percentage variation from the underlying price.

The range of strike prices in the view will vary as the underlying varies. The "jitter margin" avoids switching between ranges too often.

Parameters
percentMarginPercentage variation the strike price has from the underlying.

◆ setStrikeRangeNumber()

void Wombat::MamdaOptionChainView::setStrikeRangeNumber ( int  number)

Set the number of strike prices to be included in the view.

The "jitter margin" avoids switching between ranges too often.

Parameters
numberThe number of strikes to include in the view.

◆ setExpirationRangeDays()

void Wombat::MamdaOptionChainView::setExpirationRangeDays ( int  expirationDays)

Set the range of expiration dates to be included in the view by the maximum number of days until expiration.

Note: a non-zero range overrides a specific number of expirations set by setNumberOfExpirations().

Parameters
expirationDaysThe maximum number of days until expiration.

◆ setNumberOfExpirations()

void Wombat::MamdaOptionChainView::setNumberOfExpirations ( int  numExpirations)

Set the number of expiration dates to be included in the view.

Note: a non-zero range (set by setExpirationRangeDays()) overrides a specific number of expirations.

Parameters
numExpirationsThe number of expiration dates to include in the view.

◆ setJitterMargin()

void Wombat::MamdaOptionChainView::setJitterMargin ( double  percentMargin)

Set a "jitter margin" to avoid having the range jump between different strike prices when the underlying price hovers right on the edge of a range boundary.

The underlying is allowed to fluctuate within the jitter margin without the range being reset. When the underlying moves beyond the jitter margin, the range is reset.

Parameters
percentMarginPercentage from the range boundary the underlying price can fluctuate without resetting the range.

◆ isVisible()

bool Wombat::MamdaOptionChainView::isVisible ( const MamdaOptionContract contract) const

Return whether an option contract falls within this view's parameters.

Parameters
contractThe contract which is being checked for visibility by the current view.

◆ getExpireDateSet()

const MamdaOptionExpirationDateSet& Wombat::MamdaOptionChainView::getExpireDateSet ( ) const

Return the option expiration date set, which contains the subset of strike prices for the view, and the contracts within the strike price.

Returns
The expiration date set for the option.

◆ onOptionChainRecap()

void Wombat::MamdaOptionChainView::onOptionChainRecap ( MamdaSubscription subscription,
MamdaOptionChainListener listener,
const MamaMsg &  msg,
MamdaOptionChain chain 
)
virtual

Handler option chain recaps and initial values.

Parameters
subscriptionThe subscription which received the update.
listenerThe listener instance which invoked this callback.
msgThe msg which resulted in the callback being invoked.
chainThe complete option chain.

Implements Wombat::MamdaOptionChainHandler.

◆ onOptionContractCreate()

void Wombat::MamdaOptionChainView::onOptionContractCreate ( MamdaSubscription subscription,
MamdaOptionChainListener listener,
const MamaMsg &  msg,
MamdaOptionContract contract,
MamdaOptionChain chain 
)
virtual

Handler for option chain structural updates.

Parameters
subscriptionThe subscription which received the update.
listenerThe listener instance which invoked this callback.
msgThe msg which resulted in the callback being invoked.
contractThe newly created option contract.
chainThe complete option chain.

Implements Wombat::MamdaOptionChainHandler.

◆ onOptionSeriesUpdate()

void Wombat::MamdaOptionChainView::onOptionSeriesUpdate ( MamdaSubscription subscription,
MamdaOptionChainListener listener,
const MamaMsg &  msg,
const MamdaOptionSeriesUpdate event,
MamdaOptionChain chain 
)
virtual

Handler for option chain structural updates.

Parameters
subscriptionThe subscription which received the update.
listenerThe listener which invoked this callback.
msgThe msg which resulted in the callback being invoked.
eventAccess to the series update event details.
chainThe complete option chain.

Implements Wombat::MamdaOptionChainHandler.

◆ onOptionChainGap()

void Wombat::MamdaOptionChainView::onOptionChainGap ( MamdaSubscription subscription,
MamdaOptionChainListener listener,
const MamaMsg &  msg,
MamdaOptionChain chain 
)
virtual

Handler for gaps.

Parameters
subscriptionThe subscription which received the update.
listenerThe listener which invoked this callback.
msgThe msg which resulted in the callback being invoked.
chainThe complete option chain.

Implements Wombat::MamdaOptionChainHandler.


The documentation for this class was generated from the following file:


© 2012 Linux Foundation