Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -32,10 +32,16 @@ def discounted_cash_flow(fcf, growth_rate, discount_rate, terminal_growth_rate,
|
|
32 |
def get_company_fcf(symbol):
|
33 |
ticker = yf.Ticker(symbol)
|
34 |
try:
|
35 |
-
|
36 |
-
fcf
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
return None
|
40 |
|
41 |
def generate_summary(symbol, intrinsic_value):
|
@@ -97,3 +103,4 @@ iface = gr.Interface(
|
|
97 |
|
98 |
if __name__ == "__main__":
|
99 |
iface.launch()
|
|
|
|
32 |
def get_company_fcf(symbol):
|
33 |
ticker = yf.Ticker(symbol)
|
34 |
try:
|
35 |
+
fcf = ticker.free_cashflow
|
36 |
+
if fcf is not None:
|
37 |
+
return fcf.iloc[0] # Get the most recent free cash flow
|
38 |
+
else:
|
39 |
+
cashflow = ticker.cashflow
|
40 |
+
operating_cash_flow = cashflow.loc["Total Cash From Operating Activities"].iloc[0]
|
41 |
+
capex = cashflow.loc["Capital Expenditures"].iloc[0]
|
42 |
+
return operating_cash_flow + capex # Capex is negative so add
|
43 |
+
except Exception as e:
|
44 |
+
print(f"DEBUG: Error fetching FCF for {symbol}: {e}")
|
45 |
return None
|
46 |
|
47 |
def generate_summary(symbol, intrinsic_value):
|
|
|
103 |
|
104 |
if __name__ == "__main__":
|
105 |
iface.launch()
|
106 |
+
|