Added command to list securities.

This commit is contained in:
Pedro Pinto committed 2020-10-21 10:30:24 -04:00
1 parent 044b331d27
commit e741b33810
1 file changed
+28 -4
+28 -4
View File
@@ -13,10 +13,10 @@
#include "lib/utils/PBUtils.h"
#include "server/sparkd/cmds/spartan/md/mdp3/back_testing/algos/Sniper.h"
#include "server/sparkd/cmds/spartan/md/mdp3/back_testing/matcher/FifoSecurityMatcher.h"
#include "server/sparkd/cmds/spartan/md/mdp3/back_testing/matcher/validation/iceberg_file_cache.h"
#include "server/sparkd/cmds/spartan/md/mdp3/back_testing/matcher/validation/matcher_validation_observer.h"
#include "server/sparkd/cmds/spartan/md/mdp3/back_testing/orchestrator/SimOrchestrator.h"
#include "server/sparkd/cmds/spartan/md/mdp3/back_testing/orchestrator/SimSessionOptions.pb.h"
#include "server/sparkd/cmds/spartan/md/mdp3/back_testing/matcher/validation/matcher_validation_observer.h"
#include "server/sparkd/cmds/spartan/md/mdp3/back_testing/matcher/validation/iceberg_file_cache.h"
#include "server/sparkd/cmds/spartan/md/mdp3/back_testing/simulator/ExchangeSim.h"
#include "server/sparkd/cmds/spartan/md/mdp3/back_testing/simulator/SimInput.h"
#include "server/sparkd/cmds/spartan/md/mdp3/parsing/MDP3Parser.h"
@@ -102,8 +102,26 @@ void find_polys(std::vector<std::string> const &args) {
<< std::endl;
}
template<class T>
inline int run(const std::string& pcap, T obs) {
void list_sec(std::string const &input_file) {
DefinitionCollector def;
FillCounter fill_counter;
observe_channel(input_file, {&def,&fill_counter});
auto fill_counts = fill_counter.result_map();
for (auto const &s : def.result) {
std::cout << s.second.asset() << "|" << s.second.symbol()
<< "|" << fill_counts[s.second.security_id()] ;
for (auto const &l : s.second.legs()) {
std::cout << "|";
if (def.ptr_result[l.security_id])
std::cout << def.ptr_result[l.security_id]->symbol();
else
std::cout << "?" << l.security_id;
}
std::cout << std::endl;
}
}
template <class T> inline int run(const std::string &pcap, T obs) {
observe_channel(pcap, obs);
return 0;
}
@@ -147,6 +165,12 @@ std::map<std::string, std::function<int(std::vector<std::string> const &)>>
return 0;
}},
{"list_sec",
[](auto const &args) {
list_sec(args[1]);
return 0;
}},
{"find_polys",
[](auto const &args) {
find_polys(args);