Spaces:
Sleeping
Sleeping
Update agents/api_agent.py
Browse files- agents/api_agent.py +2 -1
agents/api_agent.py
CHANGED
@@ -2,6 +2,7 @@ import yfinance as yf
|
|
2 |
|
3 |
def get_asia_tech_risk(tickers):
|
4 |
data = yf.download(tickers, period="2d")['Close']
|
|
|
|
|
5 |
percent_changes = data.pct_change().iloc[-1] * 100
|
6 |
return percent_changes.to_dict()
|
7 |
-
|
|
|
2 |
|
3 |
def get_asia_tech_risk(tickers):
|
4 |
data = yf.download(tickers, period="2d")['Close']
|
5 |
+
if data.empty:
|
6 |
+
return {}
|
7 |
percent_changes = data.pct_change().iloc[-1] * 100
|
8 |
return percent_changes.to_dict()
|
|