Skip to content

Commit 3538644

Browse files
author
Shlomi Kushchi
authored
add comment on why we check for timestamp size
1 parent 319f28b commit 3538644

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

alpaca_trade_api/entity.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ def __getattr__(self, key):
135135
val = self._raw[key]
136136
if key == 'timestamp':
137137
if val > 1000000000000000000:
138+
# this is for supporing timestamp represented in nanosecond.
139+
# the alpaca data api uses nanoseconds. polygon uses microseconds.
138140
return pd.Timestamp(val, tz=NY)
139141
return pd.Timestamp(val, tz=NY, unit='ms')
140142
return val

0 commit comments

Comments
 (0)