File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1+ from polygon import WebSocketClient
2+ from polygon .websocket .models import WebSocketMessage , Market
3+ from typing import List
4+
5+ c = WebSocketClient (market = Market .Crypto , subscriptions = ['XT.*' ])
6+
7+ def handle_msg (msgs : List [WebSocketMessage ]):
8+ for m in msgs :
9+ print (m )
10+
11+ c .run (handle_msg )
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ def from_dict(d):
107107class CryptoTrade :
108108 "CryptoTrade contains trade data for a crypto pair."
109109 event_type : Optional [Union [str , EventType ]] = None
110- symbol : Optional [str ] = None
110+ pair : Optional [str ] = None
111111 exchange : Optional [int ] = None
112112 id : Optional [str ] = None
113113 price : Optional [float ] = None
@@ -120,7 +120,7 @@ class CryptoTrade:
120120 def from_dict (d ):
121121 return CryptoTrade (
122122 d .get ("ev" , None ),
123- d .get ("sym " , None ),
123+ d .get ("pair " , None ),
124124 d .get ("x" , None ),
125125 d .get ("i" , None ),
126126 d .get ("p" , None ),
You can’t perform that action at this time.
0 commit comments