Skip to content

Commit

Permalink
Fix the quote mapping for the data steam
Browse files Browse the repository at this point in the history
  • Loading branch information
gnvk committed Apr 23, 2020
1 parent 37cae35 commit ec93871
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
37 changes: 37 additions & 0 deletions alpaca_trade_api/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,40 @@ def df(self):
)
self._df = df
return self._df


trade_mapping = {
"sym": "symbol",
"c": "conditions",
"x": "exchange",
"p": "price",
"s": "size",
"t": "timestamp"
}

quote_mapping = {
"T": "symbol",
"X": "askexchange",
"P": "askprice",
"S": "asksize",
"x": "bidexchange",
"p": "bidprice",
"s": "bidsize",
"c": "conditions",
"t": "timestamp"
}

agg_mapping = {
"sym": "symbol",
"o": "open",
"c": "close",
"h": "high",
"l": "low",
"a": "average",
"x": "exchange",
"v": "volume",
"s": "start",
"e": "end",
"vw": "vwap",
"av": "totalvolume",
}
2 changes: 1 addition & 1 deletion alpaca_trade_api/polygon/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ class DailyOpenClose(Entity):
"t": "timestamp"
}

quote_mapping = {
quote_mapping = {
"sym": "symbol",
"ax": "askexchange",
"ap": "askprice",
Expand Down
6 changes: 2 additions & 4 deletions alpaca_trade_api/stream2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
import re
import websockets
from .common import get_base_url, get_data_url, get_credentials
from .entity import Account, Entity
from .entity import Account, Entity, trade_mapping, agg_mapping, quote_mapping
from . import polygon
from .polygon.entity import (
Trade, Quote, Agg, trade_mapping, agg_mapping, quote_mapping
)
from .polygon.entity import Trade, Quote, Agg
import logging


Expand Down

0 comments on commit ec93871

Please sign in to comment.