update pay promo

This commit is contained in:
2026-02-05 12:08:51 +08:00
parent da13b20cba
commit 5bfa223d5b

View File

@@ -729,6 +729,20 @@ TOOLS: List[ToolDefinition] = [
} }
), ),
# ==================== 分钟频数据工具 ==================== # ==================== 分钟频数据工具 ====================
ToolDefinition(
name="get_stock_realtime_timeline",
description="获取股票最新分时走势数据(自动获取今日数据,无需指定时间)。返回今日每分钟的价格、涨跌幅、成交量等数据,适合查看股票当前走势。",
parameters={
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "股票代码,例如:'600519''000001'"
}
},
"required": ["code"]
}
),
ToolDefinition( ToolDefinition(
name="get_stock_minute_data", name="get_stock_minute_data",
description="获取股票分钟频K线数据。适用于分析日内走势、寻找交易时机、技术分析等场景。", description="获取股票分钟频K线数据。适用于分析日内走势、寻找交易时机、技术分析等场景。",
@@ -1828,6 +1842,52 @@ async def handle_get_user_following_events(args: Dict[str, Any]) -> Any:
# ==================== 分钟频数据处理函数 ==================== # ==================== 分钟频数据处理函数 ====================
async def handle_get_stock_realtime_timeline(args: Dict[str, Any]) -> Any:
"""获取股票最新分时走势数据(自动获取今日数据)"""
from datetime import datetime, date
code = args["code"]
# 自动使用今天的日期
today = date.today().strftime('%Y-%m-%d')
# 调用现有的分钟数据接口,获取今日数据
result = await db.get_stock_minute_data(code, f"{today} 09:30:00", f"{today} 15:00:00", 240)
if not result:
return {
"success": True,
"data": [],
"count": 0,
"message": f"今日({today})暂无分时数据,可能是非交易日或盘前",
"trade_date": today
}
# 计算一些关键统计指标
prices = [r.get('close') or r.get('price') for r in result if r.get('close') or r.get('price')]
volumes = [r.get('volume', 0) for r in result]
summary = {}
if prices:
summary = {
"latest_price": prices[-1] if prices else None,
"open_price": prices[0] if prices else None,
"high_price": max(prices),
"low_price": min(prices),
"total_volume": sum(volumes),
"data_points": len(result),
"last_update_time": result[-1].get('time') or result[-1].get('datetime') if result else None
}
return {
"success": True,
"data": result,
"count": len(result),
"trade_date": today,
"summary": summary
}
async def handle_get_stock_minute_data(args: Dict[str, Any]) -> Any: async def handle_get_stock_minute_data(args: Dict[str, Any]) -> Any:
"""处理股票分钟频数据查询""" """处理股票分钟频数据查询"""
code = args["code"] code = args["code"]
@@ -1891,6 +1951,7 @@ TOOL_HANDLERS = {
"get_user_watchlist": handle_get_user_watchlist, "get_user_watchlist": handle_get_user_watchlist,
"get_user_following_events": handle_get_user_following_events, "get_user_following_events": handle_get_user_following_events,
# 分钟频数据工具 # 分钟频数据工具
"get_stock_realtime_timeline": handle_get_stock_realtime_timeline,
"get_stock_minute_data": handle_get_stock_minute_data, "get_stock_minute_data": handle_get_stock_minute_data,
"get_stock_minute_aggregation": handle_get_stock_minute_aggregation, "get_stock_minute_aggregation": handle_get_stock_minute_aggregation,
"get_stock_intraday_statistics": handle_get_stock_intraday_statistics, "get_stock_intraday_statistics": handle_get_stock_intraday_statistics,