Dmitry Beresnev commited on
Commit Β·
cfe2c87
1
Parent(s): 253cc2c
fix economic calendar
Browse filesFiles changed (2)
666 unmodified lines66766866967067167267367467567667767867968068168268368468568668767067167267367467567667767820 unmodified lines699700701714715716717718719720721722723724725726727728729730731732733734735736702703704705706707708709710711712713714715716717718666 unmodified lines st.info("π
No upcoming economic events in the next 7 days") return
# Widget container widget_html = """ <div style=" background: linear-gradient(135deg, #1E222D 0%, #131722 100%); border: 1px solid #2A2E39; border-radius: 12px; padding: 20px; margin-bottom: 20px; "> <div style="margin-bottom: 16px;"> <h3 style="color: #D1D4DC; font-size: 18px; font-weight: 600; margin: 0;"> π
Economic Calendar </h3> <p style="color: #787B86; font-size: 13px; margin: 4px 0 0 0;"> Upcoming high-impact events </p> </div> """ # Build widget HTML with single-line styles (no leading whitespace) widget_html = """<div style="background: linear-gradient(135deg, #1E222D 0%, #131722 100%); border: 1px solid #2A2E39; border-radius: 12px; padding: 20px; margin-bottom: 20px;"><div style="margin-bottom: 16px;"><h3 style="color: #D1D4DC; font-size: 18px; font-weight: 600; margin: 0;">π
Economic Calendar</h3><p style="color: #787B86; font-size: 13px; margin: 4px 0 0 0;">Upcoming high-impact events</p></div>"""
# Show top 10 events for idx, event in events_df.head(10).iterrows():20 unmodified lines # Format forecast forecast_display = f"{forecast:.1f}" if forecast is not None else "N/A"
event_html = f""" <div style=" background: #0D0E13; border-left: 3px solid {'#F23645' if importance == 'high' else '#FF9800' if importance == 'medium' else '#787B86'}; border-radius: 6px; padding: 12px; margin-bottom: 10px; "> <div style="display: flex; justify-content: space-between; align-items: center;"> <div style="flex: 1;"> <div style="color: #D1D4DC; font-size: 13px; font-weight: 500; margin-bottom: 4px;"> {flag} {event_name} </div> <div style="color: #787B86; font-size: 11px;"> {stars} Forecast: {forecast_display} </div> </div> <div style="color: #3861FB; font-size: 12px; font-weight: 600; white-space: nowrap; margin-left: 12px;"> {time_to_event} </div> </div> </div> """ # Importance color importance_color = '#F23645' if importance == 'high' else '#FF9800' if importance == 'medium' else '#787B86'
# Build event HTML (no leading whitespace, single-line styles) event_html = f"""<div style="background: #0D0E13; border-left: 3px solid {importance_color}; border-radius: 6px; padding: 12px; margin-bottom: 10px;"><div style="display: flex; justify-content: space-between; align-items: center;"><div style="flex: 1;"><div style="color: #D1D4DC; font-size: 13px; font-weight: 500; margin-bottom: 4px;">{flag} {event_name}</div><div style="color: #787B86; font-size: 11px;">{stars} Forecast: {forecast_display}</div></div><div style="color: #3861FB; font-size: 12px; font-weight: 600; white-space: nowrap; margin-left: 12px;">{time_to_event}</div></div></div>"""
widget_html += event_html
524 unmodified lines525526527528529530531532533534535536537538539540541542543528529530531532533534535536537538524 unmodified lines # Clear the status message after all sources complete status_placeholder.success(f"β
Loaded {len(completed_sources)}/8 sources successfully")
# Debug output - temporarily enabled to diagnose new sourcesif True: # st.session_state.get('debug_mode', False): st.write("### Debug: News Fetch Results") st.write(f"- Twitter: {len(twitter_df)} items") st.write(f"- Reddit: {len(reddit_df)} items") st.write(f"- RSS: {len(rss_all_df)} items") st.write(f"- AI/Tech: {len(ai_tech_df)} items") st.write(f"- Predictions: {len(predictions_df)} items") st.write(f"- Sectoral News: {len(sectoral_news_df)} items") st.write(f"- Market Events: {len(market_events_df)} items") st.write(f"- Economic Calendar: {len(economic_calendar_df)} items") st.write(f"- Availability: Predictions={PREDICTIONS_AVAILABLE}, Sectoral={SECTORAL_AVAILABLE}, Events={EVENTS_AVAILABLE}, Calendar={CALENDAR_AVAILABLE}") if fetch_errors: st.write(f"- Errors: {len(fetch_errors)}") for err in fetch_errors: st.write(f" - {err}")# Debug logging (console only, not displayed on page)import logginglogger = logging.getLogger(__name__)logger.info(f"News Fetch Results: Twitter={len(twitter_df)}, Reddit={len(reddit_df)}, RSS={len(rss_all_df)}, AI/Tech={len(ai_tech_df)}, Predictions={len(predictions_df)}, Sectoral={len(sectoral_news_df)}, Events={len(market_events_df)}, Calendar={len(economic_calendar_df)}")logger.info(f"Availability: Predictions={PREDICTIONS_AVAILABLE}, Sectoral={SECTORAL_AVAILABLE}, Events={EVENTS_AVAILABLE}, Calendar={CALENDAR_AVAILABLE}")if fetch_errors: for err in fetch_errors: logger.warning(f"Fetch error: {err}")
# Clear force refresh flag after fetching is completeif force_refresh:app/components/news.py+20-41
app/pages/05_Dashboard.py+8-16