Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -147,16 +147,28 @@ def calculate_ratios(market_cap, total_revenue, price, dividend_amount, assumed_
|
|
147 |
|
148 |
def compare_to_sector(sector, ratios):
|
149 |
if sector.lower() == 'stocks':
|
150 |
-
sector = 'Technology'
|
151 |
-
averages = sector_averages.get(sector,
|
152 |
if not averages:
|
153 |
return pd.DataFrame({"Metric": ["Sector data not available"], "Value": ["N/A"]})
|
154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
for key in averages:
|
156 |
stock_value = ratios.get(key, 0)
|
157 |
-
sector_value = averages
|
158 |
-
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
def stock_research(symbol, assumed_eps=5.0, growth_rate=0.1, book_value=500000000):
|
162 |
info = get_company_info(symbol)
|
|
|
147 |
|
148 |
def compare_to_sector(sector, ratios):
|
149 |
if sector.lower() == 'stocks':
|
150 |
+
sector = 'Technology'
|
151 |
+
averages = sector_averages.get(sector, {})
|
152 |
if not averages:
|
153 |
return pd.DataFrame({"Metric": ["Sector data not available"], "Value": ["N/A"]})
|
154 |
+
|
155 |
+
data = {
|
156 |
+
"Ratio": [],
|
157 |
+
"Stock Value": [],
|
158 |
+
"Sector Average": [],
|
159 |
+
"Difference": []
|
160 |
+
}
|
161 |
+
|
162 |
for key in averages:
|
163 |
stock_value = ratios.get(key, 0)
|
164 |
+
sector_value = averages.get(key, 0)
|
165 |
+
diff = stock_value - sector_value
|
166 |
+
data["Ratio"].append(key)
|
167 |
+
data["Stock Value"].append(round(stock_value, 2))
|
168 |
+
data["Sector Average"].append(round(sector_value, 2))
|
169 |
+
data["Difference"].append(round(diff, 2))
|
170 |
+
|
171 |
+
return pd.DataFrame(data)
|
172 |
|
173 |
def stock_research(symbol, assumed_eps=5.0, growth_rate=0.1, book_value=500000000):
|
174 |
info = get_company_info(symbol)
|