Merge remote-tracking branch 'origin/main'
# Conflicts: # crates/fidc-core/src/events.rs # crates/fidc-core/src/lib.rs
This commit is contained in:
@@ -364,6 +364,38 @@ impl ProcessEventKind {
|
||||
Self::AccountManagementFee => "account_management_fee",
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns whether the event is part of the durable business lifecycle
|
||||
/// audit. Phase boundary events are useful during interactive debugging,
|
||||
/// but retaining every minute phase marker for a long run is unnecessary.
|
||||
pub fn is_business_lifecycle(&self) -> bool {
|
||||
matches!(
|
||||
*self,
|
||||
Self::PreScheduled
|
||||
| Self::PostScheduled
|
||||
| Self::PreOnDay
|
||||
| Self::OnDay
|
||||
| Self::PostOnDay
|
||||
| Self::OrderPendingNew
|
||||
| Self::OrderCreationPass
|
||||
| Self::OrderCreationReject
|
||||
| Self::OrderPendingCancel
|
||||
| Self::OrderCancellationPass
|
||||
| Self::OrderCancellationReject
|
||||
| Self::OrderPendingUpdate
|
||||
| Self::OrderUpdatePass
|
||||
| Self::OrderUpdateReject
|
||||
| Self::OrderUnsolicitedUpdate
|
||||
| Self::Trade
|
||||
| Self::UniverseUpdated
|
||||
| Self::UniverseSubscribed
|
||||
| Self::UniverseUnsubscribed
|
||||
| Self::AccountDepositWithdraw
|
||||
| Self::AccountFinanceRepay
|
||||
| Self::AccountManagementFee
|
||||
| Self::Settlement
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -384,7 +416,7 @@ pub struct ProcessEvent {
|
||||
mod tests {
|
||||
use chrono::{NaiveDate, NaiveDateTime};
|
||||
|
||||
use super::{FillEvent, OrderEvent, OrderSide, OrderStatus};
|
||||
use super::{FillEvent, OrderEvent, OrderSide, OrderStatus, ProcessEventKind};
|
||||
|
||||
fn order_event(status: OrderStatus, filled_quantity: u32) -> OrderEvent {
|
||||
OrderEvent {
|
||||
@@ -484,4 +516,11 @@ mod tests {
|
||||
"2025-01-02 10:18:03"
|
||||
);
|
||||
}
|
||||
#[test]
|
||||
fn process_event_business_lifecycle_filter_keeps_audit_events_only() {
|
||||
assert!(ProcessEventKind::OrderUpdateReject.is_business_lifecycle());
|
||||
assert!(ProcessEventKind::Settlement.is_business_lifecycle());
|
||||
assert!(!ProcessEventKind::PreMinute.is_business_lifecycle());
|
||||
assert!(!ProcessEventKind::PostBar.is_business_lifecycle());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user