use std::{collections::HashMap, time::Duration};
use nautilus_model::{
enums::{BarAggregation, BarIntervalType},
identifiers::ClientId,
};
#[derive(Clone, Debug, bon::Builder)]
pub struct DataEngineConfig {
#[builder(default = true)]
pub time_bars_build_with_no_updates: bool,
#[builder(default = true)]
pub time_bars_timestamp_on_close: bool,
#[builder(default)]
pub time_bars_skip_first_non_full_bar: bool,
#[builder(default = BarIntervalType::LeftOpen)]
pub time_bars_interval_type: BarIntervalType,
#[builder(default)]
pub time_bars_build_delay: u64,
#[builder(default)]
pub time_bars_origins: HashMap<BarAggregation, Duration>,
#[builder(default)]
pub validate_data_sequence: bool,
#[builder(default)]
pub buffer_deltas: bool,
pub external_clients: Option<Vec<ClientId>>,
#[builder(default)]
pub debug: bool,
}
impl DataEngineConfig {
#[allow(clippy::too_many_arguments)]
#[must_use]
pub const fn new(
time_bars_build_with_no_updates: bool,
time_bars_timestamp_on_close: bool,
time_bars_interval_type: BarIntervalType,
time_bars_skip_first_non_full_bar: bool,
time_bars_build_delay: u64,
time_bars_origins: HashMap<BarAggregation, Duration>,
validate_data_sequence: bool,
buffer_deltas: bool,
external_clients: Option<Vec<ClientId>>,
debug: bool,
) -> Self {
Self {
time_bars_build_with_no_updates,
time_bars_timestamp_on_close,
time_bars_skip_first_non_full_bar,
time_bars_interval_type,
time_bars_build_delay,
time_bars_origins,
validate_data_sequence,
buffer_deltas,
external_clients,
debug,
}
}
}
impl Default for DataEngineConfig {
fn default() -> Self {
Self::builder().build()
}
}