dragon-trading-agent
龙头交易Agent · Dragon Trading Agent
개인의 거래 규칙을 코드로 만든 완전한 시스템: 정기 의사결정 보고서 + 규칙 엔진 + MCP Server + 데스크톱 대화 Agent.
Python 3.12 · FastAPI · MCP 协议 · LLM Tool-Use · SQLite · PyInstaller
⚠️ 면책 조항 / Disclaimer
한국어: 이 프로젝트는 개인적인 프로그래밍 학습과 기술 연구를 위한 것이며, 어떤 투자 조언도 구성하지 않습니다. 실거래나 상업적 용도로의 사용은 엄격히 금지되며, 모든 결과는 사용자가 부담합니다.
English: This project is for personal programming learning and technical research only. It does NOT constitute investment advice. Any use for live trading or commercial purposes is strictly prohibited. All consequences are borne by the user.
Related MCP server: AI-Kline MCP Server
프로젝트 하이라이트
완전한 클로즈드 프, 데모가 아님: 정기 스케줄링(APScheduler), 실시간 시세 수집, 규칙 엔진 의사결정에서 MCP Server를 LLM에 노출, 데스크톱 대화 인터랙션까지 — 실제로 동작하는 완전한 시스템입니다.
규칙 엔진 21개 모듈: 시장 환경 등급, 대장주 연속 상한가 노드 이론, 스윙 저점 매수 종목 선정, 전략 백테스트, 리스크 가드레일, 거래 메모리(경량 RAG), 성과 회고까지 전부 독립적으로 호출 가능합니다.
환각 방지 설계: 주요 시세를 이중 소스로 교차 검증하고, 불일치 시 '데이터 의심'으로 표기; LLM 도구 결과는 해당 라운드 메모리에만 유지되고 이력에 다시 기록하지 않으며, 이력에는 순수 텍스트만 저장합니다.
멀티 Agent 의사결정: 결정류 질문(해야 할지 말지 / 매수 / 매도)은 분석가 3명 + 진행자 1명이 다중 라운드 토론을 거쳐 수렴하고, 액션과 신뢰도를 출력합니다.
제품화 완성: pywebview 데스크톱 + 사용자 지정 아이콘으로 exe 패키징, 설정 패널에 key 검증 내장; 동시에 표준 MCP Server로 어떤 LLM에서도 호출 가능합니다.
시스템 아키텍처
┌─────────────────────────────────────────────┐
行情源 │ 规则引擎 (src/, 21 模块) │
┌──────────┐ │ │
│ 东方财富 │──┐ │ scheduler ──► market_env ──► node_engine │
│ 同花顺 │──┤ 真实 │ │ │ │ │
│ 腾讯行情 │──┼─行情─►│ market_review stock_picker │ │
│ 新浪行情 │──┘ │ │ │ │ │
└──────────┘ │ data_check ◄── risk_guard ◄── agent_core │
└───────┬─────────────┬─────────────┬──────────┘
│ │ │
┌────────▼──┐ ┌──────▼─────┐ ┌────▼─────────┐
│ 每日决策报告 │ │ MCP Server │ │ 桌面对话 Agent│
│ (Markdown, │ │ (32 工具) │ │ (pywebview + │
│ 可同步 │ │ 供 LLM 调用│ │ DeepSeek + │
│ Obsidian) │ │ │ │ 妙想数据源) │
└───────────┘ └────────────┘ └──────────────┘기술 스택
구분 | 기술 |
백엔드 | Python 3.12 · FastAPI · APScheduler 정기 스케줄링 |
프로토콜 | MCP (Model Context Protocol) Server, 32개의 |
AI | DeepSeek 스트리밍 tool-use · 妙想金融数据 MCP · 멀티 Agent 토론 수렴 |
데이터 | 东方财富 / 同花顺 / 腾讯 qt.gtimg.cn / 新浪 —— 이중 소스 교차 검증, 실제 시세만 신뢰 |
저장 | SQLite(세션 영속화)· JSON 원장 |
데스크톱 | pywebview · PyInstaller 패키징(사용자 지정 용두 테마 아이콘) |
기능 개요
진입점 | 설명 |
각 모듈이 무엇을 하는지, 도구 목록, 데스크톱 기능 | |
전체 거래 규칙 공개(코드 원문에서 발췌, 학습 참고용) | |
시스템이 매일 생성하는 보고서 샘플 |
핵심 산출물은 일일 의사결정 보고서입니다: 데이터 검증 → 시장 환경 → 시장 리뷰 → 노드 추적 → 상한가 → 스윙 저점 매수 후보 → 포지션 점검 → 의사결정 결론, 총 10개 섹션, 각 섹션마다 mermaid 플로차트가 포함됩니다.
빠른 시작
1. 의존성 설치
# 规则引擎 + 定时报告(src/)
pip install -r requirements.txt
# 桌面对话版(chat_agent/)
pip install -r chat_agent/requirements.txt2. 키 설정(데스크톱 버전에서만 필요)
데스크톱 버전 「龙头交易Agent」에는 두 개의 key가 필요하며, 로컬 config/chat_agent.json에 저정됩니다(gitignore 처리되어 저장소에 포함되지 않습니다):
cp config/chat_agent.example.json config/chat_agent.json
cp config/agent_config.example.json config/agent_config.jsonapi_key: DeepSeek(sk-...),DeepSeek 모델 호출용mx_api_key: 东方财富妙想 MCP(em_...),시세/재무/뉴스 조회용
환경 변수로 대체할 수도 있습니다(우선순위가 더 높음):DEEPSEEK_API_KEY, MX_EM_API_KEY.
키는 로컬에만 존재하며, 저장소에는 플레이스홀더 템플릿만 있고, 플레이스홀더는 검증 단계에서 거부됩니다.
3. 보고서 생성
py src/scheduler.py once보고서는 data/交易报告_YYYY-MM-DD.md로 출력됩니다. Obsidian에 동기화하려면 config/agent_config.json에서 obsidian_dir을 설정하세요.
4. 데스크톱 대화 버전 실행
py chat_agent/main.py4.1 exe로 패키징(사용자 지정 아이콘 포함)
pyinstaller chat_agent/dragon_agent.spec산출물: dist/龙头交易Agent.exe. 아이콘은 생성된 용두 테마(빨간 원형 바탕 + 금색「龙」자 + 상승 K선)이며, 소스 스크립트는 tools/make_icon.py에 있습니다. 아이콘을 바꾸려면 그 파일을 수정해 다시 생성한 다음 패키징하면 됩니다. 패키징 세부 사항과 주의사항은 spec 파일 주석을 참고하세요.
5. Windows 시작 시 자동 실행 정기 보고서
start_scheduler.vbs를 「시작 프로그램」 폴더에 넣으세요(Win+R → shell:startup). 파일 안의 경로는 자신의 환경에 맞게 수정하세요.
디렉터리 구조
src/ 规则引擎 + MCP Server(核心,21 模块)
chat_agent/ 桌面对话版「龙头交易Agent」
config/ 配置(示例模板 + 本地真实配置,后者 gitignore)
data/ 运行数据(报告/持仓/日志,gitignore 不进仓库)
docs/ 功能说明 / 交易策略 / 示例报告
tests/ 测试(80+ 用例)
tools/ 工具脚本(图标生成等)데이터 소스
데이터 소스 | 용도 |
东方财富 | 일봉 K선, 상한가 풀, 등락 종목 수, 자금 흐름(스로틀링 및 차단 보호 적용) |
同花顺 | 상한가 풀 교차 검증 |
腾讯行情 | 지수/실시간 시세(IP 차단 없음) |
新浪行情 | 지수/실시간 시세 |
妙想 MCP | 데스크톱 버전에서 자연어로 A주/홍콩주/미국주/펀드/채권/거시경제/뉴스 조회 |
License
⚠️ 면책 조항 / Disclaimer
한국어: 이 프로젝트는 개인적인 프로그래밍 학습과 기술 연구를 위한 것이며, 어떤 투자 조언도 구성하지 않습니다. 실거래나 상업적 용도로의 사용은 엄격히 금지되며, 모른 결과는 사용자가 부담합니다.
English: This project is for personal programming learning and technical research only. It does NOT constitute investment advice. Any use for live trading or commercial purposes is strictly prohibited. All consequences are borne by the user.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseCqualityDmaintenanceThe MCP provides comprehensive financial data and analytical tool support for AI large language models, specifically including the following five core data capabilities: Stock Analysis/ETF Analysis/Public Funds/News & Information/General Tools More Info: https://github.com/shenqingtech/deepq-finan44357ISC
- FlicenseNot gradedqualityDmaintenanceMCP server for A-share stock technical analysis and AI prediction, enabling LLM-based interaction to analyze stocks.340
- AlicenseAqualityDmaintenanceProvides professional financial data access for LLMs via MCP, supporting providers like Tushare, Wind, and DataYes.1458Apache 2.0
- AlicenseBqualityCmaintenanceMCP server that wraps AKShare's 1000+ financial data functions, enabling LLMs to query Chinese stock, macro, futures, fund, bond, option, forex, and alternative data through standardized tools.143Apache 2.0
Related MCP Connectors
MCP server exposing the Backtest360 engine API as tools for AI agents.
Read-only China A-share data for AI agents: market, limit-up, capital flow and disclosures.
Real SEC, 13F, insider, congress & macro data your AI agent can cite. Hosted MCP, 24 tools.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/BAI2007-Dev/dragon-trading-agent'
If you have feedback or need assistance with the MCP directory API, please join our Discord server