From 85bd2da414c0ebebe52eab5bc06413a4ca754a3b Mon Sep 17 00:00:00 2001 From: John Colvin Date: Thu, 3 Jul 2025 19:29:20 +0000 Subject: [PATCH] cleanup: Remove security from StoredFillEvent It created an unnecessary dependency --- src/lib_spark/spark/orderman/actors/FillStore.cpp | 10 +++++----- src/lib_spark/spark/orderman/events/StoredFillEvent.h | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/lib_spark/spark/orderman/actors/FillStore.cpp b/src/lib_spark/spark/orderman/actors/FillStore.cpp index 9e8790645..cc0b13f11 100644 --- a/src/lib_spark/spark/orderman/actors/FillStore.cpp +++ b/src/lib_spark/spark/orderman/actors/FillStore.cpp @@ -191,7 +191,7 @@ void FillStore::init() { for (auto &f : aggregated_fills) { auto sec = me->oracle.get_security(SecurityKey(f.security_key())); if (sec) { - stored_batch.emplace_back(f, *sec); + stored_batch.emplace_back(f); } else { LOG(persist, Error, "Stored fill {} contains unresolved security {}. ", @@ -223,7 +223,7 @@ void FillStore::init() { if (!config::get() .enabled() || !securities::is_expired(*sec)) { - stored_batch.emplace_back(fill, *sec); + stored_batch.emplace_back(fill); } } else LOG(persist, Error, @@ -342,7 +342,7 @@ void FillStore::on_execution_report( auto fv = utils::pb::to_string(fill); me->store->insert(fills_ns, fk, fv); LOG(OrderMan, Info, "Publishing fill. {}", fv); - publish(me->fill_stream, fill, *er.security); + publish(me->fill_stream, fill); } else LOG(OrderMan, Info, "Discarding known execution report for fill {}", fk); @@ -366,7 +366,7 @@ void FillStore::on_order_definition_update( f.set_internal_account_id(ev.def->account_id()); auto fv = utils::pb::to_string(f); me->store->update(fills_ns, f.fill_key(), fv); - publish(me->fill_stream, f, *unresolved_fills.security); + publish(me->fill_stream, f); } unresolved_fills.fills.clear(); // end fill resolution @@ -400,7 +400,7 @@ void FillStore::on_manual_bust( bts::api::orderman::Fill::FILL_STATUS_BUSTED); auto fv = utils::pb::to_string(fill); me->store->update(fills_ns, fill.fill_key(), fv); - publish(me->fill_stream, fill, *sec); + publish(me->fill_stream, fill); LOG(OrderMan, Info, "Busting fill: {}", fv); } else { LOG(persist, Error, diff --git a/src/lib_spark/spark/orderman/events/StoredFillEvent.h b/src/lib_spark/spark/orderman/events/StoredFillEvent.h index b018f4301..bf902578a 100644 --- a/src/lib_spark/spark/orderman/events/StoredFillEvent.h +++ b/src/lib_spark/spark/orderman/events/StoredFillEvent.h @@ -12,12 +12,10 @@ class StoredFillEvent : public mercury::Event { public: using SynopsisPolicy = mercury::MergeByKey; - StoredFillEvent(api::orderman::Fill &fill, api::Security const &security) - : fill(fill), security(&security) {} + StoredFillEvent(api::orderman::Fill &fill) : fill(fill) {} std::string const &key() const { return fill.fill_key(); } api::orderman::Fill fill; - api::Security const *security; }; } // namespace orderman