zoya23 commited on
Commit
3aa3f09
·
verified ·
1 Parent(s): de31bcf

Update agents/api_agent.py

Browse files
Files changed (1) hide show
  1. 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()