Skip to content
This repository was archived by the owner on Jun 15, 2024. It is now read-only.

Commit 6696f15

Browse files
committed
fixes #157
1 parent 2591994 commit 6696f15

File tree

2 files changed

+35
-26
lines changed

2 files changed

+35
-26
lines changed

pyEX/common.py

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -138,51 +138,53 @@
138138
]
139139

140140
_STANDARD_DATE_FIELDS = [
141+
"consensusEndDate",
142+
"consensusStartDate",
143+
"DailyListTimestamp",
141144
"date",
145+
"datetime",
146+
"declaredDate",
142147
"EPSReportDate",
143-
"fiscalEndDate",
148+
"endDate",
144149
"exDate",
145-
"declaredDate",
146-
"paymentDate",
147-
"recordDate",
148-
"reportDate",
149-
"datetime",
150150
"expectedDate",
151+
"expirationDate",
152+
"fiscalEndDate",
151153
"latestTime",
152-
"DailyListTimestamp",
153-
"RecordUpdateTime",
154-
"settlementDate",
154+
"lastTradeDate",
155155
"lastUpdated",
156+
"paymentDate",
156157
"processedTime",
157-
"expirationDate",
158+
"recordDate",
159+
"RecordUpdateTime",
160+
"reportDate",
161+
"settlementDate",
158162
"startDate",
159-
"endDate",
160-
"consensusEndDate",
161-
"consensusStartDate",
162163
]
163164

164165
_STANDARD_TIME_FIELDS = [
165166
"closeTime",
166167
"close.time",
167168
"delayedPriceTime",
168169
"extendedPriceTime",
170+
"highTime",
171+
"iexCloseTime",
169172
"iexLastUpdated",
173+
"iexOpenTime",
174+
"lastTradeTime",
175+
"lastUpdated",
170176
"latestTime",
177+
"latestUpdate",
178+
"lowTime",
179+
"oddLotDelayedPriceTime",
171180
"openTime",
172181
"open.time",
173182
"processedTime",
183+
"report_date",
184+
"reportDate",
174185
"time",
175186
"timestamp",
176-
"lastUpdated",
177-
"reportDate",
178-
"report_date",
179-
"iexOpenTime",
180-
"iexCloseTime",
181-
"lastTradeTime",
182-
"highTime",
183-
"lowTime",
184-
"latestUpdate",
185-
"oddLotDelayedPriceTime",
187+
"updated",
186188
]
187189

188190
_INDICATORS = [
@@ -794,8 +796,15 @@ def _reindex(df, col):
794796

795797
def _toDatetime(df, cols=None, tcols=None):
796798
"""internal"""
797-
cols = cols if cols is not None else _STANDARD_DATE_FIELDS
798-
tcols = tcols if tcols is not None else _STANDARD_TIME_FIELDS
799+
if not isinstance(cols, list):
800+
cols = [cols]
801+
if not isinstance(tcols, list):
802+
tcols = [tcols]
803+
804+
cols = cols + _STANDARD_DATE_FIELDS if cols is not None else _STANDARD_DATE_FIELDS
805+
tcols = (
806+
tcols + _STANDARD_TIME_FIELDS if tcols is not None else _STANDARD_TIME_FIELDS
807+
)
799808

800809
for col in cols:
801810
if col in df.columns:

pyEX/options/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ def options(symbol, expiration, side="", token="", version="", filter=""):
6464
def optionsDF(symbol, expiration, side="", token="", version="", filter=""):
6565
p = options(symbol, expiration, side, token, version, filter)
6666
df = pd.DataFrame(p)
67-
_toDatetime(df)
67+
_toDatetime(df, tcols=["date"])
6868
return df

0 commit comments

Comments
 (0)