use std::fmt::Debug;
use nautilus_common::msgbus::{MStr, Topic, TypedHandler};
use nautilus_model::data::{Bar, QuoteTick, TradeTick};
#[derive(Clone)]
pub enum BarAggregatorSubscription {
Bar {
topic: MStr<Topic>,
handler: TypedHandler<Bar>,
},
Trade {
topic: MStr<Topic>,
handler: TypedHandler<TradeTick>,
},
Quote {
topic: MStr<Topic>,
handler: TypedHandler<QuoteTick>,
},
}
impl Debug for BarAggregatorSubscription {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Bar { topic, handler } => f
.debug_struct(stringify!(Bar))
.field("topic", topic)
.field("handler_id", &handler.id())
.finish(),
Self::Trade { topic, handler } => f
.debug_struct(stringify!(Trade))
.field("topic", topic)
.field("handler_id", &handler.id())
.finish(),
Self::Quote { topic, handler } => f
.debug_struct(stringify!(Quote))
.field("topic", topic)
.field("handler_id", &handler.id())
.finish(),
}
}
}