bohmian commited on
Commit
81c6a1c
·
1 Parent(s): c3a703b

edited script

Browse files
.ipynb_checkpoints/[Reference and Explanation Notebook] Calculate Intrinsic Value of a Stock-checkpoint.ipynb CHANGED
The diff for this file is too large to render. See raw diff
 
[Reference and Explanation Notebook] Calculate Intrinsic Value of a Stock.ipynb CHANGED
The diff for this file is too large to render. See raw diff
 
app.py CHANGED
@@ -268,9 +268,9 @@ def run_all_steps(ticker):
268
  fig_cash_forecast = plot_forecasted_cash_flows(ticker, forecast_cash_flows_df)
269
 
270
  return q_cash_flow_statement.reset_index(), final_cash_flow_statement.reset_index(), q_balance_statement.reset_index(), fig_cash_flow, \
271
- str(EPS_growth_5Y) + '%' , str(EPS_growth_6Y_to_10Y) + '%', str(long_term_growth_rate) + '%', \
272
  beta, shares_outstanding, current_price, \
273
- discount_rate, forecast_cash_flows_df.reset_index(), terminal_value, intrinsic_value, fig_cash_forecast, margin_of_safety
274
 
275
 
276
  # Gradio App and UI
@@ -310,7 +310,9 @@ with gr.Blocks() as app:
310
 
311
  # Show detailed actual historical financial statements
312
  with gr.Row():
313
- gr.HTML("<h2>Actual Historical Financial Statements Data</h2>")
 
 
314
  with gr.Row():
315
  gr.HTML("<h3>IMPORTANT NOTE: DCF model works best only if the free cash flows are POSITIVE, STABLE and STEADILY INCREASING. Check if this is the case.</h3>")
316
 
 
268
  fig_cash_forecast = plot_forecasted_cash_flows(ticker, forecast_cash_flows_df)
269
 
270
  return q_cash_flow_statement.reset_index(), final_cash_flow_statement.reset_index(), q_balance_statement.reset_index(), fig_cash_flow, \
271
+ str(EPS_growth_5Y) + '%', str(EPS_growth_6Y_to_10Y) + '%', str(long_term_growth_rate) + '%', \
272
  beta, shares_outstanding, current_price, \
273
+ str(discount_rate) + '%', forecast_cash_flows_df.reset_index(), terminal_value, intrinsic_value, fig_cash_forecast, margin_of_safety
274
 
275
 
276
  # Gradio App and UI
 
310
 
311
  # Show detailed actual historical financial statements
312
  with gr.Row():
313
+ gr.HTML("<h2>Actual Historical Financial Statements Data from Financial Modelling Prep API</h2>")
314
+ with gr.Row():
315
+ gr.HTML("<h3>https://site.financialmodelingprep.com/developer</h3>")
316
  with gr.Row():
317
  gr.HTML("<h3>IMPORTANT NOTE: DCF model works best only if the free cash flows are POSITIVE, STABLE and STEADILY INCREASING. Check if this is the case.</h3>")
318
 
app.py.bak CHANGED
@@ -247,6 +247,8 @@ def plot_forecasted_cash_flows(ticker, forecast_cash_flows_df):
247
 
248
  # chain all the steps from the functions above together
249
  def run_all_steps(ticker):
 
 
250
  q_cash_flow_statement, cash_flow_statement, final_cash_flow_statement, q_balance_statement, latest_year = get_financial_statements(ticker)
251
 
252
  fig_cash_flow = plot_cash_flow(ticker, cash_flow_statement)
@@ -268,7 +270,7 @@ def run_all_steps(ticker):
268
  return q_cash_flow_statement.reset_index(), final_cash_flow_statement.reset_index(), q_balance_statement.reset_index(), fig_cash_flow, \
269
  str(EPS_growth_5Y) + '%' , str(EPS_growth_6Y_to_10Y) + '%', str(long_term_growth_rate) + '%', \
270
  beta, shares_outstanding, current_price, \
271
- discount_rate, forecast_cash_flows_df.reset_index(), terminal_value, intrinsic_value, fig_cash_forecast, margin_of_safety
272
 
273
 
274
  # Gradio App and UI
@@ -308,7 +310,9 @@ with gr.Blocks() as app:
308
 
309
  # Show detailed actual historical financial statements
310
  with gr.Row():
311
- gr.HTML("<h2>Actual Historical Financial Statements Data</h2>")
 
 
312
  with gr.Row():
313
  gr.HTML("<h3>IMPORTANT NOTE: DCF model works best only if the free cash flows are POSITIVE, STABLE and STEADILY INCREASING. Check if this is the case.</h3>")
314
 
 
247
 
248
  # chain all the steps from the functions above together
249
  def run_all_steps(ticker):
250
+ ticker = ticker.upper() # make sure ticker is caps
251
+
252
  q_cash_flow_statement, cash_flow_statement, final_cash_flow_statement, q_balance_statement, latest_year = get_financial_statements(ticker)
253
 
254
  fig_cash_flow = plot_cash_flow(ticker, cash_flow_statement)
 
270
  return q_cash_flow_statement.reset_index(), final_cash_flow_statement.reset_index(), q_balance_statement.reset_index(), fig_cash_flow, \
271
  str(EPS_growth_5Y) + '%' , str(EPS_growth_6Y_to_10Y) + '%', str(long_term_growth_rate) + '%', \
272
  beta, shares_outstanding, current_price, \
273
+ str(discount_rate) + '%', forecast_cash_flows_df.reset_index(), terminal_value, intrinsic_value, fig_cash_forecast, margin_of_safety
274
 
275
 
276
  # Gradio App and UI
 
310
 
311
  # Show detailed actual historical financial statements
312
  with gr.Row():
313
+ gr.HTML("<h2>Actual Historical Financial Statements Data from Financial Modelling Prep API</h2>")
314
+ with gr.Row():
315
+ gr.HTML("<h3>https://site.financialmodelingprep.com/developer</h3>")
316
  with gr.Row():
317
  gr.HTML("<h3>IMPORTANT NOTE: DCF model works best only if the free cash flows are POSITIVE, STABLE and STEADILY INCREASING. Check if this is the case.</h3>")
318