61 lines
1.6 KiB
Python
61 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
||
"""
|
||
A股短期题材选股 - 手动执行脚本
|
||
"""
|
||
import asyncio
|
||
import sys
|
||
import os
|
||
|
||
# 添加项目根目录到Python路径
|
||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||
|
||
from app.utils.logger import logger
|
||
from app.astock_agent.astock_agent import get_astock_agent
|
||
|
||
|
||
async def main():
|
||
"""手动执行选股"""
|
||
# 解析命令行参数
|
||
strict_mode = '--strict' in sys.argv or '-s' in sys.argv
|
||
|
||
try:
|
||
print("\n" + "=" * 60)
|
||
mode_text = "严格模式" if strict_mode else "宽松模式(适应当前市场)"
|
||
print(f"📊 A股短期题材选股 - 手动执行 [{mode_text}]")
|
||
print("=" * 60)
|
||
|
||
if not strict_mode:
|
||
print("\n💡 使用宽松模式:")
|
||
print(" - 市值: 30-1000亿(原50-500亿)")
|
||
print(" - 换手率: 1%-20%(原3%-15%)")
|
||
print(" - 板块涨幅: ≥1.5%(原2%)")
|
||
print(" - 量比: ≥1.0(原1.2)")
|
||
print("\n使用 --strict 或 -s 参数启用严格模式")
|
||
|
||
# 获取智能体实例
|
||
agent = get_astock_agent()
|
||
|
||
# 设置模式
|
||
agent.selector.strict_mode = strict_mode
|
||
|
||
# 执行选股
|
||
result = await agent.run_once()
|
||
|
||
# 输出结果
|
||
print("\n" + "=" * 60)
|
||
print(agent.selector.format_output_text(result))
|
||
print("=" * 60 + "\n")
|
||
|
||
return 0
|
||
|
||
except Exception as e:
|
||
logger.error(f"选股执行失败: {e}")
|
||
import traceback
|
||
logger.error(traceback.format_exc())
|
||
return 1
|
||
|
||
|
||
if __name__ == "__main__":
|
||
exit_code = asyncio.run(main())
|
||
sys.exit(exit_code)
|