feat: 增加日志
This commit is contained in:
@@ -162,7 +162,9 @@ const apiConfig = ref<ApiConfig>({
|
|||||||
const marketOptions = [
|
const marketOptions = [
|
||||||
{ label: 'A股', value: 'A' },
|
{ label: 'A股', value: 'A' },
|
||||||
{ label: '港股', value: 'HK' },
|
{ label: '港股', value: 'HK' },
|
||||||
{ label: '美股', value: 'US' }
|
{ label: '美股', value: 'US' },
|
||||||
|
{ label: 'ETF', value: 'ETF' },
|
||||||
|
{ label: 'LOF', value: 'LOF' }
|
||||||
];
|
];
|
||||||
|
|
||||||
// 更新API配置
|
// 更新API配置
|
||||||
|
|||||||
@@ -54,14 +54,19 @@ class AIAnalyzer:
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
logger.info(f"开始AI分析 {stock_code}, 流式模式: {stream}")
|
logger.info(f"开始AI分析 {stock_code}, 流式模式: {stream}")
|
||||||
|
|
||||||
|
# AI 分析内容
|
||||||
|
# 最近14天的股票数据记录
|
||||||
recent_data = df.tail(14).to_dict('records')
|
recent_data = df.tail(14).to_dict('records')
|
||||||
|
|
||||||
|
# 包含trend, volatility, volume_trend, rsi_level的字典
|
||||||
technical_summary = {
|
technical_summary = {
|
||||||
'trend': 'upward' if df.iloc[-1]['MA5'] > df.iloc[-1]['MA20'] else 'downward',
|
'trend': 'upward' if df.iloc[-1]['MA5'] > df.iloc[-1]['MA20'] else 'downward',
|
||||||
'volatility': f"{df.iloc[-1]['Volatility']:.2f}%",
|
'volatility': f"{df.iloc[-1]['Volatility']:.2f}%",
|
||||||
'volume_trend': 'increasing' if df.iloc[-1]['Volume_Ratio'] > 1 else 'decreasing',
|
'volume_trend': 'increasing' if df.iloc[-1]['Volume_Ratio'] > 1 else 'decreasing',
|
||||||
'rsi_level': df.iloc[-1]['RSI']
|
'rsi_level': df.iloc[-1]['RSI']
|
||||||
}
|
}
|
||||||
|
print(recent_data, technical_summary)
|
||||||
|
|
||||||
# 根据市场类型调整分析提示
|
# 根据市场类型调整分析提示
|
||||||
if market_type in ['ETF', 'LOF']:
|
if market_type in ['ETF', 'LOF']:
|
||||||
@@ -210,7 +215,7 @@ class AIAnalyzer:
|
|||||||
|
|
||||||
# 尝试从整个内容中提取JSON
|
# 尝试从整个内容中提取JSON
|
||||||
full_content = "".join(collected_messages)
|
full_content = "".join(collected_messages)
|
||||||
|
print(f"尝试从整个内容中提取JSON: {full_content}")
|
||||||
# 如果没有成功解析JSON,返回原始内容
|
# 如果没有成功解析JSON,返回原始内容
|
||||||
if not full_content.strip().startswith("{"):
|
if not full_content.strip().startswith("{"):
|
||||||
yield json.dumps({
|
yield json.dumps({
|
||||||
|
|||||||
Reference in New Issue
Block a user