File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -713,10 +713,14 @@ def _activity_add_description(self, act):
713713 def security_id_to_symbol (self , security_id : str ) -> str :
714714 security_symbol = f"[{ security_id } ]"
715715 if self .security_market_data_cache_getter :
716- market_data = self .get_security_market_data (security_id )
717- if isinstance (market_data , dict ) and market_data ['stock' ]:
718- stock = market_data ['stock' ]
719- security_symbol = f"{ stock ['primaryExchange' ]} :{ stock ['symbol' ]} "
716+ try :
717+ market_data = self .get_security_market_data (security_id )
718+ if isinstance (market_data , dict ) and market_data .get ('stock' ):
719+ stock = market_data ['stock' ]
720+ security_symbol = f"{ stock ['primaryExchange' ]} :{ stock ['symbol' ]} "
721+ except WSApiException :
722+ # Some securities cannot be looked up (e.g., delisted or special securities)
723+ pass
720724 return security_symbol
721725
722726 def get_etf_details (self , funding_id ):
You can’t perform that action at this time.
0 commit comments