@@ -1783,27 +1783,31 @@ def load_klines_for_coin(self, coin: Coin) -> bool:
1783
1783
"""fetches from binance or a local cache klines for a coin"""
1784
1784
1785
1785
ok : bool = False
1786
- data : Dict [str , Dict [str , List [List [float ]]]] = {}
1787
- # fetch all the available klines for this coin, for the last
1788
- # 60min, 24h, and 1000 days
1789
- logging .debug ("calling klines_caching_service_url" )
1790
- response : requests .Response = requests .get (
1791
- self .klines_caching_service_url
1792
- + f"?symbol={ coin .symbol } "
1793
- + f"&date={ coin .date } "
1794
- + f"&mode={ self .mode } "
1795
- + f"&debug={ self .debug } " ,
1796
- timeout = 30 ,
1797
- )
1798
- data = response .json ()
1799
- if data :
1800
- logging .debug ("klines_caching_service_url reponse: ok" )
1801
- ok = True
1802
- coin .lowest = data ["lowest" ]
1803
- coin .averages = data ["averages" ]
1804
- coin .highest = data ["highest" ]
1805
- logging .debug (f"klines_caching_service_url reponse: { data } " )
1806
-
1786
+ try :
1787
+ # fetch all the available klines for this coin, for the last
1788
+ # 60min, 24h, and 1000 days
1789
+ logging .debug ("calling klines_caching_service_url" )
1790
+ response : requests .Response = requests .get (
1791
+ self .klines_caching_service_url
1792
+ + f"?symbol={ coin .symbol } "
1793
+ + f"&date={ coin .date } "
1794
+ + f"&mode={ self .mode } "
1795
+ + f"&debug={ self .debug } " ,
1796
+ timeout = 30 ,
1797
+ )
1798
+ data : Dict [str , Dict [str , List [List [float ]]]] = response .json ()
1799
+ if data :
1800
+ logging .debug ("klines_caching_service_url reponse: ok" )
1801
+ coin .lowest = data ["lowest" ]
1802
+ coin .averages = data ["averages" ]
1803
+ coin .highest = data ["highest" ]
1804
+ logging .debug (f"klines_caching_service_url reponse: { data } " )
1805
+ ok = True
1806
+ except Exception as error_msg : # pylint: disable=broad-except
1807
+ logging .warning (
1808
+ f"Error calling klines_caching_serice { coin .symbol } { coin .date } "
1809
+ )
1810
+ logging .debug (f"Exception: { error_msg } " )
1807
1811
return ok
1808
1812
1809
1813
@retry (wait = wait_exponential (multiplier = 1 , max = 3 ))
0 commit comments