riteshcp commited on
Commit
80b45c4
β€’
1 Parent(s): f69428a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -180,7 +180,7 @@ def main():
180
  st.session_state.refresh += 1
181
  st.session_state.last_updated = datetime.now(india_tz).strftime("%Y-%m-%d %H:%M:%S")
182
  # Clear cached data by updating refresh counter
183
- st.experimental_memo.clear()
184
 
185
  st.markdown("---")
186
  st.markdown("**Last Updated:**")
@@ -192,7 +192,7 @@ def main():
192
  st.success("πŸ“ˆ Market is currently OPEN.")
193
  else:
194
  st.info("πŸ“‰ Market is CLOSED. Showing latest available data.")
195
-
196
  # Main content area
197
  try:
198
  with st.spinner('Fetching sector data...'):
@@ -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
 
@@ -313,7 +313,7 @@ def main():
313
  for item in sector_data:
314
  sector = item['Sector']
315
  ticker = item['Ticker']
316
- hist = item['Historical Data']
317
  st.write(f"### {sector} ({ticker})")
318
  if not hist.empty:
319
  # Display the last 10 rows for brevity
@@ -322,7 +322,7 @@ def main():
322
  st.write("No historical data available.")
323
  else:
324
  st.warning("No sector performance data available for the selected date range.")
325
-
326
  except Exception as e:
327
  st.error(f"An unexpected error occurred: {e}")
328
  st.markdown("""
 
180
  st.session_state.refresh += 1
181
  st.session_state.last_updated = datetime.now(india_tz).strftime("%Y-%m-%d %H:%M:%S")
182
  # Clear cached data by updating refresh counter
183
+ st.cache_data.clear()
184
 
185
  st.markdown("---")
186
  st.markdown("**Last Updated:**")
 
192
  st.success("πŸ“ˆ Market is currently OPEN.")
193
  else:
194
  st.info("πŸ“‰ Market is CLOSED. Showing latest available data.")
195
+
196
  # Main content area
197
  try:
198
  with st.spinner('Fetching sector data...'):
 
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
 
 
313
  for item in sector_data:
314
  sector = item['Sector']
315
  ticker = item['Ticker']
316
+ hist = item.get('Historical Data', pd.DataFrame())
317
  st.write(f"### {sector} ({ticker})")
318
  if not hist.empty:
319
  # Display the last 10 rows for brevity
 
322
  st.write("No historical data available.")
323
  else:
324
  st.warning("No sector performance data available for the selected date range.")
325
+
326
  except Exception as e:
327
  st.error(f"An unexpected error occurred: {e}")
328
  st.markdown("""