-
Notifications
You must be signed in to change notification settings - Fork 1k
Add enable_event_logging
for StrategyConfig
#2183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -60,6 +60,7 @@ class StrategyConfig(NautilusConfig, kw_only=True, frozen=True): | |||
external_order_claims: list[InstrumentId] | None = None | |||
manage_contingent_orders: bool = False | |||
manage_gtd_expiry: bool = False | |||
enable_event_logging: bool = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sunlei I renamed this to a more neutral event_logging
to avoid a redundant affirmative.
We could also consider making it something like event_log_level
as well, since this new behavior still logs warning and above level events?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are similar types of logs, such as [CMD]-->
, but they involve parts of the code I’m not very familiar with. So, I didn’t make any changes there and only adjusted the <--[EVT]
logs for now. The idea of an event_log_level
is great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, this is good insight from someone running HFT strats "in the wild".
I think it might still be valuable to see the commands, or would you ideally want a similar config option to filter commands from the strategy as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, having such an option would be ideal. In my high-frequency trading environment:
-
These logs don’t hold significant value because the sheer volume makes them difficult to review, and their format can be challenging to manage. My approach is to compute key metrics directly, output them in
Logfmt
format, and write them toVictoriaMetrics
for analysis. For log-related data, I retain only the most critical logs and a few custom logs, which are then stored inVictoriaLogs
. -
Time is incredibly valuable. From my measurements, a single log entry can incur a few microseconds of overhead. To minimize this, I strive to reduce the number of logs and instead compute cumulative metrics that are periodically output using timers.
ps: This is solely my perspective based on my specific strategy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's true that these log messages can be expensive. Thanks for the insights.
Pull Request
Add
enable_event_logging
forStrategyConfig
.In high-frequency trading strategies,
<--[EVT]
type events can be particularly noisy. To address this, a toggle switch has been added for better control.Type of change