@@ -19,7 +19,6 @@ from libc.stdint cimport uint64_t
1919from nautilus_trader.cache.cache cimport Cache
2020from nautilus_trader.common.component cimport CMD
2121from nautilus_trader.common.component cimport EVT
22- from nautilus_trader.common.component cimport RECV
2322from nautilus_trader.common.component cimport SENT
2423from nautilus_trader.common.component cimport Clock
2524from nautilus_trader.common.component cimport LogColor
@@ -101,6 +100,8 @@ cdef class OrderManager:
101100 cancel_order_handler: Callable[[Order], None] = None ,
102101 modify_order_handler: Callable[[Order , Quantity], None] = None ,
103102 bint debug = False ,
103+ bint log_events = True ,
104+ bint log_commands = True ,
104105 ):
105106 Condition.valid_string(component_name, " component_name" )
106107 Condition.callable_or_none(submit_order_handler, " submit_order_handler" )
@@ -114,6 +115,8 @@ cdef class OrderManager:
114115
115116 self .active_local = active_local
116117 self .debug = debug
118+ self .log_events = log_events
119+ self .log_commands = log_commands
117120 self ._submit_order_handler = submit_order_handler
118121 self ._cancel_order_handler = cancel_order_handler
119122 self ._modify_order_handler = modify_order_handler
@@ -554,42 +557,42 @@ cdef class OrderManager:
554557 cpdef void send_emulator_command(self , TradingCommand command):
555558 Condition.not_none(command, " command" )
556559
557- if is_logging_initialized():
560+ if self .log_commands and is_logging_initialized():
558561 self ._log.info(f" {CMD}{SENT} {command}" ) # pragma: no cover (no logging in tests)
559562 self ._msgbus.send(endpoint = " OrderEmulator.execute" , msg = command)
560563
561564 cpdef void send_algo_command(self , TradingCommand command, ExecAlgorithmId exec_algorithm_id):
562565 Condition.not_none(command, " command" )
563566 Condition.not_none(exec_algorithm_id, " exec_algorithm_id" )
564567
565- if is_logging_initialized():
568+ if self .log_commands and is_logging_initialized():
566569 self ._log.info(f" {CMD}{SENT} {command}" ) # pragma: no cover (no logging in tests)
567570 self ._msgbus.send(endpoint = f" {exec_algorithm_id}.execute" , msg = command)
568571
569572 cpdef void send_risk_command(self , TradingCommand command):
570573 Condition.not_none(command, " command" )
571574
572- if is_logging_initialized():
575+ if self .log_commands and is_logging_initialized():
573576 self ._log.info(f" {CMD}{SENT} {command}" ) # pragma: no cover (no logging in tests)
574577 self ._msgbus.send(endpoint = " RiskEngine.execute" , msg = command)
575578
576579 cpdef void send_exec_command(self , TradingCommand command):
577580 Condition.not_none(command, " command" )
578581
579- if is_logging_initialized():
582+ if self .log_commands and is_logging_initialized():
580583 self ._log.info(f" {CMD}{SENT} {command}" ) # pragma: no cover (no logging in tests)
581584 self ._msgbus.send(endpoint = " ExecEngine.execute" , msg = command)
582585
583586 cpdef void send_risk_event(self , OrderEvent event):
584587 Condition.not_none(event, " event" )
585588
586- if is_logging_initialized():
589+ if self .log_events and is_logging_initialized():
587590 self ._log.info(f" {EVT}{SENT} {event}" ) # pragma: no cover (no logging in tests)
588591 self ._msgbus.send(endpoint = " RiskEngine.process" , msg = event)
589592
590593 cpdef void send_exec_event(self , OrderEvent event):
591594 Condition.not_none(event, " event" )
592595
593- if is_logging_initialized():
596+ if self .log_events and is_logging_initialized():
594597 self ._log.info(f" {EVT}{SENT} {event}" ) # pragma: no cover (no logging in tests)
595598 self ._msgbus.send(endpoint = " ExecEngine.process" , msg = event)
0 commit comments