Skip to content

Commit

Permalink
Fix df attribute to handle unknown fields
Browse files Browse the repository at this point in the history
  • Loading branch information
gnvk committed Jun 30, 2021
1 parent 8499b21 commit dc444a5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions alpaca_trade_api/entity_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
"l": "low",
"c": "close",
"v": "volume",
"t": "timestamp"
"t": "timestamp",
"n": "trade_count",
"vw": "vwap"
}

status_mapping_v2 = {
Expand Down Expand Up @@ -68,7 +70,7 @@ def df(self):
self._raw,
)

df.columns = [self.mapping[c] for c in df.columns]
df.columns = [self.mapping.get(c, c) for c in df.columns]
if not df.empty:
df.set_index('timestamp', inplace=True)
df.index = pd.DatetimeIndex(df.index)
Expand Down

0 comments on commit dc444a5

Please sign in to comment.