Stock Analyzer
This skill is based on the logic of src/services/analyzer_service.py and provides the functionality to analyze stocks and the overall market.
Output Structure (AnalysisResult)
The analysis function returns a AnalysisResult object (or a list thereof) with a rich structure. Below is a brief overview of its key components, along with real output examples:
dashboard The properties contain the core analysis, divided into four main parts:
core_conclusion: One-sentence summary, signal type, and position recommendation.data_perspective: Technical data, including trend status, price position, volume analysis, and chip structure.intelligence: Qualitative information, such as news, risk alerts, and positive catalysts.battle_plan: Actionable strategies, including sniper points (buy/sell targets), position strategy, and a risk control checklist.
Configuration (Config)
All analysis functions can accept an optional config object. This object contains all of the application's configuration, such as API keys, notification settings, and analysis parameters.
If no config object is provided, the function will automatically use the global singleton instance loaded from the .env file.
Reference: Config
Functions
1. Analyze a single stock
Description: Analyze a single stock and return the analysis result.
When to use: When the user asks to analyze a specific stock.
Input:
stock_code(str): The stock code to analyze.config(Config, optional): Configuration object. Defaults toNone。full_report(bool, optional): Whether to generate a full report. Defaults toFalse。notifier(NotificationService, optional): Notification service object. Defaults toNone.
Output: Optional[AnalysisResult]
A AnalysisResult object containing the analysis result, or Noneif the analysis fails.
Example:
from src.services.analyzer_service import analyze_stock
# 分析单只股票
result = analyze_stock("600989")
if result:
print(f"股票: {result.name} ({result.code})")
print(f"情绪得分: {result.sentiment_score}")
print(f"操作建议: {result.operation_advice}")
Reference: analyze_stock
2. Analyze multiple stocks
Description: Analyze a list of stocks and return a list of analysis results.
When to use: When the user wants to analyze multiple stocks at once.
Input:
stock_codes(List[str]): The list of stock codes to analyze.config(Config, optional): Configuration object. Defaults toNone。full_report(bool, optional): Whether to generate a full report for each stock. Defaults toFalse。notifier(NotificationService, optional): Notification service object. Defaults toNone.
Output: List[AnalysisResult]
A list of AnalysisResult objects.
Example:
from src.services.analyzer_service import analyze_stocks
# 分析多只股票
results = analyze_stocks(["600989", "000001"])
for result in results:
print(f"股票: {result.name}, 操作建议: {result.operation_advice}")
Reference: analyze_stocks
3. Perform an overall market review
Description: Review the overall market and return a report.
When to use: When the user asks for a market overview, summary, or review.
Input:
config(Config, optional): Configuration object. Defaults toNone。notifier(NotificationService, optional): Notification service object. Defaults toNone.
Output: Optional[str]
A string containing the market review report, or if it fails, None.
Example:
from src.services.analyzer_service import perform_market_review
# 执行大盘复盘
report = perform_market_review()
if report:
print(report)
Reference: perform_market_review
Models and External Bots
- If xAI Grok is used as the DSA analysis model: configure
XAI_API_KEY+LITELLM_MODEL=xai/<官方模型ID>(LiteLLM direct connection, non-managed channel), and verify withpython scripts/check_env.py --llm. For an example, seedocs/LLM_CONFIG_GUIDE.md. - The Grok Bot launched on 2026-08-11 is another path: it is an AI teammate with Skills / Routines / MCP / computer use, and should call this repository's
analyze_stock/ REST API over HTTP, rather than configuring the Bot itself as a LiteLLM provider. For integration instructions, seedocs/grok-bot-integration.md。