File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
investing_algorithm_framework/domain/models/portfolio Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 11from dateutil import parser
2+ from datetime import timezone
23from investing_algorithm_framework .domain .models .base_model import BaseModel
34from investing_algorithm_framework .domain .constants import \
45 DEFAULT_DATETIME_FORMAT
@@ -39,6 +40,9 @@ def __init__(
3940 else :
4041 self .created_at = created_at
4142
43+ # Make sure that created_at is a timezone aware datetime object
44+ self .created_at .replace (tzinfo = timezone .utc )
45+
4246 if position_snapshots is None :
4347 position_snapshots = []
4448
@@ -143,7 +147,6 @@ def to_dict(self, datetime_format=None):
143147 Returns:
144148 dict: A dictionary representation of the portfolio snapshot object.
145149 """
146-
147150 if datetime_format is not None :
148151 created_at = self .created_at .strftime (datetime_format ) \
149152 if self .created_at else None
You can’t perform that action at this time.
0 commit comments