@@ -85,11 +85,14 @@ def get_prices(self, symbol_configs: dict[str, list[PriceSourceConfig]], oracle_
8585 pxs = {}
8686 for symbol in symbol_configs :
8787 for source_config in symbol_configs [symbol ]:
88- # find first valid price in the waterfall
89- px = self .get_price (source_config , oracle_update )
90- if px is not None :
91- pxs [f"{ self .market_name } :{ symbol } " ] = str (px )
92- break
88+ try :
89+ # find first valid price in the waterfall
90+ px = self .get_price (source_config , oracle_update )
91+ if px is not None :
92+ pxs [f"{ self .market_name } :{ symbol } " ] = str (px )
93+ break
94+ except Exception as e :
95+ logger .exception ("get_price exception for symbol: {} source_config: {} error: {}" , symbol , source_config , e )
9396 return pxs
9497
9598 def get_price (self , price_source_config : PriceSourceConfig , oracle_update : OracleUpdate ):
@@ -125,10 +128,10 @@ def get_price_from_pair_source(self, base_source: PriceSource, quote_source: Pri
125128 if base_price is None :
126129 return None
127130 quote_price = self .get_price_from_single_source (quote_source )
128- if quote_price is None :
131+ if quote_price is None or float ( quote_price ) == 0 :
129132 return None
130133
131- return str (round ( float (base_price ) / float (quote_price ), 2 ))
134+ return str (float (base_price ) / float (quote_price ))
132135
133136 def get_price_from_oracle_mid_average (self , symbol : str , oracle_update : OracleUpdate ):
134137 oracle_price = oracle_update .oracle .get (symbol )
0 commit comments