Tonic commited on
Commit
1f90215
Β·
unverified Β·
1 Parent(s): dfd9f16

refactor global market info into a single accordion

Browse files
Files changed (1) hide show
  1. app.py +59 -36
app.py CHANGED
@@ -2974,33 +2974,65 @@ The **Advanced Stock Prediction System** is a cutting-edge AI-powered platform w
2974
 
2975
  gr.Markdown("---") # Add a separator
2976
 
2977
- # Add market status message with periodic updates
2978
- market_status_display = gr.Markdown(
2979
- value=get_market_status_display()
2980
- )
2981
-
2982
- # Note: Market status updates automatically in the background thread every 10 minutes
2983
- # The display can be manually refreshed by users if needed
2984
-
2985
- # Add simple market status check feature
2986
  with gr.Accordion("🌎 Global Market Information", open=False):
2987
- with gr.Column(scale=1):
2988
- gr.Markdown("### πŸ“Š Quick Market Status Check")
2989
- # Create user-friendly market choices
2990
- market_choices = [(config['name'], key) for key, config in MARKET_CONFIGS.items()]
2991
- market_dropdown = gr.Dropdown(
2992
- choices=market_choices,
2993
- label="Select Market",
2994
- value="US_STOCKS",
2995
- info="Choose a market to check its current status"
2996
- )
2997
- check_market_btn = gr.Button("πŸ” Check Market Status", variant="primary")
 
 
 
 
 
 
 
 
2998
 
2999
- with gr.Column(scale=2):
3000
- market_status_result = gr.Markdown(
3001
- value="Select a market and click 'Check Market Status' to see current trading status.",
3002
- label="Market Status Result"
3003
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3004
 
3005
  # Connect the button to the function
3006
  check_market_btn.click(
@@ -3016,17 +3048,8 @@ The **Advanced Stock Prediction System** is a cutting-edge AI-powered platform w
3016
  with gr.Row():
3017
  with gr.Column():
3018
  gr.Markdown("### Market Summary")
3019
- market_summary_display = gr.JSON(label="Market Summary", value={})
3020
-
3021
- def update_market_summary():
3022
- """Update market summary with enhanced yfinance data"""
3023
- return get_enhanced_market_summary()
3024
-
3025
- update_market_summary_btn = gr.Button("πŸ”„ Update Market Summary")
3026
- update_market_summary_btn.click(
3027
- fn=update_market_summary,
3028
- outputs=[market_summary_display]
3029
- )
3030
 
3031
  with gr.Column():
3032
  gr.Markdown("### Market Types Supported")
 
2974
 
2975
  gr.Markdown("---") # Add a separator
2976
 
2977
+ # Add comprehensive market information section with nested accordions
 
 
 
 
 
 
 
 
2978
  with gr.Accordion("🌎 Global Market Information", open=False):
2979
+ # Quick Market Status Check Section
2980
+ with gr.Accordion("πŸ“Š Quick Market Status Check", open=False):
2981
+ with gr.Column(scale=1):
2982
+ gr.Markdown("### πŸ“Š Quick Market Status Check")
2983
+ # Create user-friendly market choices
2984
+ market_choices = [(config['name'], key) for key, config in MARKET_CONFIGS.items()]
2985
+ market_dropdown = gr.Dropdown(
2986
+ choices=market_choices,
2987
+ label="Select Market",
2988
+ value="US_STOCKS",
2989
+ info="Choose a market to check its current status"
2990
+ )
2991
+ check_market_btn = gr.Button("πŸ” Check Market Status", variant="primary")
2992
+
2993
+ with gr.Column(scale=2):
2994
+ market_status_result = gr.Markdown(
2995
+ value="Select a market and click 'Check Market Status' to see current trading status.",
2996
+ label="Market Status Result"
2997
+ )
2998
 
2999
+ # Enhanced Market Information Section
3000
+ with gr.Accordion("🌍 Enhanced Market Information", open=False):
3001
+ with gr.Row():
3002
+ with gr.Column():
3003
+ gr.Markdown("### Market Summary")
3004
+ market_summary_display = gr.JSON(label="Market Summary", value={})
3005
+
3006
+ def update_market_summary():
3007
+ """Update market summary with enhanced yfinance data"""
3008
+ return get_enhanced_market_summary()
3009
+
3010
+ update_market_summary_btn = gr.Button("πŸ”„ Update Market Summary")
3011
+ update_market_summary_btn.click(
3012
+ fn=update_market_summary,
3013
+ outputs=[market_summary_display]
3014
+ )
3015
+
3016
+ with gr.Column():
3017
+ gr.Markdown("### Market Types Supported")
3018
+ gr.Markdown("""
3019
+ **πŸ“ˆ Stock Markets:**
3020
+ - **US Stocks** (NYSE, NASDAQ, AMEX): 9:30 AM - 4:00 PM ET
3021
+ - **European Markets** (London, Frankfurt, Paris): 8:00 AM - 4:30 PM GMT
3022
+ - **Asian Markets** (Tokyo, Hong Kong, Shanghai): 9:00 AM - 3:30 PM JST
3023
+
3024
+ **πŸ“Š 24/7 Markets:**
3025
+ - **Forex** (Global Currency Exchange): 24/7 trading
3026
+ - **Cryptocurrency** (Bitcoin, Ethereum, Altcoins): 24/7 trading
3027
+ - **US Futures** (CME, ICE, CBOT): 24/7 trading
3028
+ - **Commodities** (Gold, Silver, Oil, Natural Gas): 24/7 trading
3029
+
3030
+ **πŸ’‘ Features:**
3031
+ - Real-time market status updates every 10 minutes
3032
+ - Timezone-aware calculations
3033
+ - Market-specific trading hours
3034
+ - Enhanced data from yfinance API
3035
+ """)
3036
 
3037
  # Connect the button to the function
3038
  check_market_btn.click(
 
3048
  with gr.Row():
3049
  with gr.Column():
3050
  gr.Markdown("### Market Summary")
3051
+ # This section is now handled in the nested accordion above
3052
+ gr.Markdown("Market summary functionality is available in the 'Enhanced Market Information' section above.")
 
 
 
 
 
 
 
 
 
3053
 
3054
  with gr.Column():
3055
  gr.Markdown("### Market Types Supported")