Towards self-correcting simulator.
This commit is contained in:
1 parent
3599fa2b0c
commit
398397ca7f
42 files changed
+1783
-372
No files matched your search
@@ -26,6 +26,7 @@
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/utils/queries/FillCounter.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/utils/queries/PolygonFinder.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/utils/queries/PolygonOpportunityFinder.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/back_testing/orchestrator/run_sim.h"
|
||||
|
||||
#include <Pcap++/PcapFileDevice.h>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
@@ -189,27 +190,23 @@ void sim_books(std::string const &sim_file) {
|
||||
}
|
||||
}
|
||||
|
||||
size_t total_orders = 0;
|
||||
void stats(std::string const &pcap) {
|
||||
|
||||
std::cout << "MDP3order: " << sizeof(MDP3Order) << std::endl;
|
||||
return;
|
||||
|
||||
auto out_path = drop_extensions(drop_extensions(pcap)) + ".order_counts.csv";
|
||||
auto out_file = std::ofstream{out_path};
|
||||
out_file << "sid,n_orders" << std::endl;
|
||||
|
||||
struct StatPrinter : IChannelObserver {
|
||||
StatPrinter(std::ostream &out) : out{out} {}
|
||||
std::ostream &out;
|
||||
void on_real_time_event(MDP3Event const &ev) override {
|
||||
for (auto s : ev.affected_securities) {
|
||||
out << s->security_id().value() << "," << s->orders().size()
|
||||
<< std::endl;
|
||||
total_orders += s->orders().size();
|
||||
}
|
||||
}
|
||||
} stats{out_file};
|
||||
|
||||
observe_channel(pcap, stats);
|
||||
std::cout << total_orders << std::endl;
|
||||
}
|
||||
|
||||
std::map<std::string, std::function<int(std::vector<std::string> const &)>>
|
||||
@@ -233,6 +230,12 @@ std::map<std::string, std::function<int(std::vector<std::string> const &)>>
|
||||
return 0;
|
||||
}},
|
||||
|
||||
{"sim2",
|
||||
[](auto const &args) {
|
||||
run_sim(args[1]);
|
||||
return 0;
|
||||
}},
|
||||
|
||||
{"sim_books",
|
||||
[](auto const &args) {
|
||||
sim_books(args[1]);
|
||||
|
||||
Reference in new issue
Block a user