Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -35,7 +35,7 @@ COLORS = [
|
|
35 |
# Utility Functions
|
36 |
# ---------------------------
|
37 |
|
38 |
-
@st.
|
39 |
def fetch_sector_performance(start_date, end_date, interval='1d'):
|
40 |
"""
|
41 |
Fetches the performance data for each sector ETF over a specified date range.
|
@@ -205,11 +205,11 @@ def main():
|
|
205 |
else:
|
206 |
sector_data = []
|
207 |
last_updated = datetime.now(india_tz).strftime("%Y-%m-%d %H:%M:%S")
|
208 |
-
|
209 |
# Update last updated time if not set
|
210 |
if not st.session_state.last_updated and sector_data:
|
211 |
st.session_state.last_updated = last_updated
|
212 |
-
|
213 |
# Calculate summary stats
|
214 |
stats = get_summary_stats(sector_data)
|
215 |
|
|
|
35 |
# Utility Functions
|
36 |
# ---------------------------
|
37 |
|
38 |
+
@st.cache_data(ttl=60*5) # Cache data for 5 minutes
|
39 |
def fetch_sector_performance(start_date, end_date, interval='1d'):
|
40 |
"""
|
41 |
Fetches the performance data for each sector ETF over a specified date range.
|
|
|
205 |
else:
|
206 |
sector_data = []
|
207 |
last_updated = datetime.now(india_tz).strftime("%Y-%m-%d %H:%M:%S")
|
208 |
+
|
209 |
# Update last updated time if not set
|
210 |
if not st.session_state.last_updated and sector_data:
|
211 |
st.session_state.last_updated = last_updated
|
212 |
+
|
213 |
# Calculate summary stats
|
214 |
stats = get_summary_stats(sector_data)
|
215 |
|