Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/websocket/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from polygon.websocket.models import WebSocketMessage, Market
from typing import List

c = WebSocketClient(market=Market.Crypto, subscriptions=["XT.*"])
c = WebSocketClient(market=Market.Crypto, subscriptions=["XA.*"])


def handle_msg(msgs: List[WebSocketMessage]):
Expand Down
2 changes: 1 addition & 1 deletion polygon/websocket/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(
"""
Initialize a Polygon WebSocketClient.

:param api_key: Your API keYour API key.
:param api_key: Your API key.
:param feed: The feed to subscribe to.
:param raw: Whether to pass raw Union[str, bytes] to user callback.
:param verbose: Whether to log client and server status messages.
Expand Down
4 changes: 1 addition & 3 deletions polygon/websocket/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ def parse_single(data: Dict[str, Any]):
event_type = data["ev"]
if event_type in [EventType.EquityAgg.value, EventType.EquityAggMin.value]:
return EquityAgg.from_dict(data)
elif event_type == EventType.CryptoAgg.value:
return CurrencyAgg.from_dict(data)
elif event_type == EventType.CryptoQuote.value:
elif event_type in [EventType.CryptoAgg.value, EventType.ForexAgg.value]:
return CurrencyAgg.from_dict(data)
elif event_type == EventType.EquityTrade.value:
return EquityTrade.from_dict(data)
Expand Down
4 changes: 2 additions & 2 deletions polygon/websocket/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class Market(Enum):
class EventType(Enum):
EquityAgg = "A"
EquityAggMin = "AM"
CryptoAgg = "CA"
ForexAgg = "XA"
CryptoAgg = "XA"
ForexAgg = "CA"
EquityTrade = "T"
CryptoTrade = "XT"
EquityQuote = "Q"
Expand Down
2 changes: 1 addition & 1 deletion polygon/websocket/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CurrencyAgg:
vwap: Optional[float] = None
start_timestamp: Optional[int] = None
end_timestamp: Optional[int] = None
avg_trade_size: Optional[int] = None
avg_trade_size: Optional[float] = None

@staticmethod
def from_dict(d):
Expand Down