File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 1+ from polygon import WebSocketClient
2+ from polygon .websocket .models import WebSocketMessage , Feed , Market
3+ from typing import List
4+
5+ client = WebSocketClient (feed = Feed .Business , market = Market .Stocks , verbose = True )
6+
7+ # FMV
8+ client .subscribe ("FMV.*" ) # all ticker symbols
9+ # client.subscribe("FMV.TSLA")
10+ # client.subscribe("FMV.AAPL")
11+ # client.subscribe("FMV.NVDA")
12+
13+
14+ def handle_msg (msgs : List [WebSocketMessage ]):
15+ for m in msgs :
16+ print (m )
17+
18+
19+ client .run (handle_msg )
Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ def parse_single(data: Dict[str, Any]):
3535 return IndexValue .from_dict (data )
3636 elif event_type == EventType .LaunchpadValue .value :
3737 return LaunchpadValue .from_dict (data )
38+ elif event_type == EventType .BusinessFairMarketValue .value :
39+ return FairMarketValue .from_dict (data )
3840 return None
3941
4042
Original file line number Diff line number Diff line change @@ -351,7 +351,7 @@ class FairMarketValue:
351351
352352 @staticmethod
353353 def from_dict (d ):
354- return LaunchpadValue (
354+ return FairMarketValue (
355355 event_type = d .get ("ev" , None ),
356356 fmv = d .get ("fmv" , None ),
357357 ticker = d .get ("sym" , None ),
@@ -375,6 +375,7 @@ def from_dict(d):
375375 Level2Book ,
376376 IndexValue ,
377377 LaunchpadValue ,
378+ FairMarketValue ,
378379 ]
379380 ],
380381)
You can’t perform that action at this time.
0 commit comments