A class that represents a "view" of a subset of an option chain. More...
#include <MamdaOptionChainView.h>
Public Member Functions | |
MamdaOptionChainView (MamdaOptionChain &chain) | |
Create a view on the given option chain. | |
virtual | ~MamdaOptionChainView () |
Destructor. | |
const char * | getSymbol () const |
Return the symbol for the option chain. | |
void | setAtTheMoneyType (MamdaOptionAtTheMoneyCompareType atTheMoneyType) |
Set how the underlying price ("at the money") is determined. | |
void | setStrikeRangePercent (double percentMargin) |
Set the range of strike prices to be included in the view by percentage variation from the underlying price. | |
void | setStrikeRangeNumber (int number) |
Set the number of strike prices to be included in the view. | |
void | setExpirationRangeDays (int expirationDays) |
Set the range of expiration dates to be included in the view by the maximum number of days until expiration. | |
void | setNumberOfExpirations (int numExpirations) |
Set the number of expiration dates to be included in the view. | |
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. | |
bool | isVisible (const MamdaOptionContract &contract) const |
Return whether an option contract falls within this view's parameters. | |
const MamdaOptionExpirationDateSet & | 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. | |
void | onOptionChainRecap (MamdaSubscription *subscription, MamdaOptionChainListener &listener, const MamaMsg &msg, MamdaOptionChain &chain) |
Handler option chain recaps and initial values. | |
void | onOptionContractCreate (MamdaSubscription *subscription, MamdaOptionChainListener &listener, const MamaMsg &msg, MamdaOptionContract &contract, MamdaOptionChain &chain) |
Handler for option chain structural updates. | |
void | onOptionSeriesUpdate (MamdaSubscription *subscription, MamdaOptionChainListener &listener, const MamaMsg &msg, const MamdaOptionSeriesUpdate &event, MamdaOptionChain &chain) |
Handler for option chain structural updates. | |
void | onOptionChainGap (MamdaSubscription *subscription, MamdaOptionChainListener &listener, const MamaMsg &msg, MamdaOptionChain &chain) |
Handler for gaps. | |
![]() | |
virtual | ~MamdaOptionChainHandler () |
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%).
Wombat::MamdaOptionChainView::MamdaOptionChainView | ( | MamdaOptionChain & | chain | ) |
Create a view on the given option chain.
Multiple views are supported on any given option chain.
chain | The MamdaOptionChain on which to provide a view. |
|
virtual |
Destructor.
const char* Wombat::MamdaOptionChainView::getSymbol | ( | ) | const |
Return the symbol for the option chain.
void Wombat::MamdaOptionChainView::setAtTheMoneyType | ( | MamdaOptionAtTheMoneyCompareType | atTheMoneyType | ) |
Set how the underlying price ("at the money") is determined.
atTheMoneyType | The comparator enumeration to determine how at the money is determined. |
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.
percentMargin | Percentage variation the strike price has from the underlying. |
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.
number | The number of strikes to include in the view. |
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().
expirationDays | The maximum number of days until expiration. |
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.
numExpirations | The number of expiration dates to include in the view. |
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.
percentMargin | Percentage from the range boundary the underlying price can fluctuate without resetting the range. |
bool Wombat::MamdaOptionChainView::isVisible | ( | const MamdaOptionContract & | contract | ) | const |
Return whether an option contract falls within this view's parameters.
contract | The contract which is being checked for visibility by the current view. |
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.
|
virtual |
Handler option chain recaps and initial values.
subscription | The subscription which received the update. |
listener | The listener instance which invoked this callback. |
msg | The msg which resulted in the callback being invoked. |
chain | The complete option chain. |
Implements Wombat::MamdaOptionChainHandler.
|
virtual |
Handler for option chain structural updates.
subscription | The subscription which received the update. |
listener | The listener instance which invoked this callback. |
msg | The msg which resulted in the callback being invoked. |
contract | The newly created option contract. |
chain | The complete option chain. |
Implements Wombat::MamdaOptionChainHandler.
|
virtual |
Handler for option chain structural updates.
subscription | The subscription which received the update. |
listener | The listener which invoked this callback. |
msg | The msg which resulted in the callback being invoked. |
event | Access to the series update event details. |
chain | The complete option chain. |
Implements Wombat::MamdaOptionChainHandler.
|
virtual |
Handler for gaps.
subscription | The subscription which received the update. |
listener | The listener which invoked this callback. |
msg | The msg which resulted in the callback being invoked. |
chain | The complete option chain. |
Implements Wombat::MamdaOptionChainHandler.