OnixS C++ Eurex T7 Market and Reference Data Interface (EMDI, RDI, EOBI) Handlers  7.0.3
API documentation
EditableOrderBook.h
Go to the documentation of this file.
1 /*
2 * Copyright 2002-2010 ONIX SOLUTIONS LIMITED. All rights reserved.
3 *
4 * This software owned by ONIX SOLUTIONS LIMITED [ONIXS] and is protected by copyright law
5 * and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable ONIXS Software
8 * Services Agreement (the Agreement) and Customer end user license agreements granting
9 * a non-assignable, non-transferable and non-exclusive license to use the software
10 * for it's own data processing purposes under the terms defined in the Agreement.
11 *
12 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13 * of this source code or associated reference material to any other location for further reproduction
14 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15 *
16 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17 * the terms of the Agreement is a violation of copyright law.
18 */
19 
20 #pragma once
21 
22 #include "HandlerLogger.h"
23 
27 
28 namespace OnixS {
29 namespace Eurex {
30 namespace MarketData {
31 namespace Implementation{
32 
33 class EditableOrderBook : public OrderBook, public Logging::LogFacility
34 {
35 public:
36  EditableOrderBook(SecurityId securityId, size_t bookDepth, LogFacility* parent, HandlerCore::Common::HandlerLogger* logger);
37 
38  const PriceLevels& asks() const;
39  const PriceLevels& bids() const;
40 
41  bool bestAsk(Decimal& price, Quantity& quantity) const;
42  bool bestBid(Decimal& price, Quantity& quantity) const;
43 
44  UInt64 mdEntryTime () const;
46  void setLastMsgSeqNumProcessed(UInt32 lastMsgSeqNumProcessed);
47 
48  void apply(const MDSnapshotEntry& entry, MDEntryType::Enum entryType);
49  void apply(const MDIncrementalEntry& entry, MDEntryType::Enum entryType);
50  void emptyBook(const MDSnapshotEntry& entry);
51 
52  void clear();
53 
54  void checkSanity() const;
55 
56  /// Log helper.
57  template<typename TMsg>
58  void log (const TMsg & msg) { logger_->log (msg); }
59 
60 private:
61  HandlerCore::Common::HandlerLogger* logger_;
62 
63  bool bestAskAvailable_;
64  bool bestBidAvailable_;
65 
66  UInt64 entryTime_;
67  UInt32 lastMsgSeqNumProcessed_;
68 
69  PriceLevels asks_;
70  PriceLevels bids_;
71 
72  Decimal bestAskPrice_;
73  Quantity bestAskQuantity_;
74 
75  Decimal bestBidPrice_;
76  Quantity bestBidQuantity_;
77 };
78 
79 }}}}
80 
81 
UInt32 lastMsgSeqNumProcessed() const
Sequence number of the last processed message.
UInt64 mdEntryTime() const
For bids and offers the official time of book entry, for trades official time of execution (all in na...
bool bestBid(Decimal &price, Quantity &quantity) const
Returns best implied bid.
const PriceLevels & asks() const
Returns a set of descending bid prices for the given security.
const PriceLevels & bids() const
Returns a set of ascending ask prices for the given security.
unsigned int UInt32
Definition: Numeric.h:41
Definition: Group.h:25
Decimal type for better precision.
Definition: Numeric.h:63
SecurityId securityId() const
Definition: OrderBook.h:234
PriceLevelCollections::Array PriceLevels
Sequence of price levels.
Definition: OrderBook.h:135
Int64 SecurityId
Alias for Security Id type.
Definition: Defines.h:51
void apply(const MDSnapshotEntry &entry, MDEntryType::Enum entryType)
bool bestAsk(Decimal &price, Quantity &quantity) const
Returns best implied ask.
UInt64 Quantity
Alias for Quantity type.
Definition: Defines.h:54
Market data snapshot entry.
Definition: DepthSnapshot.h:37
EditableOrderBook(SecurityId securityId, size_t bookDepth, LogFacility *parent, HandlerCore::Common::HandlerLogger *logger)