Initial: MoFin 持仓分析与策略管理系统

核心模块:
- 策略生命周期管理 (strategy_lifecycle.py)
- 技术分析引擎 (technical_analysis.py)
- 双维度策略评估 (strategy_evaluator.py)
- 实时行情获取 (get_realtime_prices.py)
- Web Dashboard (server.py, :8899)

提示词版本管理:
- prompt_manager 模块 — 统一管理所有知微提示词
- 8个提示词共24个版本已录入
- 策略→提示词版本关联追踪
- Dashboard「提示词」Tab

数据源增强:
- 服务端 POST /api/update/realtime 端点已就绪
- clients/tdx-relay/ — 小小莫在Windows上开发的通达信中继
- 解决港股15分钟延迟问题
This commit is contained in:
2026-06-12 22:54:51 +08:00
commit 9b9c37002a
65 changed files with 8659 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
"""MoFin API 推送测试"""
import sys, os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
from relay.pusher import MoFinPusher
pusher = MoFinPusher()
result = pusher.push([{
"code": "00700",
"name": "腾讯控股",
"price": 463.6,
"change_pct": 1.55,
"high": 468.0,
"low": 460.2,
"open": 462.0,
"volume": 25000000,
"timestamp": "2026-06-12 14:30:00",
}])
print(f"推送结果: {result}")
if result.get("status") == "ok":
print("✅ 推送成功")
else:
print(f"❌ 失败: {result.get('message')}")
@@ -0,0 +1,49 @@
"""通达信连接测试 — 验证能否连上招商证券服务器
用法:
python tests/test_tdx_connect.py
"""
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "src"))
try:
import opentdx
print(f"✅ opentdx {opentdx.__version__}")
except ImportError:
print("❌ 请先 pip install opentdx")
sys.exit(1)
def test_server(ip, port, name="未知"):
print(f"\n🔄 {name}: {ip}:{port}")
try:
from opentdx.tdxClient import TdxClient
from opentdx.const import EX_MARKET
with TdxClient() as client:
# A股
aq = client.stock_quotes([(0, '000001')])
if aq:
print(f" ✅ A股 平安银行: {aq[0].get('price', '?')}")
# 港股
hk = client.goods_quotes([(EX_MARKET.HK_MAIN_BOARD, '00700')])
if hk:
q = hk[0]
print(f" ✅ 港股 腾讯: {q.get('price', '?')} ({q.get('change_pct', '?')}%)")
else:
print(" ❌ 港股无数据")
except Exception as e:
print(f"{e}")
if __name__ == "__main__":
from relay.config import MARKET_SERVERS
if MARKET_SERVERS:
for name, ip, port in MARKET_SERVERS:
test_server(ip, port, name)
else:
print("⚠️ config.py 中 MARKET_SERVERS 为空")
print("请在招商证券客户端 → 通信设置 查看IP后填入")