Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,21 +26,17 @@ def fetch_stock_data(ticker_symbol):
|
|
26 |
}
|
27 |
|
28 |
return financials, info
|
|
|
|
|
29 |
|
30 |
-
#
|
31 |
-
|
32 |
-
# User interface in Streamlit
|
33 |
-
st.title('S&P 500 Stock Comparison Tool')
|
34 |
-
|
35 |
-
# Check if companies are in the S&P 500
|
36 |
-
@st.cache
|
37 |
def get_sp500_list():
|
38 |
table = pd.read_html('https://en.wikipedia.org/wiki/List_of_S%26P_500_companies')
|
39 |
return table[0]['Symbol'].tolist()
|
40 |
|
|
|
41 |
sp500_list = get_sp500_list()
|
42 |
-
|
43 |
-
# Load S&P 500 averages
|
44 |
sp500_averages = load_sp500_averages(sp500_averages_path)
|
45 |
|
46 |
# Calculate combined scores for stocks in the S&P 500
|
|
|
26 |
}
|
27 |
|
28 |
return financials, info
|
29 |
+
# Define the path to your CSV file
|
30 |
+
sp500_averages_path = 'sp500_averages.csv'
|
31 |
|
32 |
+
# Update the cache decorator
|
33 |
+
@st.experimental_memo
|
|
|
|
|
|
|
|
|
|
|
34 |
def get_sp500_list():
|
35 |
table = pd.read_html('https://en.wikipedia.org/wiki/List_of_S%26P_500_companies')
|
36 |
return table[0]['Symbol'].tolist()
|
37 |
|
38 |
+
# Use the updated cache function and define the CSV path
|
39 |
sp500_list = get_sp500_list()
|
|
|
|
|
40 |
sp500_averages = load_sp500_averages(sp500_averages_path)
|
41 |
|
42 |
# Calculate combined scores for stocks in the S&P 500
|