Fixed some more issues. Everything looks good now.

This commit is contained in:
Pedro Pinto committed 2020-08-09 17:06:53 -04:00
1 parent 0d9277bf6a
commit c52c24c3f2
14 files changed
+270 -120

No files matched your search

+68 -2
View File
@@ -12,8 +12,13 @@
#include "server/sparkd/cmds/spartan/analysis/RunAnalysis.h"
#include "server/sparkd/cmds/spartan/md/mdp3/common/InstrumentSnapshot.h"
#include "server/sparkd/cmds/spartan/md/mdp3/common/mdp3_common.h"
#include "server/sparkd/cmds/spartan/md/mdp3/feed_control/AB_Arbitrageur.h"
#include "server/sparkd/cmds/spartan/md/mdp3/feed_control/IFeedController.h"
#include "server/sparkd/cmds/spartan/md/mdp3/handler/ChannelHandler.h"
#include "server/sparkd/cmds/spartan/md/mdp3/handler/IChannelObserver.h"
#include "server/sparkd/cmds/spartan/md/mdp3/parsing/MDP3Parser.h"
#include "server/sparkd/cmds/spartan/md/mdp3/utils/mdp3_utils.h"
#include "server/sparkd/cmds/spartan/util/PCapReader.h"
#include <boost/algorithm/string.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
@@ -26,13 +31,74 @@ namespace cmd {
using namespace bts::orderman;
using namespace spartan::mdp3;
int QuickTest::execute(std::vector<std::string> const &) {
void dump_snapshots() {
using namespace bts::spartan::mdp3;
using namespace bts::spartan;
auto file = "/home/ppinto/es_md/es_all.pcap";
auto feed_map = guess_feed_map(file);
bts_assert(feed_map);
auto reader = PCapReader{file};
struct JSON_Writer {
mdp3::MDP3PacketView packet;
void on_begin_packet(mdp3::MDP3PacketView const &p) { packet = p; }
void on_end_packet() {}
void operator()(::mdp3::SnapshotFullRefresh52 const &m) {
if (m.securityID() == 15234)
std::cout << "{\"SeqNum\": " << packet.seq_num() << ", "
<< " \"SendTime\": " << packet.sending_time() << ", "
<< " \"Size\": " << packet.size() << ","
<< " \"Msg\": " << m << "}\n";
}
};
JSON_Writer writer;
reader.on_packet() = [&](auto const &, auto const &payload) {
parse_packet(mdp3::MDP3PacketView{payload}, writer);
return true;
};
while (reader.read_next())
;
}
int QuickTest::execute(std::vector<std::string> const &) {
//dump_snapshots();
using namespace bts::spartan::mdp3;
struct Obs : IChannelObserver {
void on_recovery_complete(
std::vector<InstrumentSnapshot const *> const &snaps) override {
std::cout << "Initial Snapshot\n";
for (auto is : snaps) {
if (is->security_id() == MDP3SecurityID{12181})
std::cout << *is << "\n";
}
}
void on_real_time_event(MDP3Event const &ev) override {
for (auto is : ev.affected_securities) {
if (is->security_id() == MDP3SecurityID{12181}) {
std::cout << "Seq numbers: " << ev.first_packet_sn << " to "
<< ev.last_packet_sn << "\n";
std::cout << *is << "\n";
}
}
}
void on_real_time_channel_loss() override {
std::cout << "Observed loss, resetting\n";
}
} obs;
spartan::observe_channel("/home/ppinto/es_md/es_all.pcap", obs);
return 0;
}
std::string QuickTest::help() {
return "This is a place holder to make it easy to quickly write discardable "
return "This is a place holder to make it easy to quickly write "
"discardable "
"test code";
}
} // namespace cmd