Fixed build.

This commit is contained in:
Pedro Pinto committed 2021-02-05 20:06:18 -05:00
1 parent ca80857607
commit 1297b97b2d
5 files changed
+49 -44

No files matched your search

@@ -10,17 +10,14 @@ class IMDP3FeedObserver : public IMDP3RecoveryObserver, public IMDP3RealTimeObse
virtual void init() {}
virtual void finit() {}
void on_recovery_complete(InitialSnapshot const &) override {}
void on_packet_begin(MDP3PacketView const &) override {}
void on_packet_end() override {}
void on_event_begin(MDP3Event const &) override {}
void on_books(
SecuritySnapshot const &, Book const &, ImpliedBook const &) override {}
void on_trade_summary_signal(
SecuritySnapshot const &, TradeSummarySignal const &) override {}
void on_event_end(MDP3Event const &) override {}
void on_packet_loss() override {}
};
@@ -63,6 +63,7 @@ void MDP3FeedHandler::set_observer(IMDP3FeedObserver &o) {
void MDP3FeedHandler::start() {
bts_assert(!me->run);
bts_assert(me->state == State::IDLE);
me->state = State::RECOVERY;
me->run.emplace(*me->observer);
me->controller->start_incremental_feed();
me->controller->start_instrument_feed();
@@ -12,6 +12,11 @@ class IMDP3FeedObserver;
class IFeedController;
class MDP3PacketView;
// Process MDP3 packets across, to produce a well ordered sequence of
// market data events. This class is agnostic with respect to the
// source of the MDP3 packets. They can come from the network or from
// a pcap. Use the FeedHandlerBinder to use it to process network
// packets.
class MDP3FeedHandler {
public:
// Construction/Destruction --------------------------------------
@@ -64,6 +64,7 @@ TEST_CASE("spartan_md", "[spartan_md] [spartan_slow]") {
} obs;
MDP3FeedHandler handler(obs, ctrl);
handler.start();
reader.on_packet() = [&](auto const &info, auto const &payload) {
if ((info.dst_ip == feed_map.incremental[0].ip &&
info.dst_port == feed_map.incremental[0].port)) {
@@ -130,6 +131,7 @@ TEST_CASE("spartan_md", "[spartan_md] [spartan_slow]") {
} obs;
MDP3FeedHandler handler(obs, ctrl);
handler.start();
reader.on_packet() = [&](auto const &info, auto const &payload) {
if ((info.dst_ip == feed_map.incremental[0].ip &&
info.dst_port == feed_map.incremental[0].port)) {
@@ -1,29 +1,27 @@
#include "mdp3_utils.h"
#include "../feed_control/AB_Arbitrageur.h"
#include "../feed_control/IFeedController.h"
#include "../gen/src/MDIncrementalRefreshOrderBook47.h"
#include "../gen/src/MDInstrumentDefinitionFuture54.h"
#include "../gen/src/MDInstrumentDefinitionOption55.h"
#include "../gen/src/MDInstrumentDefinitionSpread56.h"
#include "../gen/src/SnapshotFullRefreshOrderBook53.h"
#include "../parsing/MDP3Parser.h"
#include "domain/SecuritySnapshot.h"
#include "lib/config/config.h"
#include "lib/config/protos/spartan.pb.h"
#include "lib/jetfix/codec/f_toa.h"
#include "server/sparkd/cmds/spartan/domain/SecuritySnapshot.h"
#include "server/sparkd/cmds/spartan/market_data/handler/MDP3FeedHandler.h"
#include "server/sparkd/cmds/spartan/market_data/parsing/MDP3Packet.h"
#include "server/sparkd/cmds/spartan/system/PCapReader.h"
#include "lib/utils/bts_chrono.h"
#include "server/sparkd/cmds/spartan/market_data/feed_observers/DefinitionCollector.h"
#include "server/sparkd/cmds/spartan/market_data/feed_observers/IcebergFinder.h"
#include "server/sparkd/cmds/spartan/market_data/feed_observers/PolygonFinder.h"
#include "server/sparkd/cmds/spartan/market_data/feed_observers/PolygonOpportunityFinder.h"
#include "lib/utils/TempFile.h"
#include "lib/utils/bts_chrono.h"
#include "lib/utils/overloaded.h"
#include "market_data/feed_control/AB_Arbitrageur.h"
#include "market_data/feed_control/IFeedController.h"
#include "market_data/feed_observers/DefinitionCollector.h"
#include "market_data/feed_observers/IcebergFinder.h"
#include "market_data/feed_observers/PolygonFinder.h"
#include "market_data/feed_observers/PolygonOpportunityFinder.h"
#include "market_data/gen/src/MDIncrementalRefreshOrderBook47.h"
#include "market_data/gen/src/MDInstrumentDefinitionFuture54.h"
#include "market_data/gen/src/MDInstrumentDefinitionOption55.h"
#include "market_data/gen/src/MDInstrumentDefinitionSpread56.h"
#include "market_data/gen/src/SnapshotFullRefreshOrderBook53.h"
#include "market_data/handler/MDP3FeedHandler.h"
#include "market_data/parsing/MDP3Packet.h"
#include "market_data/parsing/MDP3Parser.h"
#include "system/PCapReader.h"
#include <Pcap++/PcapFileDevice.h>
#include <boost/algorithm/string/predicate.hpp>
@@ -398,7 +396,8 @@ struct PCapStreamer::PImpl {
std::array<PacketBuffers, 2> buffers;
};
PCapStreamer::PCapStreamer(std::string const &file, mdp3::IMDP3FeedObserver &obs)
PCapStreamer::PCapStreamer(
std::string const &file, mdp3::IMDP3FeedObserver &obs)
: me(new PImpl(file, obs)) {
Guesser guesser;
me->reader.on_packet() = [&](auto const &info, auto const &payload) {
@@ -420,6 +419,7 @@ PCapStreamer::PCapStreamer(std::string const &file, mdp3::IMDP3FeedObserver &obs
bts_assert(false);
}
me->obs_wrapper.init();
me->handler.start();
me->reader.on_packet() = [this,
feed_map](auto const &info, auto const &payload) {
if ((info.dst_ip == feed_map.incremental[0].ip &&
@@ -536,9 +536,8 @@ struct CSVObs : IMDP3FeedObserver {
for (auto const &l : s->definition().legs())
spread_legs << s->security_id().value() << ","
<< l.security_id.value() << ","
<< Side_Name(l.side) << "," << l.ratio.value()
<< std::endl;
<< l.security_id.value() << "," << Side_Name(l.side)
<< "," << l.ratio.value() << std::endl;
known_securities.insert(s->security_id());
@@ -567,12 +566,12 @@ struct CSVObs : IMDP3FeedObserver {
<< "order_change," // type
<< "init," // change
<< id << "," // order key
<< Side_Name(order.side) << "," // side
<< order.priority.value() << "," // priority
<< order.price.to_double() << "," // price
<< order.quantity.value() << "," // quantity
<< "0," // trade_entry_id
<< "n/a" // aggressor
<< Side_Name(order.side) << "," // side
<< order.priority.value() << "," // priority
<< order.price.to_double() << "," // price
<< order.quantity.value() << "," // quantity
<< "0," // trade_entry_id
<< "n/a" // aggressor
<< std::endl;
}
}
@@ -639,12 +638,13 @@ struct CSVObs : IMDP3FeedObserver {
<< s->implied_matching_status()
<< "," // implied matching status
<< "order_change," // type
<< OrderChange::ChangeType_Name(change.change) << "," // change type
<< change.order.key.value() << "," // order key
<< Side_Name(change.order.side) << "," // side
<< change.order.priority.value() << "," // priority
<< change.order.price.to_double() << "," // price
<< change.order.quantity.value() << "," // quantity
<< OrderChange::ChangeType_Name(change.change)
<< "," // change type
<< change.order.key.value() << "," // order key
<< Side_Name(change.order.side) << "," // side
<< change.order.priority.value() << "," // priority
<< change.order.price.to_double() << "," // price
<< change.order.quantity.value() << "," // quantity
<< "0," // trade_entry_id
<< "n/a" // aggressor
<< std::endl;
@@ -680,10 +680,10 @@ struct CSVObs : IMDP3FeedObserver {
<< s->implied_matching_status()
<< "," // implied matching status
<< "deduced_order," // type
<< OrderChange::ChangeType_Name(deduced_order.change) << ","
<< deduced_order.order.key.value() << "," // order key
<< Side_Name(deduced_order.order.side)
<< "," // side
<< OrderChange::ChangeType_Name(deduced_order.change)
<< "," << deduced_order.order.key.value()
<< "," // order key
<< Side_Name(deduced_order.order.side) << "," // side
<< "0," // priority
<< deduced_order.order.price.to_double() << "," // price
<< deduced_order.order.quantity.value()
@@ -748,8 +748,8 @@ int to_csv(std::string const &file) {
return 0;
}
std::unordered_map<OrderKey, IcebergInput>
find_icebergs(std::string const &pcap) {
std::unordered_map<OrderKey, IcebergInput> find_icebergs(
std::string const &pcap) {
return IcebergFinder::find_all(pcap);
}