OpenMAMA
MamdaOptionChain.h
Go to the documentation of this file.
1 /* $Id$
2  *
3  * OpenMAMA: The open middleware agnostic messaging API
4  * Copyright (C) 2011 NYSE Technologies, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  */
21 
22 #ifndef MamdaOptionChainH
23 #define MamdaOptionChainH
24 
27 #include <set>
28 
29 using std::set;
30 
31 namespace Wombat
32 {
33 
34  class MamdaOptionContract;
35  class MamdaOptionExpirationDateSet;
36  class MamdaQuoteListener;
38 
39  typedef set<double> StrikeSet;
40 
47  class MAMDAOPTExpDLL MamdaOptionChain
48  {
51 
53  MamdaOptionChain& operator= (const MamdaOptionChain&);
54 
55  public:
56 
60  MamdaOptionChain (const char* symbol);
61 
65  ~MamdaOptionChain ();
66 
70  void setSymbol (const char* symbol);
71 
75  const char* getSymbol () const;
76 
82  void setUnderlyingQuoteListener (
83  const MamdaQuoteListener* quoteListener);
84 
90  void setUnderlyingTradeListener (
91  const MamdaTradeListener* tradeListener);
92 
97  const MamdaQuoteListener* getUnderlyingQuoteListener () const;
98 
103  const MamdaTradeListener* getUnderlyingTradeListener () const;
104 
111  void addContract (
112  const char* contractSymbol,
113  MamdaOptionContract* contract);
114 
125  void processNewContractDetails (
126  const char* contractSymbol,
127  MamdaOptionContract* contract);
128 
135  void removeContract (
136  const char* contractSymbol);
137 
142  double getAtTheMoney (
144 
151  void getStrikesWithinPercent (
152  StrikeSet& strikeSet,
153  double percentage,
155 
165  void getStrikesWithinRangeSize (
166  StrikeSet& strikeSet,
167  int rangeLength,
169 
174  bool getIsPriceWithinPercentOfMoney (
175  double price,
176  double percentage,
178 
179  class MAMDAOPTExpDLL iterator
180  {
181  public:
182  ~iterator ();
183 
184  iterator (const iterator&);
185  iterator& operator= (const iterator&);
186  bool hasNext();
187  MamdaOptionContract* next();
188 
189  protected:
190  friend class MamdaOptionChain;
191  struct iteratorImpl;
192  iterator (void*);
193  iteratorImpl* mIterImpl;
194  };
195 
196  class MAMDAOPTExpDLL const_iterator
197  {
198  public:
199  ~const_iterator ();
201  const_iterator& operator= (const const_iterator&);
202  bool hasNext();
203  const MamdaOptionContract* next();
204 
205  protected:
206  friend class MamdaOptionChain;
207  struct constIteratorImpl;
208  const_iterator (void*);
209  constIteratorImpl* mIterImpl;
210  };
211 
217  iterator callIterator();
218 
224  iterator putIterator();
225 
231  const_iterator callIterator() const;
232 
238  const_iterator putIterator() const;
239 
244  const MamdaOptionExpirationDateSet& getAllExpirations () const;
245 
249  void dump ();
250 
251  private:
252  struct MamdaOptionChainImpl;
253  MamdaOptionChainImpl& mImpl;
254  };
255 
256 } // namespace
257 
258 #endif // MamdaOptionChainH


© 2012 Linux Foundation