OnixS C++ Eurex T7 Market and Reference Data (EMDI, MDI, RDI, EOBI) Handlers 20.0.1
Users' manual and API documentation
Loading...
Searching...
No Matches
Backtesting Sample

This sample demonstrates how to replay log files for the RDI, EMDI and EOBI feeds.

Source code

1/*
2* Copyright Onix Solutions Limited [OnixS]. 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*/
22
23#include "RdiListener.h"
24#include "EmdiListener.h"
25#include "EobiListener.h"
26
27#include "../Common/Options.h"
28#include "../Common/Settings.h"
29
30using namespace OnixS::Eurex::MarketData;
31using namespace OnixS::Eurex::MarketData::EOBI;
32
33class LogReplayConfiguration : public virtual Samples::ConfigurationBase
34{
35public:
36 std::string rdiReplaySource() const
37 {
38 return argOrDefault(options(), "rdiReplaySource", "./logToReplay/rdi.log.bz2");
39 }
40
41 std::string emdiReplaySource() const
42 {
43 return argOrDefault(options(), "emdiReplaySource", "./logToReplay/emdi.log.bz2");
44 }
45
46 std::string eobiReplaySource() const
47 {
48 return argOrDefault(options(), "eobiReplaySource", "./logToReplay/eobi.log.bz2");
49 }
50
51protected:
52 LogReplayConfiguration(size_t qty, char** args)
53 : ConfigurationBase(qty, args)
54 {
55 }
56
57 void showOptions(std::ostream& out) const override
58 {
59 out
60 << " --rdiReplaySource [filePath]" << std::endl
61 << "\tDefault value is ['./logToReplay/rdi.log.bz2']" << std::endl
62 << " --emdiReplaySource [filePath]" << std::endl
63 << "\tDefault value is ['./logToReplay/emdi.log.bz2']" << std::endl
64 << " --eobiReplaySource [filePath]" << std::endl
65 << "\tDefault value is ['./logToReplay/eobi.log.bz2']" << std::endl
66 ;
67 }
68};
69
70template <typename Configuration>
71void runRdiHandler(const Configuration& cfg)
72{
73 RdiListener listener;
74
75 NoDelayReplay replayOptions;
76 replayOptions.logs = {cfg.rdiReplaySource()};
77 replayOptions.listener = &listener;
78
79 RdiHandler handler(Samples::makeSettings<RdiHandlerSettings>(cfg));
80 handler.registerErrorListener(&listener);
81 handler.registerWarningListener(&listener);
82 handler.registerReferenceDataListener(&listener);
83
84 std::clog << "Will start the RDI Handler in replay log mode ..." << std::endl;
85 handler.start(replayOptions);
86
87 listener.waitUntilReplayFinished();
88
89 std::clog << "RDI Handler Replay finished" << std::endl;
90}
91
92template <typename Configuration>
93void runEmdiHandler(const Configuration& cfg)
94{
95 EmdiListener listener;
96
97 NoDelayReplay replayOptions;
98 replayOptions.logs = {cfg.emdiReplaySource()};
99 replayOptions.listener = &listener;
100
101 EmdiHandler handler(Samples::makeSettings<EmdiHandlerSettings>(cfg));
102 listener.subscribe(handler);
103
105 map[190] = 10;
106
107 handler.setMarketSegmentId2Depth(map);
108
109 handler.setPartitionIdFilters({3});
110 handler.setMarketSegmentIdFilters({190});
111
112 std::clog << "Will start the EMDI Handler in replay log mode ..." << std::endl;
113 handler.start(replayOptions);
114
115 listener.waitUntilReplayFinished();
116
117 std::clog << "EMDI Handler Replay finished" << std::endl;
118}
119
120template <typename Configuration>
121void runEobiHandler(const Configuration& cfg)
122{
123 EobiListener listener;
124
125 NoDelayReplay replayOptions;
126 replayOptions.logs = {cfg.eobiReplaySource()};
127 replayOptions.listener = &listener;
128
129 auto settings = Samples::makeSettings<EobiHandlerSettings>(cfg);
130 settings.bookDepth = 10;
131
132 EobiHandler handler(settings);
133 listener.subscribe(handler);
134
135 std::clog << "Will start the EOBI Handler in replay log mode ..." << std::endl;
136 handler.start(replayOptions);
137
138 listener.waitUntilReplayFinished();
139 std::clog << "EOBI Handler Replay finished" << std::endl;
140}
141
143int main(int argc, char* argv[])
144{
145 // `--help` to show options.
146 const Samples::AppConfiguration<Samples::LogDirectoryConfiguration, LogReplayConfiguration> cfg{"Backtesting", argc, argv};
147
148 try
149 {
150 runRdiHandler(cfg);
151 runEmdiHandler(cfg);
152 runEobiHandler(cfg);
153 }
154 catch(const std::exception& ex)
155 {
156 std::cerr << "EXCEPTION: " << ex.what() << std::endl;
157 }
158
159 return 0;
160}
Eurex Enhanced Order Book Interface Handler.
Definition EobiHandler.h:55
Eurex Enhanced Market Data Interface Handler.
Definition EmdiHandler.h:60
Eurex Reference Data Interface Handler.
Definition RdiHandler.h:44
MarketDepthTraits::MarketSegmentId2Depth MarketSegmentId2Depth
Set the ReplayOptions to run the replay at maximal speed.
Definition Replay.h:139
ReplayListener * listener
Instance to notify about replay events.
Definition Replay.h:95
1#pragma once
2/*
3* Copyright Onix Solutions Limited [OnixS]. All rights reserved.
4*
5* This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
6* and international copyright treaties.
7*
8* Access to and use of the software is governed by the terms of the applicable ONIXS Software
9* Services Agreement(the Agreement) and Customer end user license agreements granting
10* a non-assignable, non-transferable and non-exclusive license to use the software
11* for it's own data processing purposes under the terms defined in the Agreement.
12*
13* Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
14* of this source code or associated reference material to any other location for further reproduction
15* or redistribution, and any amendments to this copyright notice, are expressly prohibited.
16*
17* Any reproduction or redistribution for sale or hiring of the Software not in accordance with
18* the terms of the Agreement is a violation of copyright law.
19*/
20#include <iostream>
21
27
28
29class RdiListener final
34{
35public:
37 RdiListener();
38
40 ~RdiListener() override;
41
43 void onError(OnixS::Eurex::MarketData::ErrorCode::Enum code, const std::string& description) override;
44
46 void onWarning(const std::string& description) override;
47
48 void onReplayError(const std::string& errorDescription) override
49 {
50 std::clog << "Replay error: " << errorDescription << std::endl;
51 replaySemaphore_.release();
52 }
53
54 void onReplayFinished() override
55 {
56 replaySemaphore_.release();
57 }
58
60 void waitUntilReplayFinished()
61 {
62 replaySemaphore_.acquire();
63 }
64
66 void onSnapshotCycleStart() override;
67
69 void onProduct(const OnixS::Eurex::MarketData::ProductSnapshot& productSnapshot, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
70
72 void onInstrument(const OnixS::Eurex::MarketData::InstrumentSnapshot& msg, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
73
75 void onInstrumentIncremental(const OnixS::Eurex::MarketData::InstrumentIncremental& msg, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
76
78 void onVarianceFuturesStatus(const OnixS::Eurex::MarketData::VarianceFuturesStatus& msg, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
79
81 void onTotalReturnFuturesStatus(const OnixS::Eurex::MarketData::TotalReturnFuturesStatus& msg, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
82
84 void onTradeAtReferencePriceStatus(const OnixS::Eurex::MarketData::TradeAtReferencePriceStatus& msg, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
85
87 void onSnapshotCycleEnd() override;
88
89private:
91 OnixS::Eurex::MarketData::Semaphore replaySemaphore_;
92};
virtual void onError(ErrorCode::Enum code, const std::string &description)=0
virtual void onTradeAtReferencePriceStatus(const TradeAtReferencePriceStatus &status, const DataSource &dataSource)=0
Is called when TradeAtReferencePriceStatus message is received.
virtual void onSnapshotCycleStart()=0
Is called when reference data snapshot cycle is started.
virtual void onVarianceFuturesStatus(const VarianceFuturesStatus &status, const DataSource &dataSource)=0
Is called when variance futures status is received.
virtual void onSnapshotCycleEnd()=0
Is called when reference data snapshot cycle is ended.
virtual void onInstrumentIncremental(const InstrumentIncremental &incremental, const DataSource &dataSource)=0
Is called when instrument incremental update is received.
virtual void onProduct(const ProductSnapshot &snapshot, const DataSource &dataSource)=0
Is called when product snapshot is received.
virtual void onTotalReturnFuturesStatus(const TotalReturnFuturesStatus &status, const DataSource &dataSource)=0
Is called when total return futures status message is received.
virtual void onInstrument(const InstrumentSnapshot &snapshot, const DataSource &dataSource)=0
Is called when instrument snapshot is received.
Listening interface for log replay-related events.
Definition Replay.h:41
virtual void onReplayFinished()=0
Is called once the replay is finished.
virtual void onReplayError(const std::string &errorDescription)=0
Is called once error occurs while replaying.
virtual void onWarning(const std::string &reason)=0
Is called when the Warning condition is detected.
Enum
Known (selected) error codes.
1/*
2* Copyright Onix Solutions Limited [OnixS]. 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#include <sstream>
20
21#include "RdiListener.h"
22
23using namespace OnixS::Eurex::MarketData;
24
25/*
26 RdiListener
27*/
28
29RdiListener::RdiListener()
30 : replaySemaphore_(0)
31{
32}
33
34RdiListener::~RdiListener() = default;
35
36void RdiListener::onError(ErrorCode::Enum code, const std::string& description)
37{
38 std::clog << "Error occurred, errorCode = " << enumToString(code) << ". Description: '" << description << "'" << std::endl;
39}
40
41void RdiListener::onWarning(const std::string& description)
42{
43 std::stringstream ss;
44 std::clog << "Warning occurred. Description: '" << description << "'" << std::endl;
45}
46
47void RdiListener::onSnapshotCycleStart()
48{
49}
50
51void RdiListener::onProduct(const ProductSnapshot& msg, const DataSource&)
52{
53 std::clog << "Message received: " << msg.toString('|') << std::endl;
54}
55
56void RdiListener::onInstrument(const InstrumentSnapshot&, const DataSource&)
57{
58}
59
60void RdiListener::onInstrumentIncremental(const InstrumentIncremental&, const DataSource&)
61{
62}
63
64void RdiListener::onVarianceFuturesStatus(const VarianceFuturesStatus&, const DataSource&)
65{
66}
67
68void RdiListener::onTotalReturnFuturesStatus(const TotalReturnFuturesStatus&, const DataSource&)
69{
70}
71
72void RdiListener::onTradeAtReferencePriceStatus(const TradeAtReferencePriceStatus&, const DataSource&)
73{
74}
75
76void RdiListener::onSnapshotCycleEnd()
77{
78 replaySemaphore_.release();
79}
std::string toString(char delimiter=0x1, MessageStringingFlags flags=MessageStringingFlag::IncludeFieldTagNumber) const
Definition Message.h:176
std::string enumToString(HandlerState::Enum)
Returns string representation of HandlerState value.
1/*
2* Copyright Onix Solutions Limited [OnixS]. 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#pragma once
20
21#include <iostream>
22#include <sstream>
23
40
41class EmdiListener final
56{
57public:
59 EmdiListener();
60
62 ~EmdiListener() override;
63
64 void subscribe(OnixS::Eurex::MarketData::EmdiHandler& handler);
65
67 void onError(OnixS::Eurex::MarketData::ErrorCode::Enum code, const std::string& description) override;
68
70 void onWarning(const std::string& description) override;
71
72 void onReplayError(const std::string& errorDescription) override
73 {
74 std::clog << "Replay error: " << errorDescription << std::endl;
75 replaySemaphore_.release();
76 }
77
78 void onReplayFinished() override
79 {
80 replaySemaphore_.release();
81 }
82
84 void waitUntilReplayFinished()
85 {
86 replaySemaphore_.acquire();
87 }
88
89 void onDepthSnapshot(const OnixS::Eurex::MarketData::DepthSnapshot& snapshot, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
90
92 void onDepthIncremental(const OnixS::Eurex::MarketData::DepthIncremental& incremental, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
93
95 void onDepthReset(OnixS::Eurex::MarketData::MarketSegmentId marketSegmentId) override;
96
99
101 void onTopOfBookImplied(const OnixS::Eurex::MarketData::TopOfBookImplied& msg, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
102
104 void onProductStateChange(const OnixS::Eurex::MarketData::ProductStateChange& change, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
105
107 void onMassInstrumentStateChange(const OnixS::Eurex::MarketData::MassInstrumentStateChange& change, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
108
110 void onInstrumentStateChange(const OnixS::Eurex::MarketData::InstrumentStateChange& change, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
111
113 void onQuoteRequest(const OnixS::Eurex::MarketData::QuoteRequest& request, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
114
116 void onCrossRequest(const OnixS::Eurex::MarketData::CrossRequest& request, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
117
119 void onComplexInstrumentUpdate(const OnixS::Eurex::MarketData::ComplexInstrumentUpdate& update, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
120
122 void onFlexibleInstrumentUpdate(const OnixS::Eurex::MarketData::FlexibleInstrumentUpdate& update, const OnixS::Eurex::MarketData::DataSource& dataSource) override;
123
125 void onOrderBookUpdated(const OnixS::Eurex::MarketData::OrderBook& book) override;
126
128 void onOrderBookOutOfDate(const OnixS::Eurex::MarketData::OrderBook& book) override;
129
131 void onSnapshotTrade(const OnixS::Eurex::MarketData::SnapshotTrade& trade) override;
132
134 void onIncrementalTrade(const OnixS::Eurex::MarketData::IncrementalTrade& trade) override;
135
136private:
138 OnixS::Eurex::MarketData::Semaphore replaySemaphore_;
139};
virtual void onComplexInstrumentUpdate(const ComplexInstrumentUpdate &update, const DataSource &dataSource)=0
Is called when complex instrument update is received.
virtual void onCrossRequest(const CrossRequest &request, const DataSource &dataSource)=0
Is called when cross request is received.
virtual void onDepthReset(MarketSegmentId marketSegmentId)=0
Is called when all the books are reset for a given market segment.
virtual void onDepthOutOfDate(MarketSegmentId marketSegmentId)=0
virtual void onDepthSnapshot(const DepthSnapshot &snapshot, const DataSource &dataSource)=0
Is called when depth snapshot is received.
virtual void onDepthIncremental(const DepthIncremental &incremental, const DataSource &dataSource)=0
Is called when depth incremental is received.
virtual void onFlexibleInstrumentUpdate(const FlexibleInstrumentUpdate &update, const DataSource &dataSource)=0
Is called when mass instrument state change is received.
virtual void onInstrumentStateChange(const InstrumentStateChange &change, const DataSource &dataSource)=0
Is called when instrument state change is received.
virtual void onMassInstrumentStateChange(const MassInstrumentStateChange &change, const DataSource &dataSource)=0
Is called when mass instrument state change is received.
virtual void onOrderBookUpdated(const OrderBook &book)=0
virtual void onOrderBookOutOfDate(const OrderBook &book)=0
virtual void onProductStateChange(const ProductStateChange &change, const DataSource &dataSource)=0
Is called when product state change is received.
virtual void onQuoteRequest(const QuoteRequest &request, const DataSource &dataSource)=0
Is called when quote request is received.
virtual void onTopOfBookImplied(const TopOfBookImplied &msg, const DataSource &dataSource)=0
Is called when Top Of Book Implied message is received.
virtual void onSnapshotTrade(const SnapshotTrade &trade)=0
Is called when a snapshot trade market data entry is received.
virtual void onIncrementalTrade(const IncrementalTrade &trade)=0
Is called when a incremental trade market data entry is received.
UInt32 MarketSegmentId
Alias for Market Segment ID type.
Definition Defines.h:40
1/*
2* Copyright Onix Solutions Limited [OnixS]. 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#include "EmdiListener.h"
20
21using namespace OnixS::Eurex::MarketData;
22
23/*
24 EmdiListener
25*/
26
27EmdiListener::EmdiListener()
28 : replaySemaphore_(0)
29{
30}
31
32void EmdiListener::subscribe(OnixS::Eurex::MarketData::EmdiHandler& handler)
33{
34 handler.registerErrorListener(this);
35 handler.registerWarningListener(this);
36 handler.registerDepthListener(this);
41 handler.registerQuoteRequestListener(this);
42 handler.registerCrossRequestListener(this);
45 handler.registerOrderBookListener(this);
46 handler.registerTradeListener(this);
47}
48
49EmdiListener::~EmdiListener() = default;
50
51void EmdiListener::onError(ErrorCode::Enum code, const std::string& description)
52{
53 std::clog << "Error occurred, errorCode = " << enumToString(code) << ". Description: '" << description << "'" << std::endl;
54}
55
56void EmdiListener::onWarning(const std::string& description)
57{
58 std::stringstream ss;
59 std::clog << "Warning occurred. Description: '" << description << "'" << std::endl;
60}
61
62void EmdiListener::onDepthSnapshot(const DepthSnapshot& msg, const DataSource&)
63{
64 std::clog << "Message received: " << msg.toString('|') << std::endl;
65}
66
67void EmdiListener::onDepthIncremental(const DepthIncremental& msg, const DataSource&)
68{
69 std::clog << "Message received: " << msg.toString('|') << std::endl;
70}
71
72void EmdiListener::onDepthReset(MarketSegmentId)
73{
74}
75
76void EmdiListener::onDepthOutOfDate(MarketSegmentId)
77{
78}
79
80void EmdiListener::onTopOfBookImplied(const TopOfBookImplied&, const DataSource&)
81{
82}
83
84void EmdiListener::onProductStateChange(const ProductStateChange&, const DataSource&)
85{
86}
87
88void EmdiListener::onMassInstrumentStateChange(const MassInstrumentStateChange&, const DataSource&)
89{
90}
91
92void EmdiListener::onInstrumentStateChange(const InstrumentStateChange&, const DataSource&)
93{
94}
95
96void EmdiListener::onQuoteRequest(const QuoteRequest&, const DataSource&)
97{
98}
99
100void EmdiListener::onCrossRequest(const CrossRequest&, const DataSource&)
101{
102}
103
104void EmdiListener::onComplexInstrumentUpdate(const ComplexInstrumentUpdate&, const DataSource&)
105{
106}
107
108void EmdiListener::onFlexibleInstrumentUpdate(const FlexibleInstrumentUpdate&, const DataSource&)
109{
110}
111
112void EmdiListener::onOrderBookUpdated(const OrderBook&)
113{
114}
115
116void EmdiListener::onOrderBookOutOfDate(const OrderBook&)
117{
118}
119
120void EmdiListener::onSnapshotTrade(const SnapshotTrade&)
121{
122}
123
124void EmdiListener::onIncrementalTrade(const IncrementalTrade&)
125{
126}
EmdiHandler & registerWarningListener(WarningListener *listener)
EmdiHandler & registerErrorListener(ErrorListener *listener)
EmdiHandler & registerCrossRequestListener(CrossRequestListener *listener)
EmdiHandler & registerMassInstrumentStateChangeListener(MassInstrumentStateChangeListener *listener)
EmdiHandler & registerTopOfBookImpliedListener(TopOfBookImpliedListener *listener)
EmdiHandler & registerTradeListener(TradeListener *listener)
EmdiHandler & registerQuoteRequestListener(QuoteRequestListener *listener)
EmdiHandler & registerComplexInstrumentUpdateListener(ComplexInstrumentUpdateListener *listener)
EmdiHandler & registerInstrumentStateChangeListener(InstrumentStateChangeListener *listener)
EmdiHandler & registerOrderBookListener(OrderBookListener *listener)
EmdiHandler & registerFlexibleInstrumentUpdateListener(FlexibleInstrumentUpdateListener *listener)
EmdiHandler & registerProductStateChangeListener(ProductStateChangeListener *listener)
EmdiHandler & registerDepthListener(DepthListener *listener)
1/*
2* Copyright Onix Solutions Limited [OnixS]. 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#pragma once
20
29
30
31class EobiListener final
43{
44public:
46 EobiListener();
47
49 ~EobiListener() override;
50
52 void subscribe(OnixS::Eurex::MarketData::EOBI::EobiHandler& handler);
53
55 void onError(OnixS::Eurex::MarketData::ErrorCode::Enum code, const std::string& description) override;
56
58 void onWarning(const std::string& description) override;
59
60 void onReplayError(const std::string& errorDescription) override;
61
62 void onReplayFinished() override;
63
65 void waitUntilReplayFinished();
66
68
69 void onOrderAdd(const OnixS::Eurex::MarketData::EOBI::OrderAdd& orderAdd) override;
70
71 void onOrderModify(const OnixS::Eurex::MarketData::EOBI::OrderModify& orderModify) override;
72
74
75 void onOrderDelete(const OnixS::Eurex::MarketData::EOBI::OrderDelete& orderDelete) override;
76
77 void onOrderMassDelete(const OnixS::Eurex::MarketData::EOBI::OrderMassDelete& orderMassDelete) override;
78
80
81 void onFullOrderExecution(const OnixS::Eurex::MarketData::EOBI::FullOrderExecution& fullOrderExecution) override;
82
83 void onAuctionBestBidOffer(const OnixS::Eurex::MarketData::EOBI::AuctionBestBidOffer& auctionBestBidOffer) override;
84
86
87 void onTopOfBook(const OnixS::Eurex::MarketData::EOBI::TopOfBook& topOfBook) override;
88
89 void onExecutionSummary(const OnixS::Eurex::MarketData::EOBI::ExecutionSummary& executionSummary) override;
90
91 void onQuoteRequest(const OnixS::Eurex::MarketData::EOBI::QuoteRequest& quoteRequest) override;
92
93 void onCrossRequest(const OnixS::Eurex::MarketData::EOBI::CrossRequest& crossRequest) override;
94
95 void onTradeReport(const OnixS::Eurex::MarketData::EOBI::TradeReport& tradeReport) override;
96
98
99 void onTradeReversal(const OnixS::Eurex::MarketData::EOBI::TradeReversal& tradeReversal) override;
100
101 void onProductStateChange(const OnixS::Eurex::MarketData::EOBI::ProductStateChange& productStateChange) override;
102
103 void onInstrumentStateChange(const OnixS::Eurex::MarketData::EOBI::InstrumentStateChange& instrumentStateChange) override;
104
106
107 void onAddComplexInstrument(const OnixS::Eurex::MarketData::EOBI::AddComplexInstrument& addComplexInstrument) override;
108
110
111 void onAddFlexibleInstrument(const OnixS::Eurex::MarketData::EOBI::AddFlexibleInstrument& addFlexibleInstrument) override;
112
113 void onProductSummary(const OnixS::Eurex::MarketData::EOBI::ProductSummary& productSummary) override;
114
115 void onInstrumentSummary(const OnixS::Eurex::MarketData::EOBI::InstrumentSummary& instrumentSummary) override;
116
117 void onSnapshotOrder(const OnixS::Eurex::MarketData::EOBI::SnapshotOrder& snapshotOrder) override;
118
120
122
124
126
127 void onSnapshotCycleBegin() override;
128
129 void onSnapshotCycleEnd() override;
130
131private:
134};
virtual void onMarketSegmentOutOfDate(MarketSegmentId marketSegmentId)=0
virtual void onMarketSegmentReset(MarketSegmentId marketSegmentId)=0
Is called when all the information should be reset for a given market segment.
virtual void onOrderBookUpdated(const OrderBook &book)=0
virtual void onOrderBookOutOfDate(const OrderBook &book)=0
virtual void onOrderModify(const OrderModify &orderModify)=0
virtual void onFullOrderExecution(const FullOrderExecution &fullOrderExecution)=0
virtual void onAuctionBestBidOffer(const AuctionBestBidOffer &auctionBestBidOffer)=0
virtual void onOrderDelete(const OrderDelete &orderDelete)=0
virtual void onTopOfBook(const TopOfBook &topOfBook)=0
virtual void onOrderAdd(const OrderAdd &orderAdd)=0
virtual void onPartialOrderExecution(const PartialOrderExecution &partialOrderExecution)=0
virtual void onOrderModifySamePriority(const OrderModifySamePriority &orderModifySamePriority)=0
virtual void onOrderMassDelete(const OrderMassDelete &orderMassDelete)=0
virtual void onAuctionClearingPrice(const AuctionClearingPrice &auctionClearingPrice)=0
virtual void onAddComplexInstrument(const AddComplexInstrument &addComplexInstrument)=0
virtual void onAddScaledSimpleInstrument(const AddScaledSimpleInstrument &addFlexibleInstrument)=0
virtual void onAddFlexibleInstrument(const AddFlexibleInstrument &addFlexibleInstrument)=0
virtual void onProductSummary(const ProductSummary &productSummary)=0
virtual void onInstrumentSummary(const InstrumentSummary &instrumentSummary)=0
virtual void onSnapshotOrder(const SnapshotOrder &snapshotOrder)=0
virtual void onProductStateChange(const ProductStateChange &productStateChange)=0
virtual void onInstrumentStateChange(const InstrumentStateChange &instrumentStateChange)=0
virtual void onMassInstrumentStateChange(const MassInstrumentStateChange &instrumentStateChange)=0
virtual void onTradeReport(const TradeReport &tradeReport)=0
virtual void onTESTradeReport(const TESTradeReport &tradeReport)=0
virtual void onCrossRequest(const CrossRequest &crossRequest)=0
virtual void onTradeReversal(const TradeReversal &tradeReversal)=0
virtual void onQuoteRequest(const QuoteRequest &quoteRequest)=0
virtual void onExecutionSummary(const ExecutionSummary &executionSummary)=0
virtual void onStateChanged(HandlerState::Enum newState)=0
Implement this member to get notifications about handler state change.
Enum
Defines the state that the handler is in.
1/*
2* Copyright Onix Solutions Limited [OnixS]. 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#include <iostream>
20#include <sstream>
21
23
24#include "EobiListener.h"
25
26using namespace OnixS::Eurex::MarketData;
27using namespace OnixS::Eurex::MarketData::EOBI;
28
29/*
30 EobiListener
31*/
32
33EobiListener::EobiListener()
34 : replaySemaphore_(0)
35{
36}
37
38void EobiListener::subscribe(OnixS::Eurex::MarketData::EOBI::EobiHandler& handler)
39{
40 handler.registerErrorListener(this);
41 handler.registerWarningListener(this);
42 handler.registerHandlerStateListener(this);
43 handler.registerOrderDataListener(this);
44 handler.registerTradeDataListener(this);
45 handler.registerStateChangeListener(this);
47 handler.registerSnapshotListener(this);
48 handler.registerMessageListener(this);
49 handler.registerOrderBookListener(this);
50}
51
52EobiListener::~EobiListener() = default;
53
54void EobiListener::onError(ErrorCode::Enum code, const std::string& description)
55{
56 std::clog << "Error occurred, errorCode = " << enumToString(code) << ". Description: '" << description << "'" << std::endl;
57}
58
59void EobiListener::onWarning(const std::string& description)
60{
61 std::stringstream ss;
62 std::clog << "Warning occurred. Description: '" << description << "'" << std::endl;
63}
64
65void EobiListener::onReplayError(const std::string& errorDescription)
66{
67 std::clog << "Replay error: " << errorDescription << std::endl;
68 replaySemaphore_.release();
69}
70
71void EobiListener::onReplayFinished()
72{
73 replaySemaphore_.release();
74}
75
77void EobiListener::waitUntilReplayFinished()
78{
79 replaySemaphore_.acquire();
80}
81
82void EobiListener::onStateChanged(HandlerState::Enum newState)
83{
84 std::clog << "Handler state changed: " << enumToString(newState) << std::endl;
85}
86
87std::string toString(const MessageBase& msg)
88{
89 return msg.toString();
90}
91
92void EobiListener::onOrderAdd(const OrderAdd& msg)
93{
94 std::clog << "Message received: " << toString(msg) << std::endl;
95}
96
97void EobiListener::onOrderModify(const OrderModify& msg)
98{
99 std::clog << "Message received: " << toString(msg) << std::endl;
100}
101
102void EobiListener::onOrderModifySamePriority(const OrderModifySamePriority& msg)
103{
104 std::clog << "Message received: " << toString(msg) << std::endl;
105}
106
107void EobiListener::onOrderDelete(const OrderDelete& msg)
108{
109 std::clog << "Message received: " << toString(msg) << std::endl;
110}
111
112void EobiListener::onOrderMassDelete(const OrderMassDelete& msg)
113{
114 std::clog << "Message received: " << toString(msg) << std::endl;
115}
116
117void EobiListener::onPartialOrderExecution(const PartialOrderExecution& msg)
118{
119 std::clog << "Message received: " << toString(msg) << std::endl;
120}
121
122void EobiListener::onFullOrderExecution(const FullOrderExecution& msg)
123{
124 std::clog << "Message received: " << toString(msg) << std::endl;
125}
126
127void EobiListener::onAuctionBestBidOffer(const AuctionBestBidOffer& msg)
128{
129 std::clog << "Message received: " << toString(msg) << std::endl;
130}
131
132void EobiListener::onAuctionClearingPrice(const AuctionClearingPrice& msg)
133{
134 std::clog << "Message received: " << toString(msg) << std::endl;
135}
136
137void EobiListener::onTopOfBook(const TopOfBook& msg)
138{
139 std::clog << "Message received: " << toString(msg) << std::endl;
140}
141
142void EobiListener::onExecutionSummary(const ExecutionSummary& msg)
143{
144 std::clog << "Message received: " << toString(msg) << std::endl;
145}
146
147void EobiListener::onQuoteRequest(const EOBI::QuoteRequest& msg)
148{
149 std::clog << "Message received: " << toString(msg) << std::endl;
150}
151
152void EobiListener::onCrossRequest(const EOBI::CrossRequest& msg)
153{
154 std::clog << "Message received: " << toString(msg) << std::endl;
155}
156
157void EobiListener::onTradeReport(const TradeReport& msg)
158{
159 std::clog << "Message received: " << toString(msg) << std::endl;
160}
161
162void EobiListener::onTESTradeReport(const OnixS::Eurex::MarketData::EOBI::TESTradeReport& msg)
163{
164 std::clog << "Message received: " << toString(msg) << std::endl;
165}
166
167void EobiListener::onTradeReversal(const TradeReversal& msg)
168{
169 std::clog << "Message received: " << toString(msg) << std::endl;
170}
171
172void EobiListener::onProductStateChange(const EOBI::ProductStateChange& msg)
173{
174 std::clog << "Message received: " << toString(msg) << std::endl;
175}
176
177void EobiListener::onInstrumentStateChange(const EOBI::InstrumentStateChange& msg)
178{
179 std::clog << "Message received: " << toString(msg) << std::endl;
180}
181
182void EobiListener::onMassInstrumentStateChange(
184{
185 std::clog << "Message received: " << toString(msg) << std::endl;
186}
187
188void EobiListener::onAddComplexInstrument(const AddComplexInstrument& msg)
189{
190 std::clog << "Message received: " << toString(msg) << std::endl;
191}
192
193void EobiListener::onAddScaledSimpleInstrument(const AddScaledSimpleInstrument& msg)
194{
195 std::clog << "Message received: " << toString(msg) << std::endl;
196}
197
198void EobiListener::onAddFlexibleInstrument(const AddFlexibleInstrument& msg)
199{
200 std::clog << "Message received: " << toString(msg) << std::endl;
201}
202
203void EobiListener::onProductSummary(const ProductSummary& msg)
204{
205 std::clog << "Message received: " << toString(msg) << std::endl;
206}
207
208void EobiListener::onInstrumentSummary(const InstrumentSummary& msg)
209{
210 std::clog << "Message received: " << toString(msg) << std::endl;
211}
212
213void EobiListener::onSnapshotOrder(const SnapshotOrder& msg)
214{
215 std::clog << "Message received: " << toString(msg) << std::endl;
216}
217
218void EobiListener::onMarketSegmentReset(MarketSegmentId)
219{
220}
221
222void EobiListener::onMarketSegmentOutOfDate(MarketSegmentId)
223{
224}
225
226void EobiListener::onOrderBookUpdated(const EOBI::OrderBook&)
227{
228}
229
230void EobiListener::onOrderBookOutOfDate(const EOBI::OrderBook&)
231{
232}
233
234void EobiListener::onSnapshotCycleBegin()
235{
236}
237
238void EobiListener::onSnapshotCycleEnd()
239{
240}
EobiHandler & registerMessageListener(MessageListener *listener)
EobiHandler & registerWarningListener(WarningListener *listener)
EobiHandler & registerHandlerStateListener(HandlerStateListener *listener)
EobiHandler & registerOrderBookListener(OrderBookListener *listener)
EobiHandler & registerStateChangeListener(StateChangeListener *listener)
EobiHandler & registerSnapshotListener(SnapshotListener *listener)
EobiHandler & registerErrorListener(ErrorListener *listener)
EobiHandler & registerReferenceDataListener(ReferenceDataListener *listener)
EobiHandler & registerTradeDataListener(TradeDataListener *listener)
EobiHandler & registerOrderDataListener(OrderDataListener *listener)
std::string toString() const
Returns text presentation.