""" Gradio interfaces module for Financial Market Data MCP Server. Creates all Gradio UI interfaces. """ import gradio as gr from .stock_quote import get_stock_quote from .historical_data import get_historical_data from .technical_analysis import get_technical_analysis from .portfolio import analyze_portfolio, compare_stocks from .market import get_market_overview from .rate_limiter import rate_limiter from .error_handler import handle_errors # Stock Quote Interface stock_quote_interface = gr.Interface( fn=get_stock_quote, inputs=gr.Textbox(label="Ticker Symbol", placeholder="AAPL"), outputs=gr.JSON(label="Stock Quote"), title="📈 Real-Time Stock Quote", description="Get current price, volume, and key metrics for any stock", examples=[["AAPL"], ["TSLA"], ["MSFT"], ["GOOGL"], ["NVDA"]] ) # Historical Data Interface historical_interface = gr.Interface( fn=get_historical_data, inputs=[ gr.Textbox(label="Ticker Symbol", placeholder="AAPL"), gr.Dropdown( choices=["1d", "5d", "1mo", "3mo", "6mo", "1y", "2y", "5y"], value="1mo", label="Period" ), gr.Dropdown( choices=["1m", "5m", "15m", "1h", "1d"], value="1d", label="Interval" ) ], outputs=gr.JSON(label="Historical Data"), title="📊 Historical Price Data", description="Get historical OHLCV data for any period and interval" ) # Technical Analysis Interface technical_interface = gr.Interface( fn=get_technical_analysis, inputs=[ gr.Textbox(label="Ticker Symbol", placeholder="AAPL"), gr.Dropdown( choices=["3mo", "6mo", "1y"], value="3mo", label="Analysis Period" ) ], outputs=gr.JSON(label="Technical Analysis"), title="🔍 Technical Analysis", description="Comprehensive technical analysis with RSI, MACD, Bollinger Bands, and trading signals", examples=[["AAPL", "3mo"], ["TSLA", "6mo"]] ) # Portfolio Analysis Interface portfolio_interface = gr.Interface( fn=analyze_portfolio, inputs=gr.Textbox( label="Portfolio Holdings (JSON)", placeholder='{"AAPL": {"shares": 10, "cost_basis": 150}, "TSLA": {"shares": 5, "cost_basis": 200}}', lines=5 ), outputs=gr.JSON(label="Portfolio Analysis"), title="💼 Portfolio Analyzer", description="Analyze your portfolio with current values, gains/losses, and allocation" ) # Stock Comparison Interface comparison_interface = gr.Interface( fn=compare_stocks, inputs=[ gr.Textbox(label="Ticker Symbols (comma-separated)", placeholder="AAPL,MSFT,GOOGL"), gr.Dropdown( choices=["performance", "valuation", "volatility"], value="performance", label="Comparison Metric" ) ], outputs=gr.JSON(label="Stock Comparison"), title="⚖️ Stock Comparison", description="Compare multiple stocks across performance, valuation, or volatility" ) # Market Overview Interface market_interface = gr.Interface( fn=get_market_overview, inputs=[], outputs=gr.JSON(label="Market Overview"), title="🌍 Market Overview", description="Current status of major market indices and overall sentiment" )