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 1
1
from dateutil import parser
2
+ from datetime import timezone
2
3
from investing_algorithm_framework .domain .models .base_model import BaseModel
3
4
from investing_algorithm_framework .domain .constants import \
4
5
DEFAULT_DATETIME_FORMAT
@@ -39,6 +40,9 @@ def __init__(
39
40
else :
40
41
self .created_at = created_at
41
42
43
+ # Make sure that created_at is a timezone aware datetime object
44
+ self .created_at .replace (tzinfo = timezone .utc )
45
+
42
46
if position_snapshots is None :
43
47
position_snapshots = []
44
48
@@ -143,7 +147,6 @@ def to_dict(self, datetime_format=None):
143
147
Returns:
144
148
dict: A dictionary representation of the portfolio snapshot object.
145
149
"""
146
-
147
150
if datetime_format is not None :
148
151
created_at = self .created_at .strftime (datetime_format ) \
149
152
if self .created_at else None
You can’t perform that action at this time.
0 commit comments