Use of standard vs. timezone-aware date
types
#1306
DaveSkender
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
That is a valid approach that not only keeps performance, but also unifies the usage of the library across projects: If we only allow UTC-times, there are no more questions and possible bugs because of different time zones. @DaveSkender I also suggest to add a UTC timezone check to |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A user raised a valid point about needing timezone awareness or offsets. I appreciate the opportunity to discuss further and to get community feedback. Let me explain the current approach of using the simpler form of
DateTime
and the rationale behind it.Why we use plain
datetime
data typesIndustry norms: Financial market data is typically timestamped relative to the exchange's local timezone and rarely includes timezone offsets. For example:
Given this, plain
datetime
objects align with the majority of use cases and data sources.Performance and simplicity: timezone-aware types (e.g.,
DateTimeOffset
in .NET ordatetime
withtzinfo
in Python) add overhead in terms of size, computation, and complexity. For a performance-focused library, this trade-off is significant, especially when handling large datasets.User-controlled normalization: The library assumes that users normalize data (e.g., to UTC) in their pre-processing pipelines. This keeps the library lightweight and focused on its core purpose—calculations and indicators.
Addressing concerns
We do recognize that timezone-aware dates could benefit use cases involving multiple exchanges or explicit timezone handling. However, introducing timezone support across the library would require careful consideration to avoid unintended side effects, such as increased memory usage, reduced performance, or breaking existing user workflows.
Possible Next Steps
Originally suggested by @goulashsoup in a bug report for our Python library
Beta Was this translation helpful? Give feedback.
All reactions