Presod local fills are deleted at startup, Modified the SOD test to test for this
This commit is contained in:
1 parent
768853bbe5
commit
2b53a051d3
5 files changed
+50
-8
No files matched your search
@@ -83,7 +83,8 @@ PositionServiceServer::PositionServiceServer(bts::api::ServiceContext &context,
|
||||
make_pnl_data_stateful_publisher(),
|
||||
make_pnl_account_data_stateful_publisher(),
|
||||
make_manual_fills_stateful_publisher(), md_client)) {
|
||||
// incremental fill update
|
||||
_delete_presod_local_on_start();
|
||||
// incremental fill update
|
||||
me->order_service.subscribe_fills() |
|
||||
rxcpp::operators::subscribe<api::orderman::FillsUpdate>(
|
||||
[this](auto const &update) {
|
||||
@@ -127,6 +128,30 @@ PositionServiceServer::PositionServiceServer(bts::api::ServiceContext &context,
|
||||
me->context.post([this]() { _periodic_poll(); }, me->poll_period_ms);
|
||||
}
|
||||
|
||||
void PositionServiceServer::_delete_presod_local_on_start() const{
|
||||
std::set<std::string> rm_ids;
|
||||
auto all = me->manual_fills_store->retrieve_all()[manual_fills_ns];
|
||||
ManualFill rec;
|
||||
for (auto const &kvp : all){
|
||||
if (utils::pb::from_string<ManualFill>(kvp.second, &rec)) {
|
||||
if(rec.fill_type() == ManualFill::LOCAL &&
|
||||
me->state.is_sod(rec.timestamp())){
|
||||
LOG(OrderMan, Info,
|
||||
"PositionServiceServer::_delete_presod_local_on_start "
|
||||
"fill: {}", kvp.second);
|
||||
auto id = std::to_string(rec.record_id());
|
||||
rm_ids.insert(id);
|
||||
}
|
||||
}
|
||||
else
|
||||
LOG(OrderMan, Error,
|
||||
"Could not recover manual fill {} from storage. "
|
||||
"This should be investigated",
|
||||
kvp.first);
|
||||
}
|
||||
me->manual_fills_store->remove(manual_fills_ns, rm_ids);
|
||||
}
|
||||
|
||||
const PositionUnit &PositionServiceServer::_on_fill(const Fill &f,
|
||||
bool is_add) {
|
||||
return me->state.on_fill(f,is_add);
|
||||
@@ -134,7 +159,7 @@ const PositionUnit &PositionServiceServer::_on_fill(const Fill &f,
|
||||
|
||||
const PositionUnit &PositionServiceServer::_on_manual_fill(const ManualFill &mf,
|
||||
bool is_add) {
|
||||
return me->state.on_manual_fill(mf,is_add);
|
||||
return me->state.on_manual_fill(mf,is_add);
|
||||
}
|
||||
|
||||
void PositionServiceServer::_set_admin_data(
|
||||
|
||||
Reference in new issue
Block a user