Classes Files

Wombat::MamdaOptionChain

MamdaOptionChain is a specialized class to represent market data option chains. The class has capabilities to store the current state of an entire option chain, or a subset of the chain.

Public Functions

  Name
  MamdaOptionChain(string symbol)
MamdaOptionChain Constructor.
void setSymbol(string symbol)
Set the underlying symbol for the option chain.
string getSymbol()
Get the underlying symbol for the option chain.
void setUnderlyingQuoteListener(MamdaQuoteListener quoteListener)
Set the underlying quote listener information. MamdaOptionChain does not use this class itself, but related classes might (e.g., MamdaOptionChainView).
void setUnderlyingTradeListener(MamdaTradeListener tradeListener)
Set the underlying trade listener information. MamdaOptionChain uses this class to implement the atTheMoney() method. Related classes might (e.g., MamdaOptionChainView) use it for other reasons.
MamdaQuoteListener getUnderlyingQuoteListener()
Make the underlying quote listener available externally.
MamdaTradeListener getUnderlyingTradeListener()
Make the underlying trade listener available externally.
MamdaOptionContract getContract(String contractSymbol)
Find an option contract by OPRA symbol.
SortedSet getExchanges()
Return the superset of regional exchange identifiers for any option in this chain. Each element in the set is a String object.
SortedSet getStrikePrices()
Return the superset of strike prices for this chain. Each element in the set is a Double object.
void addContract(string contractSymbol, MamdaOptionContract contract)
Add an option contract. This method would not normally be invoked by a user application. Rather, MamdaOptionChainListener would be most likely to call this method.
void removeContract(string contractSymbol)
Remove an option contract. This method would not normally be invoked by a user application. Rather, MamdaOptionChainListener would be most likely to call this method.
double getAtTheMoney(MamdaOptionAtTheMoneyCompareType compareType)
Get the price of the option underlying. Determine the underlying price (“at the money”), based on the mode of calculation.
bool getIsPriceWithinPercentOfMoney(double price, double percentage, MamdaOptionAtTheMoneyCompareType compareType)
Return whether the price is within a % of the money. Determine whether some price (e.g. a strike price) is within a given percentage range of the underlying (at the money) price.
SortedSet getStrikesWithinPercent(double percentage, MamdaOptionAtTheMoneyCompareType compareType)
Determine the set of strike prices that are included in a given percentage range of the underlying price. If there are no strikes within the percentage range, then both strike prices are set to zero. MamdaOptionAtTheMoneyCompareType
SortedSet getStrikesWithinRangeSize(int rangeLength, MamdaOptionAtTheMoneyCompareType compareType)
Determine the set of strike prices that are included in a given fixed size range of strikes surrounding the underlying price. If rangeLen is odd, then the strike price nearest to the underlying price is treated as a higher strike price. If rangeLen is even and the underlying price is exactly equal to a strike price, then that strike price is treated as a higher strike price. MamdaOptionAtTheMoneyCompareType
Iterator callIterator()
Return an iterator over all call option contracts. The type of object that Iterator.next() returns is
Iterator putIterator()
Return an iterator over all put option contracts. The type of object that Iterator.next() returns is MamdaOptionContract.
MamdaOptionExpirationDateSet getAllExpirations()
Return a set of MamdaOptionExpirationDateSet.
void dump()
Print the contents of the chain to standard out.

Public Functions Documentation

function MamdaOptionChain

MamdaOptionChain(
    string symbol
)

MamdaOptionChain Constructor.

Parameters:

  • symbol The underlying symbol.

function setSymbol

void setSymbol(
    string symbol
)

Set the underlying symbol for the option chain.

Parameters:

  • symbol The underlying symbol.

function getSymbol

string getSymbol()

Get the underlying symbol for the option chain.

Return: The underlying symbol for the option chain.

function setUnderlyingQuoteListener

void setUnderlyingQuoteListener(
    MamdaQuoteListener quoteListener
)

Set the underlying quote listener information. MamdaOptionChain does not use this class itself, but related classes might (e.g., MamdaOptionChainView).

Parameters:

  • quoteListener The quote listener for the chain.

function setUnderlyingTradeListener

void setUnderlyingTradeListener(
    MamdaTradeListener tradeListener
)

Set the underlying trade listener information. MamdaOptionChain uses this class to implement the atTheMoney() method. Related classes might (e.g., MamdaOptionChainView) use it for other reasons.

Parameters:

  • tradeListener The trade listener for the chain.

function getUnderlyingQuoteListener

MamdaQuoteListener getUnderlyingQuoteListener()

Make the underlying quote listener available externally.

Return: The quote listener for the chain.

function getUnderlyingTradeListener

MamdaTradeListener getUnderlyingTradeListener()

Make the underlying trade listener available externally.

Return: The trade listener for the chain.

function getContract

MamdaOptionContract getContract(
    String contractSymbol
)

Find an option contract by OPRA symbol.

Parameters:

  • contractSymbol

Return: MamdaOptionContract The contract object representing the option.

function getExchanges

SortedSet getExchanges()

Return the superset of regional exchange identifiers for any option in this chain. Each element in the set is a String object.

Return: Set of regional exchange identifiers.

function getStrikePrices

SortedSet getStrikePrices()

Return the superset of strike prices for this chain. Each element in the set is a Double object.

Return: Set of strike prices for the chain.

function addContract

void addContract(
    string contractSymbol,
    MamdaOptionContract contract
)

Add an option contract. This method would not normally be invoked by a user application. Rather, MamdaOptionChainListener would be most likely to call this method.

Parameters:

  • contractSymbol The option instrument symbol.
  • contract The Mamda option contract representation.

function removeContract

void removeContract(
    string contractSymbol
)

Remove an option contract. This method would not normally be invoked by a user application. Rather, MamdaOptionChainListener would be most likely to call this method.

Parameters:

  • contractSymbol

function getAtTheMoney

double getAtTheMoney(
    MamdaOptionAtTheMoneyCompareType compareType
)

Get the price of the option underlying. Determine the underlying price (“at the money”), based on the mode of calculation.

Parameters:

  • compareType The mode of calculation [(MamdaOptionAtTheMoneyCompareType)]

Return: The price of the underlying.

function getIsPriceWithinPercentOfMoney

bool getIsPriceWithinPercentOfMoney(
    double price,
    double percentage,
    MamdaOptionAtTheMoneyCompareType compareType
)

Return whether the price is within a % of the money. Determine whether some price (e.g. a strike price) is within a given percentage range of the underlying (at the money) price.

Parameters:

  • price The strike price to check.
  • percentage What % to check the strike price against.
  • compareType What price we are checking against [(see MamdaOptionAtTheMoneyCompareType)]

Return: Whether the price is within % of the money.

function getStrikesWithinPercent

SortedSet getStrikesWithinPercent(
    double percentage,
    MamdaOptionAtTheMoneyCompareType compareType
)

Determine the set of strike prices that are included in a given percentage range of the underlying price. If there are no strikes within the percentage range, then both strike prices are set to zero. MamdaOptionAtTheMoneyCompareType

Parameters:

  • percentage The percentage range of the underlying price.
  • compareType Which underlying price to compare to.

Return: Set of strike prices.

function getStrikesWithinRangeSize

SortedSet getStrikesWithinRangeSize(
    int rangeLength,
    MamdaOptionAtTheMoneyCompareType compareType
)

Determine the set of strike prices that are included in a given fixed size range of strikes surrounding the underlying price. If rangeLen is odd, then the strike price nearest to the underlying price is treated as a higher strike price. If rangeLen is even and the underlying price is exactly equal to a strike price, then that strike price is treated as a higher strike price. MamdaOptionAtTheMoneyCompareType

Parameters:

  • rangeLength Number of strike prices to include in result.
  • compareType What underlying price to use as a comparator.

Return: Resulting set of strike prices.

function callIterator

Iterator callIterator()

Return an iterator over all call option contracts. The type of object that Iterator.next() returns is

Return: The iterator of call options.

[MamdaOptionContract](classWombat_1_1MamdaOptionContract.html).

function putIterator

Iterator putIterator()

Return an iterator over all put option contracts. The type of object that Iterator.next() returns is MamdaOptionContract.

Return:

function getAllExpirations

MamdaOptionExpirationDateSet getAllExpirations()

Return a set of MamdaOptionExpirationDateSet.

Return: Set of expiration dates.

function dump

void dump()

Print the contents of the chain to standard out.


Updated on 2023-03-31 at 15:30:16 +0100