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):
107
107
class CryptoTrade :
108
108
"CryptoTrade contains trade data for a crypto pair."
109
109
event_type : Optional [Union [str , EventType ]] = None
110
- symbol : Optional [str ] = None
110
+ pair : Optional [str ] = None
111
111
exchange : Optional [int ] = None
112
112
id : Optional [str ] = None
113
113
price : Optional [float ] = None
@@ -120,7 +120,7 @@ class CryptoTrade:
120
120
def from_dict (d ):
121
121
return CryptoTrade (
122
122
d .get ("ev" , None ),
123
- d .get ("sym " , None ),
123
+ d .get ("pair " , None ),
124
124
d .get ("x" , None ),
125
125
d .get ("i" , None ),
126
126
d .get ("p" , None ),
You can’t perform that action at this time.
0 commit comments