No1r97 commited on
Commit
29fc2d7
1 Parent(s): 3f898f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -105,7 +105,7 @@ def get_news(symbol, data):
105
  time.sleep(1) # control qpm
106
  weekly_news = finnhub_client.company_news(symbol, _from=start_date, to=end_date)
107
  if len(weekly_news) == 0:
108
- raise gr.Error(f"No company news found for symbol {stock_symbol} from finnhub!")
109
  weekly_news = [
110
  {
111
  "date": datetime.fromtimestamp(n['datetime']).strftime('%Y%m%d%H%M%S'),
@@ -125,7 +125,7 @@ def get_company_prompt(symbol):
125
 
126
  profile = finnhub_client.company_profile2(symbol=symbol)
127
  if not profile:
128
- raise gr.Error(f"Failed to find company profile for symbol {stock_symbol} from finnhub!")
129
 
130
  company_template = "[Company Introduction]:\n\n{name} is a leading entity in the {finnhubIndustry} sector. Incorporated and publicly traded since {ipo}, the company has established its reputation as one of the key players in the market. As of today, {name} has a market capitalization of {marketCapitalization:.2f} in {currency}, with {shareOutstanding:.2f} shares outstanding." \
131
  "\n\n{name} operates primarily in the {country}, trading under the ticker {ticker} on the {exchange}. As a dominant force in the {finnhubIndustry} space, the company continues to innovate and drive progress within the industry."
@@ -167,7 +167,7 @@ def get_current_basics(symbol, curday):
167
 
168
  basic_financials = finnhub_client.company_basic_financials(symbol, 'all')
169
  if not basic_financials['series']:
170
- raise gr.Error(f"Failed to find basic financials for symbol {stock_symbol} from finnhub!")
171
 
172
  final_basics, basic_list, basic_dict = [], [], defaultdict(dict)
173
 
 
105
  time.sleep(1) # control qpm
106
  weekly_news = finnhub_client.company_news(symbol, _from=start_date, to=end_date)
107
  if len(weekly_news) == 0:
108
+ raise gr.Error(f"No company news found for symbol {symbol} from finnhub!")
109
  weekly_news = [
110
  {
111
  "date": datetime.fromtimestamp(n['datetime']).strftime('%Y%m%d%H%M%S'),
 
125
 
126
  profile = finnhub_client.company_profile2(symbol=symbol)
127
  if not profile:
128
+ raise gr.Error(f"Failed to find company profile for symbol {symbol} from finnhub!")
129
 
130
  company_template = "[Company Introduction]:\n\n{name} is a leading entity in the {finnhubIndustry} sector. Incorporated and publicly traded since {ipo}, the company has established its reputation as one of the key players in the market. As of today, {name} has a market capitalization of {marketCapitalization:.2f} in {currency}, with {shareOutstanding:.2f} shares outstanding." \
131
  "\n\n{name} operates primarily in the {country}, trading under the ticker {ticker} on the {exchange}. As a dominant force in the {finnhubIndustry} space, the company continues to innovate and drive progress within the industry."
 
167
 
168
  basic_financials = finnhub_client.company_basic_financials(symbol, 'all')
169
  if not basic_financials['series']:
170
+ raise gr.Error(f"Failed to find basic financials for symbol {symbol} from finnhub!")
171
 
172
  final_basics, basic_list, basic_dict = [], [], defaultdict(dict)
173