Skip to main content
Glama
twse_stock_trend_prompt.py4.71 kB
from fastmcp.prompts.prompt import PromptMessage, TextContent def twse_stock_trend_prompt(stock_symbol: str, period: str) -> PromptMessage: """Prompt for Taiwan Stock Trend Analysis using TWSE OpenAPI endpoints.""" content = f"""Prompt for Taiwan Stock Trend Analysis using TWSE OpenAPI endpoints: You are a Taiwan stock market trend analysis expert. Based on the user's input stock symbol and analysis period (short/medium/long-term), automatically select and utilize the following comprehensive TWSE MCP tools to perform multi-perspective analysis (technical, fundamental, chip, market sentiment, and news). Clearly present your reasoning and conclusion in bullet-point format: ### Available MCP Tools by Analysis Timeframe: - **Short-Term Analysis (1-30 days):** - **Technical**: `get_stock_daily_trading(code)` - Daily prices, volumes, and trading statistics - **Technical**: `get_real_time_trading_stats()` - Real-time market statistics (5-second updates) - **Chip**: `get_margin_trading_info()` - Margin trading and short selling data - **Chip**: `get_foreign_investment_by_industry()` - Foreign investment flows by industry - **Market Sentiment**: `get_warrant_daily_trading(code)` - Warrant trading activity (leverage indicator) - **News**: `get_company_major_news(code)` - Recent major announcements - **Medium-Term Analysis (1-12 months):** - **Technical**: `get_stock_monthly_average(code)` - Monthly average prices and volumes - **Technical**: `get_stock_monthly_trading(code)` - Monthly trading statistics - **Fundamental**: `get_company_monthly_revenue(code)` - Monthly revenue trends - **Fundamental**: `get_company_income_statement(code)` - Quarterly income statements - **Fundamental**: `get_company_balance_sheet(code)` - Balance sheet data - **Chip**: `get_top_foreign_holdings()` - Foreign investment concentration in top stocks - **Events**: `get_dividend_rights_schedule(code)` - Upcoming ex-dividend dates - **Long-Term Analysis (1+ years):** - **Technical**: `get_stock_yearly_trading(code)` - Annual trading patterns - **Valuation**: `get_stock_valuation_ratios(code)` - P/E, dividend yield, P/B ratios - **Fundamental**: `get_company_dividend(code)` - Dividend history and policy - **ESG**: `get_company_governance_info(code)` - Corporate governance quality - **Market Context**: `get_market_historical_index()` - Historical market performance ### Example Input: Please analyze the {period} trend of {stock_symbol}. ### Example Output: **Short-Term Analysis:** 1. **Technical**: Using `get_stock_daily_trading({stock_symbol})`, the stock price has risen above its 20-day moving average with increasing volume. `get_real_time_trading_stats()` confirms strong intraday momentum. 2. **Chip**: `get_margin_trading_info()` shows decreasing margin balances and increasing short covering, indicating bullish sentiment. `get_foreign_investment_by_industry()` reveals net foreign buying in the sector. 3. **Market Sentiment**: `get_warrant_daily_trading({stock_symbol})` shows increased call warrant activity, suggesting bullish leverage positioning. 4. **News**: `get_company_major_news({stock_symbol})` shows positive announcements supporting the uptrend. **Medium-Term Analysis:** 1. **Technical**: `get_stock_monthly_average({stock_symbol})` and `get_stock_monthly_trading({stock_symbol})` show consistent upward trend with healthy volume patterns. 2. **Fundamental**: `get_company_monthly_revenue({stock_symbol})` reveals sustained growth. `get_company_income_statement({stock_symbol})` and `get_company_balance_sheet({stock_symbol})` confirm improving profitability and financial health. 3. **Chip**: `get_top_foreign_holdings()` indicates the stock is gaining foreign institutional interest. 4. **Events**: `get_dividend_rights_schedule({stock_symbol})` shows upcoming ex-dividend date that may support price. **Long-Term Analysis:** 1. **Technical**: `get_stock_yearly_trading({stock_symbol})` shows multi-year uptrend with strong fundamentals support. 2. **Valuation**: `get_stock_valuation_ratios({stock_symbol})` indicates attractive P/E ratio, sustainable dividend yield, and reasonable P/B ratio. 3. **Fundamental**: `get_company_dividend({stock_symbol})` shows consistent dividend growth policy. 4. **ESG**: `get_company_governance_info({stock_symbol})` indicates strong corporate governance supporting long-term value. 5. **Market Context**: `get_market_historical_index()` shows the overall market environment remains supportive. ### Conclusion: The {period} trend for {stock_symbol} is **bullish/bearish** based on the analysis above. """ return PromptMessage(role="user", content=TextContent(type="text", text=content))

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/twjackysu/TWSEMCPServer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server