CCockrum commited on
Commit
b6b7ca1
·
verified ·
1 Parent(s): 1e02760

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -46,7 +46,14 @@ def generate_summary(symbol, intrinsic_value):
46
  def dcf_interface(symbol, growth_rate, discount_rate, terminal_growth_rate, forecast_years):
47
  fcf = get_company_fcf(symbol)
48
  if fcf is None:
49
- return "Error fetching financial data. Please check the symbol or try another company.", None, None
 
 
 
 
 
 
 
50
 
51
  fcf_forecast, present_values, terminal_value, terminal_value_pv, total_intrinsic_value = discounted_cash_flow(
52
  fcf, growth_rate, discount_rate, terminal_growth_rate, forecast_years
@@ -57,7 +64,6 @@ def dcf_interface(symbol, growth_rate, discount_rate, terminal_growth_rate, fore
57
  'Present Value of FCF ($)': present_values
58
  })
59
 
60
- # Plot FCF
61
  fig, ax = plt.subplots()
62
  ax.plot(df['Year'], df['Forecasted FCF ($)'], marker='o')
63
  ax.set_title('Forecasted Free Cash Flow Over Time')
 
46
  def dcf_interface(symbol, growth_rate, discount_rate, terminal_growth_rate, forecast_years):
47
  fcf = get_company_fcf(symbol)
48
  if fcf is None:
49
+ empty_df = pd.DataFrame({"Error": ["Invalid symbol or no data available"]})
50
+
51
+ fig, ax = plt.subplots()
52
+ ax.text(0.5, 0.5, 'Error: Invalid Symbol', fontsize=12, ha='center')
53
+ ax.axis('off')
54
+
55
+ error_message = "⚠️ Error fetching financial data. Please check the symbol or try another company."
56
+ return empty_df, fig, error_message
57
 
58
  fcf_forecast, present_values, terminal_value, terminal_value_pv, total_intrinsic_value = discounted_cash_flow(
59
  fcf, growth_rate, discount_rate, terminal_growth_rate, forecast_years
 
64
  'Present Value of FCF ($)': present_values
65
  })
66
 
 
67
  fig, ax = plt.subplots()
68
  ax.plot(df['Year'], df['Forecasted FCF ($)'], marker='o')
69
  ax.set_title('Forecasted Free Cash Flow Over Time')