diff --git a/src/data_files/files/spartan/md.sql b/src/data_files/files/spartan/md.sql index 07589f61f..c8ea0a2d0 100644 --- a/src/data_files/files/spartan/md.sql +++ b/src/data_files/files/spartan/md.sql @@ -82,9 +82,10 @@ CREATE INDEX book_sid_idx ON books(sid); drop table if exists icebergs; CREATE TABLE icebergs( ok numeric, + eid numeric, total_qty numeric, show_qty numeric, - filled numeric + fill_qty numeric ); /* All the securities*/ diff --git a/src/server/sparkd/cmds/spartan/md/mdp3/utils/mdp3_utils.cpp b/src/server/sparkd/cmds/spartan/md/mdp3/utils/mdp3_utils.cpp index 05eece839..0d299809a 100644 --- a/src/server/sparkd/cmds/spartan/md/mdp3/utils/mdp3_utils.cpp +++ b/src/server/sparkd/cmds/spartan/md/mdp3/utils/mdp3_utils.cpp @@ -723,8 +723,16 @@ int to_csv(std::string const &file) { observe_channel(file, {&cvs, &ice_finder, &def_collector, &poly_finder}); auto icebergs = std::ofstream(drop_extensions(file) + ".icebergs.csv"); - for (auto &i : ice_finder.result) - icebergs << i.first.value() << "," << i.second.total_qty().value(); + for (auto &i : ice_finder.result) { + auto relevent_eids = i.second.all_eids(); + for (auto eid : relevent_eids) + icebergs << i.first.value() << "," + << eid << "," + << i.second.total_qty().value() << "," + << std::get<0> (i.second.show_qty_at(eid)) << "," + << i.second.count_fills_by(eid) + << std::endl; + } auto polys = std::ofstream(drop_extensions(file) + ".polygons.csv"); auto poly_legs = std::ofstream(drop_extensions(file) + ".polygon_legs.csv"); diff --git a/src/server/sparkd/cmds/spartan/md/mdp3/utils/queries/IcebergFinder.h b/src/server/sparkd/cmds/spartan/md/mdp3/utils/queries/IcebergFinder.h index d8ea809aa..9e152aaa2 100644 --- a/src/server/sparkd/cmds/spartan/md/mdp3/utils/queries/IcebergFinder.h +++ b/src/server/sparkd/cmds/spartan/md/mdp3/utils/queries/IcebergFinder.h @@ -31,6 +31,15 @@ struct IcebergInput { } MDP3Quantity count_fills_by(size_t event_id) const; + std::set all_eids() { + std::set result; + for (auto const &p : _show_quantities) + result.insert(std::get<0>(p)); + for (auto const &p : _fill_quantities) + result.insert(std::get<0>(p)); + return result; + } + private: MDP3Quantity _total_qty = MDP3Quantity(0); std::vector> _show_quantities;