Refactored sim types to have a sim prefix.
This commit is contained in:
1 parent
2cffaa9d73
commit
aeb4bec02d
27 files changed
+189
-109
No files matched your search
@@ -31,7 +31,7 @@ struct SniperModel::Target {
|
||||
|
||||
struct SniperModel::WorkingOrder {
|
||||
SmallOrderChange order;
|
||||
std::vector<OrderUpdate> fills;
|
||||
std::vector<SimOrderUpdate> fills;
|
||||
};
|
||||
|
||||
struct SniperModel::Shot {
|
||||
@@ -47,7 +47,7 @@ struct SniperModel::Shot {
|
||||
|
||||
struct SniperModel::DependentTargets {
|
||||
SecurityDefinition definition;
|
||||
MBPUpdate book;
|
||||
SimBookUpdate book;
|
||||
std::vector<Target *> dependencies;
|
||||
};
|
||||
|
||||
@@ -86,7 +86,7 @@ void SniperModel::init(ISim &s, protos::SimRunOptions const &options) {
|
||||
}
|
||||
|
||||
void SniperModel::on_replay_start(
|
||||
EventHeader const &h, std::vector<MBPUpdate> const &books) {
|
||||
EventHeader const &h, std::vector<SimBookUpdate> const &books) {
|
||||
auto parse_poly_filter = [](std::string const &pf) {
|
||||
std::vector<std::string> polys;
|
||||
boost::split(polys, pf, boost::is_any_of(","));
|
||||
@@ -158,7 +158,7 @@ void SniperModel::on_replay_start(
|
||||
}
|
||||
}
|
||||
|
||||
void SniperModel::on_mbp(EventHeader const &h, const MBPUpdate &mbp) {
|
||||
void SniperModel::on_mbp(EventHeader const &h, const SimBookUpdate &mbp) {
|
||||
me->current_event = h;
|
||||
auto it = me->books.find(mbp.security_id);
|
||||
if (it == me->books.end())
|
||||
@@ -188,7 +188,7 @@ void SniperModel::on_mbp(EventHeader const &h, const MBPUpdate &mbp) {
|
||||
}
|
||||
|
||||
void SniperModel::on_order_update(
|
||||
EventHeader const &h, const OrderUpdate &update) {
|
||||
EventHeader const &h, const SimOrderUpdate &update) {
|
||||
me->current_event = h;
|
||||
bts_assert(me->state == State::SHOOTING);
|
||||
bts_assert(me->current_shot);
|
||||
@@ -202,9 +202,9 @@ void SniperModel::on_order_update(
|
||||
for (auto const &p : in_flight.working) {
|
||||
auto &these_fills = p.second.fills;
|
||||
for (auto &f : these_fills) {
|
||||
clean_fills = clean_fills && (f.fill_type == OrderUpdate::AGGRESSIVE);
|
||||
if (f.status == OrderUpdate::CANCELED ||
|
||||
f.status == OrderUpdate::FILLED) {
|
||||
clean_fills = clean_fills && (f.fill_type == SimOrderUpdate::AGGRESSIVE);
|
||||
if (f.status == SimOrderUpdate::CANCELED ||
|
||||
f.status == SimOrderUpdate::FILLED) {
|
||||
pending_orders--;
|
||||
break;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ void SniperModel::on_order_update(
|
||||
}
|
||||
|
||||
if (pending_orders == 0) {
|
||||
std::vector<OrderUpdate> all_fills;
|
||||
std::vector<SimOrderUpdate> all_fills;
|
||||
for (auto const &p : in_flight.working) {
|
||||
auto &these_fills = p.second.fills;
|
||||
all_fills.insert(
|
||||
@@ -292,7 +292,7 @@ void SniperModel::maybe_force_fills() {
|
||||
auto &these_fills = p.second.fills;
|
||||
auto total_fills = 0;
|
||||
for (auto &f : these_fills) {
|
||||
bts_assert(f.status != OrderUpdate::CANCELED);
|
||||
bts_assert(f.status != SimOrderUpdate::CANCELED);
|
||||
total_fills += f.last_fills.value();
|
||||
}
|
||||
if (order.order.quantity.value() > total_fills) {
|
||||
|
||||
Reference in new issue
Block a user