/usr/include/mamda/MamdaOptionChain.h is in libmamda-dev 2.2.2.1-10.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | /* $Id$
*
* OpenMAMA: The open middleware agnostic messaging API
* Copyright (C) 2011 NYSE Technologies, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef MamdaOptionChainH
#define MamdaOptionChainH
#include <mamda/MamdaOptionalConfig.h>
#include <mamda/MamdaOptionAtTheMoneyCompareType.h>
#include <set>
using std::set;
namespace Wombat
{
class MamdaOptionContract;
class MamdaOptionExpirationDateSet;
class MamdaQuoteListener;
class MamdaTradeListener;
typedef set<double> StrikeSet;
/**
* 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.
*/
class MAMDAOPTExpDLL MamdaOptionChain
{
/** No copying. */
MamdaOptionChain (const MamdaOptionChain&);
/** No assignment. */
MamdaOptionChain& operator= (const MamdaOptionChain&);
public:
/**
* MamdaOptionChain Constructor.
*/
MamdaOptionChain (const char* symbol);
/**
* MamdaOptionChain Destructor.
*/
~MamdaOptionChain ();
/**
* Set the underlying symbol for the option chain.
*/
void setSymbol (const char* symbol);
/**
* Get the underlying symbol for the option chain.
*/
const char* getSymbol () const;
/**
* Set the underlying quote information. The MamdaQuoteListener
* object would likely be an object that gets automatically
* updated by events handled elsewhere.
*/
void setUnderlyingQuoteListener (
const MamdaQuoteListener* quoteListener);
/**
* Set the underlying trade information. The MamdaTradeListener
* object would likely be an object that gets automatically
* updated by events handled elsewhere.
*/
void setUnderlyingTradeListener (
const MamdaTradeListener* tradeListener);
/**
* Get the underlying quote information. Returns the object
* provided by setUnderlyingQuoteListener(), if any.
*/
const MamdaQuoteListener* getUnderlyingQuoteListener () const;
/**
* Get the underlying trade information. Returns the object
* provided by setUnderlyingTradeListener(), if any.
*/
const MamdaTradeListener* getUnderlyingTradeListener () const;
/**
* 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 addContract (
const char* contractSymbol,
MamdaOptionContract* contract);
/**
* Add the contract to value-added-structures such as Put and Call
* side mappings and expiration by strike set, etc.
* Called by AddContract(const char*, MamdaOptionContract*).
* Can be called directly on a contract when additional
* mandatory fields are acquired for the contract that
* may enable it to be added to value-added-structures
* it wasn't added to (due to the lack of information)
* when first added to the chain.
*/
void processNewContractDetails (
const char* contractSymbol,
MamdaOptionContract* contract);
/**
* 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.
*/
void removeContract (
const char* contractSymbol);
/**
* Determine the underlying price ("at the money"), based on the
* mode of calculation.
*/
double getAtTheMoney (
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 the set will be
* empty.
*/
void getStrikesWithinPercent (
StrikeSet& strikeSet,
double percentage,
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.
*/
void getStrikesWithinRangeSize (
StrikeSet& strikeSet,
int rangeLength,
MamdaOptionAtTheMoneyCompareType compareType);
/**
* Determine whether some price (e.g. a strike price) is within a
* given percentage range of the underlying (at the money) price.
*/
bool getIsPriceWithinPercentOfMoney (
double price,
double percentage,
MamdaOptionAtTheMoneyCompareType compareType);
class MAMDAOPTExpDLL iterator
{
public:
~iterator ();
iterator (const iterator&);
iterator& operator= (const iterator&);
bool hasNext();
MamdaOptionContract* next();
protected:
friend class MamdaOptionChain;
struct iteratorImpl;
iterator (void*);
iteratorImpl* mIterImpl;
};
class MAMDAOPTExpDLL const_iterator
{
public:
~const_iterator ();
const_iterator (const const_iterator&);
const_iterator& operator= (const const_iterator&);
bool hasNext();
const MamdaOptionContract* next();
protected:
friend class MamdaOptionChain;
struct constIteratorImpl;
const_iterator (void*);
constIteratorImpl* mIterImpl;
};
/**
* Obtain an iterator to the beginning of the list of call
* options. Use the iterator::hasNext() to test for a subsequent
* iterator and use iterator::next() method to move to it.
*/
iterator callIterator();
/**
* Obtain an iterator to the beginning of the list of put
* options. Use the iterator::hasNext() to test for a subsequent
* iterator and use iterator::next() method to move to it.
*/
iterator putIterator();
/**
* Obtain an iterator to the beginning of the list of call
* options. Use the iterator::hasNext() to test for a subsequent
* iterator and use iterator::next() method to move to it.
*/
const_iterator callIterator() const;
/**
* Obtain an iterator to the beginning of the list of put
* options. Use the iterator::hasNext() to test for a subsequent
* iterator and use iterator::next() method to move to it.
*/
const_iterator putIterator() const;
/**
* Return the set of all expiration dates (which can be iterated
* over one date at a time).
*/
const MamdaOptionExpirationDateSet& getAllExpirations () const;
/**
* Dump the option chain to standard output.
*/
void dump ();
private:
struct MamdaOptionChainImpl;
MamdaOptionChainImpl& mImpl;
};
} // namespace
#endif // MamdaOptionChainH
|