nautilus_execution/matching_engine/
config.rs1use serde::{Deserialize, Serialize};
17
18#[derive(Debug, Clone, Deserialize, Serialize, bon::Builder)]
20#[serde(default, deny_unknown_fields)]
21pub struct OrderMatchingEngineConfig {
22 #[builder(default = true)]
23 pub bar_execution: bool,
24 #[builder(default)]
25 pub bar_adaptive_high_low_ordering: bool,
26 #[builder(default = true)]
27 pub trade_execution: bool,
28 #[builder(default)]
29 pub liquidity_consumption: bool,
30 #[builder(default = true)]
31 pub reject_stop_orders: bool,
32 #[builder(default = true)]
33 pub support_gtd_orders: bool,
34 #[builder(default = true)]
35 pub support_contingent_orders: bool,
36 #[builder(default = true)]
37 pub use_position_ids: bool,
38 #[builder(default)]
39 pub use_random_ids: bool,
40 #[builder(default = true)]
41 pub use_reduce_only: bool,
42 #[builder(default)]
43 pub use_market_order_acks: bool,
44 #[builder(default)]
45 pub queue_position: bool,
46 #[builder(default)]
47 pub oto_full_trigger: bool,
48 pub price_protection_points: Option<u32>,
49}
50
51impl Default for OrderMatchingEngineConfig {
52 fn default() -> Self {
53 Self::builder().build()
54 }
55}
56
57#[cfg(test)]
58mod tests {
59 use rstest::rstest;
60
61 use super::*;
62
63 #[rstest]
66 fn test_default_matches_cython() {
67 let config = OrderMatchingEngineConfig::default();
68 assert!(config.bar_execution);
69 assert!(!config.bar_adaptive_high_low_ordering);
70 assert!(config.trade_execution);
71 assert!(!config.liquidity_consumption);
72 assert!(config.reject_stop_orders);
73 assert!(config.support_gtd_orders);
74 assert!(config.support_contingent_orders);
75 assert!(config.use_position_ids);
76 assert!(!config.use_random_ids);
77 assert!(config.use_reduce_only);
78 assert!(!config.use_market_order_acks);
79 assert!(!config.queue_position);
80 assert!(!config.oto_full_trigger);
81 assert_eq!(config.price_protection_points, None);
82 }
83}