@zltquant/zlt-mcp 0.8.0-dev.19544 → 0.8.0-dev.19544.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -9
- package/config.json +966 -3
- package/package.json +1 -1
- package/zlt-mcp-proxy.bundle.cjs +8418 -5505
package/config.json
CHANGED
|
@@ -1243,21 +1243,23 @@
|
|
|
1243
1243
|
},
|
|
1244
1244
|
{
|
|
1245
1245
|
"name": "mcp-wait",
|
|
1246
|
-
"description": "阻塞等待一个异步任务结束,直到需要 agent 行动的状态才返回。kind=backtest 等回测,id 传 mcp-create-and-run-backtest / mcp-re-backtest 返回的 runId;kind=download 等数据下载,id 传 mcp-download-data 返回的 uuid(传 \"0\" 等本机当前最新下载任务)。拿到任务 id
|
|
1246
|
+
"description": "阻塞等待一个异步任务结束,直到需要 agent 行动的状态才返回。kind=install 等 runtime 安装,id 传 zlt-runtime-install 返回的 taskId;kind=factor 等因子计算/检测,id 传启动工具返回的 executionId;kind=backtest 等回测,id 传 mcp-create-and-run-backtest / mcp-re-backtest 返回的 runId;kind=download 等数据下载,id 传 mcp-download-data 返回的 uuid(传 \"0\" 等本机当前最新下载任务)。拿到任务 id 后应立即调用本工具,等待期间不要做任何其他事、不要轮询状态。启动命令创建的隐藏 CLI guardian 会自行携带回测尝试边界;任何后续显式 CLI call 或 MCP 重启后的调用,kind=backtest 必须同时传启动/重跑响应返回的 codePath 和 attemptFence;同一 MCP 会话内可省略。\n\nkind=factor 返回与 mcp-factor-task-status 相同的结果。终态是 status=3(失败)时,errorMessage 是 Python 报错原文,直接复述给用户。**若返回里带了 reasonCode/action/userAction,那是 MCP 已经从报错原文里认出的根因和改法,按它改再重跑,不要再去翻 SDK 源码猜。** 没带就说明这条报错不在已知清单里,如实转述原文即可。\n\nkind=backtest 返回与 mcp-get-backtest-state 相同的终态结果(status 2 失败/3 取消/4 终止/5 完成;status=5 才能查收益)。若 IPC 报 status=1 或 status=4,而 codePath 下的 result.json 已确认属于当前 attemptFence 且数据准备或策略引擎启动失败,本工具返回 ErrNo 10043,并在 resultJson 原样带回真实错误。\n\nkind=download 返回与 mcp-get-download-progress 相同的结果,按其中 nextAction 行动。除下载中以外的任何状态都会立即返回:resume-required / await-credential / report-stopped 表示任务不会自己结束,需要用户决定。\n\n任一 kind 带 waitStopped=no-progress 表示约 3 分钟未观察到实质进展,先交回现状;不表示任务失败或后台已停止。回测百分比不变但本次引擎事件的模拟时间向前推进时继续等待,返回中的 executionProgress 与 mcp-get-backtest-state 相同;数据准备完成后按策略执行阶段解释。普通日志增长和单独时间戳刷新不算实质进展。可用对应状态工具复查一次,再按返回的 nextAction 处理;不要自动重跑回测或把慢速解释成正常预热。",
|
|
1247
1247
|
"inputSchema": {
|
|
1248
1248
|
"type": "object",
|
|
1249
1249
|
"properties": {
|
|
1250
1250
|
"kind": {
|
|
1251
1251
|
"type": "string",
|
|
1252
1252
|
"enum": [
|
|
1253
|
+
"install",
|
|
1254
|
+
"factor",
|
|
1253
1255
|
"backtest",
|
|
1254
1256
|
"download"
|
|
1255
1257
|
],
|
|
1256
|
-
"description": "任务类别:backtest 回测,download 数据下载。"
|
|
1258
|
+
"description": "任务类别:install runtime 安装,factor 因子计算/检测,backtest 回测,download 数据下载。"
|
|
1257
1259
|
},
|
|
1258
1260
|
"id": {
|
|
1259
1261
|
"type": "string",
|
|
1260
|
-
"description": "任务标识:kind=backtest 传 runId;kind=download 传 uuid(\"0\" 表示本机当前最新下载任务)。"
|
|
1262
|
+
"description": "任务标识:kind=install 传 zlt-runtime-install 返回的 taskId;kind=factor 传 executionId;kind=backtest 传 runId;kind=download 传 uuid(\"0\" 表示本机当前最新下载任务)。"
|
|
1261
1263
|
},
|
|
1262
1264
|
"codePath": {
|
|
1263
1265
|
"type": "string",
|
|
@@ -1306,6 +1308,967 @@
|
|
|
1306
1308
|
"additionalProperties": false
|
|
1307
1309
|
},
|
|
1308
1310
|
"timeoutMs": 15000
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
"name": "mcp-factor-get-category-list",
|
|
1314
|
+
"description": "查询因子分类树。创建因子必须传 categoryId,且只能选 leaf=true 的叶子分类;**本工具是拿到合法 categoryId 的唯一途径,不要凭 categoryName 猜 ID**。默认返回根层级;传 parentId 查某一层的子分类。",
|
|
1315
|
+
"inputSchema": {
|
|
1316
|
+
"type": "object",
|
|
1317
|
+
"properties": {
|
|
1318
|
+
"parentId": {
|
|
1319
|
+
"type": "string",
|
|
1320
|
+
"description": "父分类ID。省略或传空字符串表示查询根层级。"
|
|
1321
|
+
}
|
|
1322
|
+
},
|
|
1323
|
+
"additionalProperties": false
|
|
1324
|
+
},
|
|
1325
|
+
"ipcUri": "/zltaf_slave/v1/factor/category/list",
|
|
1326
|
+
"bodyFromParams": true,
|
|
1327
|
+
"timeoutMs": 15000
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
"name": "mcp-factor-create",
|
|
1331
|
+
"description": "创建本地研发因子并生成源码工作区。返回 Data.workspacePath 就是源码目录,里面已有可直接运行的 main.py 骨架——**这是 ZLTAF 给出的权威路径**,与 mcp-factor-detail 的同名字段不一致时以本工具当次返回的为准。\n\n**先读一遍 main.py 再决定要不要改**:模板已按 factorName 填好 name,dependencies 默认 [\"close\"],calc 对窗口求均值。**但 max_window 不随因子名变化**(factorName=ma20 拿到的是 5),「N 日均线」这类必须自己按语义改窗口;不改不报错,只会得到一个名不副实的因子。计算逻辑不是滚动均值时才重写 calc 和 dependencies。类必须继承 zltquant.zltfactor.Factor,声明 name / max_window / dependencies,实现 calc(self, data),并在模块级导出 get_factor() 返回因子实例;细节见因子文档,不要照记忆重写整个文件。\n\n**calc(self, data) 每次只算一个截面。** data[字段] 是 index=时间(max_window 行)、columns=证券 的 DataFrame,返回值必须是 index=证券 的 Series。骨架里的 close.mean() 正好满足,但换成跨日期的整帧写法(close / close.shift(N)、.rolling()、.diff())返回的就是 DataFrame,计算会一路跑到拉完数据才以 'DataFrame' object has no attribute 'to_frame' 失败。要在窗口上降维:N 日动量写 close.iloc[-1] / close.iloc[0] - 1,并把 max_window 设成 N+1。\n\n**漏掉模块级 get_factor() 不会换来一句「缺少 get_factor」**:加载器会退回去实例化抽象基类 Factor,报 Can't instantiate abstract class,而且要等计算进程起来、数据下完才报出来。改完务必确认它还在(把因子类重新绑定成模块级 Factor 也等效)。\n\ncategoryId 必须来自 mcp-factor-get-category-list 的叶子分类。frequency 与 market 由服务端给默认值(daily / CN_A),要改用 mcp-factor-update。本工具只在 Windows 本地开发端可用,会尝试拉起 VSCode 打开该工作区。",
|
|
1332
|
+
"inputSchema": {
|
|
1333
|
+
"type": "object",
|
|
1334
|
+
"properties": {
|
|
1335
|
+
"factorName": {
|
|
1336
|
+
"type": "string",
|
|
1337
|
+
"description": "源因子名称,也是 main.py 里的类名与 Factor.name。1-20 字符,不能有下划线、空格或中文,同范围不能重名,违反即 500 拒绝。建议英文小写加数字,如 alpha001、mom20。"
|
|
1338
|
+
},
|
|
1339
|
+
"categoryId": {
|
|
1340
|
+
"type": "string",
|
|
1341
|
+
"description": "所属分类ID,必须是 mcp-factor-get-category-list 返回的 leaf=true 叶子分类ID(如 CAT_VOLUME_PRICE)。"
|
|
1342
|
+
},
|
|
1343
|
+
"visibility": {
|
|
1344
|
+
"type": "integer",
|
|
1345
|
+
"enum": [
|
|
1346
|
+
0,
|
|
1347
|
+
1,
|
|
1348
|
+
2
|
|
1349
|
+
],
|
|
1350
|
+
"default": 0,
|
|
1351
|
+
"description": "可见性。0 个人,1 团队,2 公开。默认 0。"
|
|
1352
|
+
},
|
|
1353
|
+
"description": {
|
|
1354
|
+
"type": "string",
|
|
1355
|
+
"description": "因子描述,说明因子的经济含义或计算逻辑。"
|
|
1356
|
+
},
|
|
1357
|
+
"sourceType": {
|
|
1358
|
+
"type": "integer",
|
|
1359
|
+
"enum": [
|
|
1360
|
+
0,
|
|
1361
|
+
1,
|
|
1362
|
+
2,
|
|
1363
|
+
3
|
|
1364
|
+
],
|
|
1365
|
+
"default": 0,
|
|
1366
|
+
"description": "来源,标记这个因子是怎么来的。自己写 calc 逻辑就填 0 自创,绝大多数情况都是它,也是默认值。1 数据转化指直接由外部数据字段换算得到。2 指标转化指从已有技术指标平移过来。3 归因反馈指由归因结果反推。拿不准就省略,不要为了显得具体而挑一个。"
|
|
1367
|
+
},
|
|
1368
|
+
"tagNames": {
|
|
1369
|
+
"type": "array",
|
|
1370
|
+
"items": {
|
|
1371
|
+
"type": "string"
|
|
1372
|
+
},
|
|
1373
|
+
"description": "标签列表,用于在因子列表里检索。"
|
|
1374
|
+
},
|
|
1375
|
+
"authorName": {
|
|
1376
|
+
"type": "string",
|
|
1377
|
+
"description": "作者名,可省略。"
|
|
1378
|
+
}
|
|
1379
|
+
},
|
|
1380
|
+
"required": [
|
|
1381
|
+
"factorName",
|
|
1382
|
+
"categoryId"
|
|
1383
|
+
],
|
|
1384
|
+
"additionalProperties": false
|
|
1385
|
+
},
|
|
1386
|
+
"ipcUri": "/zltaf_slave/v1/factor/local/create",
|
|
1387
|
+
"bodyFromParams": true,
|
|
1388
|
+
"timeoutMs": 60000
|
|
1389
|
+
},
|
|
1390
|
+
{
|
|
1391
|
+
"name": "mcp-factor-list",
|
|
1392
|
+
"description": "分页查询本地研发因子列表,支持关键字、分类、标签、研发状态、发布状态、频率、市场、来源和排序筛选。返回行含 factorId、factorName、categoryName、researchStatus、publishStatus、calculateState.statusText、calculateSuccessTime 等。researchStatus 是研发进度:0 待计算、1 已计算、2 已检测。本工具不返回源码路径,需要源码目录时用 mcp-factor-create 当时返回的 workspacePath。",
|
|
1393
|
+
"inputSchema": {
|
|
1394
|
+
"type": "object",
|
|
1395
|
+
"properties": {
|
|
1396
|
+
"keyword": {
|
|
1397
|
+
"type": "string",
|
|
1398
|
+
"description": "按因子名称模糊搜索。"
|
|
1399
|
+
},
|
|
1400
|
+
"categoryId": {
|
|
1401
|
+
"type": "string",
|
|
1402
|
+
"description": "按分类过滤,取值来自 mcp-factor-get-category-list。"
|
|
1403
|
+
},
|
|
1404
|
+
"tagNames": {
|
|
1405
|
+
"type": "array",
|
|
1406
|
+
"items": {
|
|
1407
|
+
"type": "string"
|
|
1408
|
+
},
|
|
1409
|
+
"description": "按标签过滤。"
|
|
1410
|
+
},
|
|
1411
|
+
"researchStatus": {
|
|
1412
|
+
"type": "integer",
|
|
1413
|
+
"enum": [
|
|
1414
|
+
0,
|
|
1415
|
+
1,
|
|
1416
|
+
2
|
|
1417
|
+
],
|
|
1418
|
+
"description": "研发状态。0 待计算,1 已计算,2 已检测。"
|
|
1419
|
+
},
|
|
1420
|
+
"publishStatus": {
|
|
1421
|
+
"type": "integer",
|
|
1422
|
+
"description": "发布状态过滤。本工具集不覆盖发布链路,一般无需传入。"
|
|
1423
|
+
},
|
|
1424
|
+
"visibility": {
|
|
1425
|
+
"type": "integer",
|
|
1426
|
+
"enum": [
|
|
1427
|
+
0,
|
|
1428
|
+
1,
|
|
1429
|
+
2
|
|
1430
|
+
],
|
|
1431
|
+
"description": "可见性过滤。0 个人,1 团队,2 公开。"
|
|
1432
|
+
},
|
|
1433
|
+
"frequency": {
|
|
1434
|
+
"type": "string",
|
|
1435
|
+
"enum": [
|
|
1436
|
+
"daily",
|
|
1437
|
+
"weekly",
|
|
1438
|
+
"monthly",
|
|
1439
|
+
"minute",
|
|
1440
|
+
"tick"
|
|
1441
|
+
],
|
|
1442
|
+
"description": "按因子频率过滤。"
|
|
1443
|
+
},
|
|
1444
|
+
"market": {
|
|
1445
|
+
"type": "string",
|
|
1446
|
+
"enum": [
|
|
1447
|
+
"CN_A",
|
|
1448
|
+
"HK",
|
|
1449
|
+
"US",
|
|
1450
|
+
"FUTURES",
|
|
1451
|
+
"MULTI"
|
|
1452
|
+
],
|
|
1453
|
+
"description": "按市场过滤。CN_A A股,HK 港股,US 美股,FUTURES 期货,MULTI 多市场。"
|
|
1454
|
+
},
|
|
1455
|
+
"sourceType": {
|
|
1456
|
+
"type": "integer",
|
|
1457
|
+
"enum": [
|
|
1458
|
+
0,
|
|
1459
|
+
1,
|
|
1460
|
+
2,
|
|
1461
|
+
3
|
|
1462
|
+
],
|
|
1463
|
+
"description": "按来源过滤。0 自创,1 数据转化,2 指标转化,3 归因反馈。"
|
|
1464
|
+
},
|
|
1465
|
+
"deletedStatus": {
|
|
1466
|
+
"type": "integer",
|
|
1467
|
+
"default": 0,
|
|
1468
|
+
"description": "是否包含已删除因子。0 只看未删除,默认 0。"
|
|
1469
|
+
},
|
|
1470
|
+
"sortBy": {
|
|
1471
|
+
"type": "string",
|
|
1472
|
+
"default": "updateTime",
|
|
1473
|
+
"description": "排序字段,默认 updateTime。"
|
|
1474
|
+
},
|
|
1475
|
+
"sortDirection": {
|
|
1476
|
+
"type": "string",
|
|
1477
|
+
"enum": [
|
|
1478
|
+
"asc",
|
|
1479
|
+
"desc"
|
|
1480
|
+
],
|
|
1481
|
+
"default": "desc",
|
|
1482
|
+
"description": "排序方向,默认 desc。"
|
|
1483
|
+
},
|
|
1484
|
+
"pageNum": {
|
|
1485
|
+
"type": "integer",
|
|
1486
|
+
"default": 1,
|
|
1487
|
+
"description": "页码,默认 1。"
|
|
1488
|
+
},
|
|
1489
|
+
"pageSize": {
|
|
1490
|
+
"type": "integer",
|
|
1491
|
+
"default": 20,
|
|
1492
|
+
"description": "每页数量,默认 20。"
|
|
1493
|
+
}
|
|
1494
|
+
},
|
|
1495
|
+
"additionalProperties": false
|
|
1496
|
+
},
|
|
1497
|
+
"ipcUri": "/zltaf_slave/v1/factor/local/list",
|
|
1498
|
+
"bodyFromParams": true,
|
|
1499
|
+
"timeoutMs": 15000
|
|
1500
|
+
},
|
|
1501
|
+
{
|
|
1502
|
+
"name": "mcp-factor-detail",
|
|
1503
|
+
"description": "查询单个因子的元信息、最新计算记录、最新检测记录和发布/生产摘要。返回的 sourceDirty=1 表示源码相对上一次快照有改动(sourceDirtyReason 说明原因,如 no_valid_snapshot 表示还没算过),此时应先跑一次计算再做检测。上游本身不返回源码路径,MCP 会按安装根补出 Data.workspacePath 方便直接编辑 main.py。latestCalculate 为 null 表示该因子从未计算过。",
|
|
1504
|
+
"inputSchema": {
|
|
1505
|
+
"type": "object",
|
|
1506
|
+
"properties": {
|
|
1507
|
+
"factorId": {
|
|
1508
|
+
"type": "string",
|
|
1509
|
+
"description": "因子ID,来自 mcp-factor-create 或 mcp-factor-list。"
|
|
1510
|
+
}
|
|
1511
|
+
},
|
|
1512
|
+
"required": [
|
|
1513
|
+
"factorId"
|
|
1514
|
+
],
|
|
1515
|
+
"additionalProperties": false
|
|
1516
|
+
},
|
|
1517
|
+
"ipcUri": "/zltaf_slave/v1/factor/local/detail",
|
|
1518
|
+
"bodyFromParams": true,
|
|
1519
|
+
"timeoutMs": 15000
|
|
1520
|
+
},
|
|
1521
|
+
{
|
|
1522
|
+
"name": "mcp-factor-update",
|
|
1523
|
+
"description": "更新因子元信息:名称、分类、描述、可见性、频率、市场、来源和标签。关键字段变化会把因子标记为 sourceDirty,需要重新计算。本工具不改源码——改因子逻辑请直接编辑 workspacePath 下的 main.py。",
|
|
1524
|
+
"inputSchema": {
|
|
1525
|
+
"type": "object",
|
|
1526
|
+
"properties": {
|
|
1527
|
+
"factorId": {
|
|
1528
|
+
"type": "string",
|
|
1529
|
+
"description": "因子ID,必送。"
|
|
1530
|
+
},
|
|
1531
|
+
"factorName": {
|
|
1532
|
+
"type": "string",
|
|
1533
|
+
"description": "新的因子名称。改名不会自动改写 main.py 里的类名与 Factor.name,需要一并手工调整。"
|
|
1534
|
+
},
|
|
1535
|
+
"categoryId": {
|
|
1536
|
+
"type": "string",
|
|
1537
|
+
"description": "新的分类ID,必须是叶子分类。"
|
|
1538
|
+
},
|
|
1539
|
+
"description": {
|
|
1540
|
+
"type": "string",
|
|
1541
|
+
"description": "新的因子描述。"
|
|
1542
|
+
},
|
|
1543
|
+
"visibility": {
|
|
1544
|
+
"type": "integer",
|
|
1545
|
+
"enum": [
|
|
1546
|
+
0,
|
|
1547
|
+
1,
|
|
1548
|
+
2
|
|
1549
|
+
],
|
|
1550
|
+
"description": "可见性。0 个人,1 团队,2 公开。"
|
|
1551
|
+
},
|
|
1552
|
+
"frequency": {
|
|
1553
|
+
"type": "string",
|
|
1554
|
+
"enum": [
|
|
1555
|
+
"daily",
|
|
1556
|
+
"weekly",
|
|
1557
|
+
"monthly",
|
|
1558
|
+
"minute",
|
|
1559
|
+
"tick"
|
|
1560
|
+
],
|
|
1561
|
+
"description": "因子频率。创建时服务端默认 daily。"
|
|
1562
|
+
},
|
|
1563
|
+
"market": {
|
|
1564
|
+
"type": "string",
|
|
1565
|
+
"enum": [
|
|
1566
|
+
"CN_A",
|
|
1567
|
+
"HK",
|
|
1568
|
+
"US",
|
|
1569
|
+
"FUTURES",
|
|
1570
|
+
"MULTI"
|
|
1571
|
+
],
|
|
1572
|
+
"description": "因子适用市场。创建时服务端默认 CN_A;期货因子应改为 FUTURES,跨市场用 MULTI。"
|
|
1573
|
+
},
|
|
1574
|
+
"sourceType": {
|
|
1575
|
+
"type": "integer",
|
|
1576
|
+
"enum": [
|
|
1577
|
+
0,
|
|
1578
|
+
1,
|
|
1579
|
+
2,
|
|
1580
|
+
3
|
|
1581
|
+
],
|
|
1582
|
+
"description": "来源。0 自创,1 数据转化,2 指标转化,3 归因反馈。"
|
|
1583
|
+
},
|
|
1584
|
+
"tagNames": {
|
|
1585
|
+
"type": "array",
|
|
1586
|
+
"items": {
|
|
1587
|
+
"type": "string"
|
|
1588
|
+
},
|
|
1589
|
+
"description": "标签列表,整体覆盖旧值。"
|
|
1590
|
+
}
|
|
1591
|
+
},
|
|
1592
|
+
"required": [
|
|
1593
|
+
"factorId"
|
|
1594
|
+
],
|
|
1595
|
+
"additionalProperties": false
|
|
1596
|
+
},
|
|
1597
|
+
"ipcUri": "/zltaf_slave/v1/factor/local/update",
|
|
1598
|
+
"bodyFromParams": true,
|
|
1599
|
+
"timeoutMs": 30000
|
|
1600
|
+
},
|
|
1601
|
+
{
|
|
1602
|
+
"name": "mcp-factor-open-editor",
|
|
1603
|
+
"description": "在 VSCode 中打开因子源码工作区,供用户手工查看或编辑 main.py。这是一个宿主端动作,返回值不含源码内容;agent 需要读写源码时应直接对 workspacePath 下的 main.py 做文件操作,而不是调用本工具。",
|
|
1604
|
+
"inputSchema": {
|
|
1605
|
+
"type": "object",
|
|
1606
|
+
"properties": {
|
|
1607
|
+
"factorId": {
|
|
1608
|
+
"type": "string",
|
|
1609
|
+
"description": "因子ID,必送。"
|
|
1610
|
+
}
|
|
1611
|
+
},
|
|
1612
|
+
"required": [
|
|
1613
|
+
"factorId"
|
|
1614
|
+
],
|
|
1615
|
+
"additionalProperties": false
|
|
1616
|
+
},
|
|
1617
|
+
"ipcUri": "/zltaf_slave/v1/factor/local/open-editor",
|
|
1618
|
+
"bodyFromParams": true,
|
|
1619
|
+
"timeoutMs": 30000
|
|
1620
|
+
},
|
|
1621
|
+
{
|
|
1622
|
+
"name": "mcp-factor-calculate-start",
|
|
1623
|
+
"description": "启动因子全量计算。异步任务:立刻返回 executionId、calculateRecordId、snapshotId 和 status=1,真正的计算在独立 Python 进程里跑。**返回 executionId 后立即调用 mcp-wait(kind=factor,id=executionId)阻塞等待完成,不要用 mcp-factor-task-status 轮询。**\n\n**有一种返回不带 executionId**:请求区间已被该因子算过时服务端不新建任务,直接返回 skipped=true、triggerReason=FULL_RANGE_COVERED、status=2 和已有的 calculateRecordId——沿用那条记录即可,别去等一个空的 executionId,也别当成失败。\n\n启动前会先读一遍 main.py 确认存在模块级 get_factor(),不满足直接以 ErrNo 10045 拒绝并说明怎么补;按提示改 main.py 再发起一次,不要去动 calc()。计算前先用 mcp-get-data-range 查覆盖、缺了用 mcp-download-data 补,否则计算会成功返回但产出为空。覆盖通过后引擎仍可能自行补下数据,这段时间等待会相应变长、progress 保持 0 都属正常,mcp-wait 会一直等到计算真正结束;用户主动问进度时可以单次调用 mcp-factor-task-status(它会带上 dataPrep 的 phase/percent/files,据实转述「在等数据下载」,别报成卡死),但不要循环轮询。\n\n**已有产出的因子不能换区间,只能新建因子。** 起始日早于已有历史即失败(「写入数据需与历史保持连续」),**首尾相接也不行**。失败会清空该因子已有产出,且连续性 metadata 不重置——之后连全量重算都被同一条校验拒掉,等于把因子废掉,不可逆。绝不试探性地跑;区间拿不准先问用户。\n\n结果写入 MDF/EDMS,产出路径见返回的 outputPath。stockPool 决定标的范围,支持期货(futures)。",
|
|
1624
|
+
"inputSchema": {
|
|
1625
|
+
"type": "object",
|
|
1626
|
+
"properties": {
|
|
1627
|
+
"factorId": {
|
|
1628
|
+
"type": "string",
|
|
1629
|
+
"description": "因子ID,必送。"
|
|
1630
|
+
},
|
|
1631
|
+
"storageScope": {
|
|
1632
|
+
"type": "string",
|
|
1633
|
+
"enum": [
|
|
1634
|
+
"research",
|
|
1635
|
+
"production"
|
|
1636
|
+
],
|
|
1637
|
+
"default": "research",
|
|
1638
|
+
"description": "存储域。research 研发,production 生产。本工具集面向研发,保持默认 research;production 走生产约束,需要生产主因子已存在。"
|
|
1639
|
+
},
|
|
1640
|
+
"computeMode": {
|
|
1641
|
+
"type": "integer",
|
|
1642
|
+
"enum": [
|
|
1643
|
+
1,
|
|
1644
|
+
2
|
|
1645
|
+
],
|
|
1646
|
+
"default": 1,
|
|
1647
|
+
"description": "计算模式。1 全量,2 增量。默认 1。想做增量请直接用 mcp-factor-calculate-incremental-start。"
|
|
1648
|
+
},
|
|
1649
|
+
"stockPool": {
|
|
1650
|
+
"type": "array",
|
|
1651
|
+
"default": [
|
|
1652
|
+
"hs"
|
|
1653
|
+
],
|
|
1654
|
+
"description": "标的范围,可多选,服务端按逗号拼成 calc_range。三种形式可以混用:板块(hs/sh/sz/conbond/exchange_fund/futures)、指数代码(如 sh000300 沪深300)、申万一级行业(如 sw_l1:801010)。默认 [\"hs\"] 沪深全市场。取值与 SDK 的 zltpyscript/security_range.py 校验一致,传别的会被直接拒绝。",
|
|
1655
|
+
"items": {
|
|
1656
|
+
"anyOf": [
|
|
1657
|
+
{
|
|
1658
|
+
"type": "string",
|
|
1659
|
+
"enum": [
|
|
1660
|
+
"hs",
|
|
1661
|
+
"sh",
|
|
1662
|
+
"sz",
|
|
1663
|
+
"conbond",
|
|
1664
|
+
"exchange_fund",
|
|
1665
|
+
"futures"
|
|
1666
|
+
],
|
|
1667
|
+
"description": "板块范围:hs 沪深全市场、sh 沪市、sz 深市、conbond 可转债、exchange_fund 场内基金(ETF/LOF/REITs)、futures 期货。"
|
|
1668
|
+
},
|
|
1669
|
+
{
|
|
1670
|
+
"type": "string",
|
|
1671
|
+
"pattern": "^(sh|sz)\\d{6}$",
|
|
1672
|
+
"description": "指数成分股,用指数代码,如 sh000300 沪深300、sh000905 中证500、sh000852 中证1000、sh000016 上证50、sz399006 创业板指。"
|
|
1673
|
+
},
|
|
1674
|
+
{
|
|
1675
|
+
"type": "string",
|
|
1676
|
+
"pattern": "^sw_l1:\\d{1,10}$",
|
|
1677
|
+
"description": "申万一级行业成分股,形如 sw_l1:801010。"
|
|
1678
|
+
}
|
|
1679
|
+
]
|
|
1680
|
+
}
|
|
1681
|
+
},
|
|
1682
|
+
"startDate": {
|
|
1683
|
+
"type": "string",
|
|
1684
|
+
"format": "date",
|
|
1685
|
+
"description": "计算开始日期,格式 YYYY-MM-DD,必送。实际取数会按因子的 max_window 自动往前多取若干交易日做预热。"
|
|
1686
|
+
},
|
|
1687
|
+
"endDate": {
|
|
1688
|
+
"type": "string",
|
|
1689
|
+
"format": "date",
|
|
1690
|
+
"description": "计算结束日期,格式 YYYY-MM-DD,必送。"
|
|
1691
|
+
},
|
|
1692
|
+
"paramsJson": {
|
|
1693
|
+
"type": "string",
|
|
1694
|
+
"description": "计算参数,JSON 字符串(注意是字符串,不是对象)。一般可省略,由服务端补默认值。"
|
|
1695
|
+
},
|
|
1696
|
+
"inputCalculateRecordId": {
|
|
1697
|
+
"type": "string",
|
|
1698
|
+
"description": "基线计算记录ID,仅在按已有记录派生时传入,通常省略。"
|
|
1699
|
+
}
|
|
1700
|
+
},
|
|
1701
|
+
"required": [
|
|
1702
|
+
"factorId",
|
|
1703
|
+
"startDate",
|
|
1704
|
+
"endDate"
|
|
1705
|
+
],
|
|
1706
|
+
"additionalProperties": false
|
|
1707
|
+
},
|
|
1708
|
+
"ipcUri": "/zltaf_slave/v1/factor/calculate/start",
|
|
1709
|
+
"bodyFromParams": true,
|
|
1710
|
+
"timeoutMs": 30000
|
|
1711
|
+
},
|
|
1712
|
+
{
|
|
1713
|
+
"name": "mcp-factor-calculate-incremental-start",
|
|
1714
|
+
"description": "启动因子增量计算,由服务端按最近一次成功计算记录自动推导要补算的区间,因此不需要传日期。研发增量要求已有成功基线(没有基线会报错,此时改用 mcp-factor-calculate-start 先做一次全量)。同样是异步任务,返回 executionId 后立即调用 mcp-wait 阻塞等待完成;不要用 mcp-factor-task-status 轮询。",
|
|
1715
|
+
"inputSchema": {
|
|
1716
|
+
"type": "object",
|
|
1717
|
+
"properties": {
|
|
1718
|
+
"factorId": {
|
|
1719
|
+
"type": "string",
|
|
1720
|
+
"description": "因子ID,必送。"
|
|
1721
|
+
},
|
|
1722
|
+
"storageScope": {
|
|
1723
|
+
"type": "string",
|
|
1724
|
+
"enum": [
|
|
1725
|
+
"research",
|
|
1726
|
+
"production"
|
|
1727
|
+
],
|
|
1728
|
+
"default": "research",
|
|
1729
|
+
"description": "存储域,默认 research。"
|
|
1730
|
+
},
|
|
1731
|
+
"stockPool": {
|
|
1732
|
+
"type": "array",
|
|
1733
|
+
"description": "标的范围,取值同 mcp-factor-calculate-start;省略时沿用基线记录的范围。",
|
|
1734
|
+
"items": {
|
|
1735
|
+
"anyOf": [
|
|
1736
|
+
{
|
|
1737
|
+
"type": "string",
|
|
1738
|
+
"enum": [
|
|
1739
|
+
"hs",
|
|
1740
|
+
"sh",
|
|
1741
|
+
"sz",
|
|
1742
|
+
"conbond",
|
|
1743
|
+
"exchange_fund",
|
|
1744
|
+
"futures"
|
|
1745
|
+
],
|
|
1746
|
+
"description": "板块范围:hs 沪深全市场、sh 沪市、sz 深市、conbond 可转债、exchange_fund 场内基金(ETF/LOF/REITs)、futures 期货。"
|
|
1747
|
+
},
|
|
1748
|
+
{
|
|
1749
|
+
"type": "string",
|
|
1750
|
+
"pattern": "^(sh|sz)\\d{6}$",
|
|
1751
|
+
"description": "指数成分股,用指数代码,如 sh000300 沪深300、sh000905 中证500、sh000852 中证1000、sh000016 上证50、sz399006 创业板指。"
|
|
1752
|
+
},
|
|
1753
|
+
{
|
|
1754
|
+
"type": "string",
|
|
1755
|
+
"pattern": "^sw_l1:\\d{1,10}$",
|
|
1756
|
+
"description": "申万一级行业成分股,形如 sw_l1:801010。"
|
|
1757
|
+
}
|
|
1758
|
+
]
|
|
1759
|
+
}
|
|
1760
|
+
},
|
|
1761
|
+
"paramsJson": {
|
|
1762
|
+
"type": "string",
|
|
1763
|
+
"description": "计算参数,JSON 字符串。一般省略。"
|
|
1764
|
+
}
|
|
1765
|
+
},
|
|
1766
|
+
"required": [
|
|
1767
|
+
"factorId"
|
|
1768
|
+
],
|
|
1769
|
+
"additionalProperties": false
|
|
1770
|
+
},
|
|
1771
|
+
"ipcUri": "/zltaf_slave/v1/factor/calculate/incremental-start",
|
|
1772
|
+
"bodyFromParams": true,
|
|
1773
|
+
"timeoutMs": 30000
|
|
1774
|
+
},
|
|
1775
|
+
{
|
|
1776
|
+
"name": "mcp-factor-calculate-stop",
|
|
1777
|
+
"description": "停止一次正在运行的因子计算。按 calculateRecordId、executionId 或 detectRecordId 之一定位要停的执行,三者至少给一个。这是取消运行中的任务,不删除已产出的数据,也不删除因子本身。",
|
|
1778
|
+
"inputSchema": {
|
|
1779
|
+
"type": "object",
|
|
1780
|
+
"properties": {
|
|
1781
|
+
"calculateRecordId": {
|
|
1782
|
+
"type": "string",
|
|
1783
|
+
"description": "计算记录ID。"
|
|
1784
|
+
},
|
|
1785
|
+
"executionId": {
|
|
1786
|
+
"type": "string",
|
|
1787
|
+
"description": "任务执行ID。"
|
|
1788
|
+
},
|
|
1789
|
+
"detectRecordId": {
|
|
1790
|
+
"type": "string",
|
|
1791
|
+
"description": "检测记录ID。"
|
|
1792
|
+
},
|
|
1793
|
+
"reason": {
|
|
1794
|
+
"type": "string",
|
|
1795
|
+
"default": "用户取消",
|
|
1796
|
+
"description": "停止原因,默认「用户取消」。"
|
|
1797
|
+
}
|
|
1798
|
+
},
|
|
1799
|
+
"additionalProperties": false
|
|
1800
|
+
},
|
|
1801
|
+
"ipcUri": "/zltaf_slave/v1/factor/calculate/stop",
|
|
1802
|
+
"bodyFromParams": true,
|
|
1803
|
+
"timeoutMs": 30000
|
|
1804
|
+
},
|
|
1805
|
+
{
|
|
1806
|
+
"name": "mcp-factor-calculate-history",
|
|
1807
|
+
"description": "分页查询因子计算历史。status 是执行状态:0 初始/空闲、1 运行中、2 成功、3 失败、4 取消、5 跳过。用于回看某个因子算过几次、哪次成功、产出在哪。",
|
|
1808
|
+
"inputSchema": {
|
|
1809
|
+
"type": "object",
|
|
1810
|
+
"properties": {
|
|
1811
|
+
"factorId": {
|
|
1812
|
+
"type": "string",
|
|
1813
|
+
"description": "因子ID。省略则跨因子查询。"
|
|
1814
|
+
},
|
|
1815
|
+
"storageScope": {
|
|
1816
|
+
"type": "string",
|
|
1817
|
+
"enum": [
|
|
1818
|
+
"research",
|
|
1819
|
+
"production"
|
|
1820
|
+
],
|
|
1821
|
+
"description": "存储域过滤。"
|
|
1822
|
+
},
|
|
1823
|
+
"status": {
|
|
1824
|
+
"type": "integer",
|
|
1825
|
+
"enum": [
|
|
1826
|
+
0,
|
|
1827
|
+
1,
|
|
1828
|
+
2,
|
|
1829
|
+
3,
|
|
1830
|
+
4,
|
|
1831
|
+
5
|
|
1832
|
+
],
|
|
1833
|
+
"description": "状态过滤。0 初始/空闲,1 运行中,2 成功,3 失败,4 取消,5 跳过。"
|
|
1834
|
+
},
|
|
1835
|
+
"pageNum": {
|
|
1836
|
+
"type": "integer",
|
|
1837
|
+
"default": 1,
|
|
1838
|
+
"description": "页码,默认 1。"
|
|
1839
|
+
},
|
|
1840
|
+
"pageSize": {
|
|
1841
|
+
"type": "integer",
|
|
1842
|
+
"default": 20,
|
|
1843
|
+
"description": "每页数量,默认 20。"
|
|
1844
|
+
}
|
|
1845
|
+
},
|
|
1846
|
+
"additionalProperties": false
|
|
1847
|
+
},
|
|
1848
|
+
"ipcUri": "/zltaf_slave/v1/factor/calculate/history",
|
|
1849
|
+
"bodyFromParams": true,
|
|
1850
|
+
"timeoutMs": 15000
|
|
1851
|
+
},
|
|
1852
|
+
{
|
|
1853
|
+
"name": "mcp-factor-calculate-latest-success",
|
|
1854
|
+
"description": "查询某因子最近一次成功的计算记录。做检测(mcp-factor-detect-start)需要一个成功的 calculateRecordId 和 snapshotId,本工具是拿到它们最直接的方式,不必翻计算历史。返回空表示该因子还没有成功算过。",
|
|
1855
|
+
"inputSchema": {
|
|
1856
|
+
"type": "object",
|
|
1857
|
+
"properties": {
|
|
1858
|
+
"factorId": {
|
|
1859
|
+
"type": "string",
|
|
1860
|
+
"description": "因子ID,必送。"
|
|
1861
|
+
},
|
|
1862
|
+
"storageScope": {
|
|
1863
|
+
"type": "string",
|
|
1864
|
+
"enum": [
|
|
1865
|
+
"research",
|
|
1866
|
+
"production"
|
|
1867
|
+
],
|
|
1868
|
+
"default": "research",
|
|
1869
|
+
"description": "存储域,默认 research。"
|
|
1870
|
+
}
|
|
1871
|
+
},
|
|
1872
|
+
"required": [
|
|
1873
|
+
"factorId"
|
|
1874
|
+
],
|
|
1875
|
+
"additionalProperties": false
|
|
1876
|
+
},
|
|
1877
|
+
"ipcUri": "/zltaf_slave/v1/factor/calculate/latest-success",
|
|
1878
|
+
"bodyFromParams": true,
|
|
1879
|
+
"timeoutMs": 15000
|
|
1880
|
+
},
|
|
1881
|
+
{
|
|
1882
|
+
"name": "mcp-factor-calculate-detail",
|
|
1883
|
+
"description": "查询单条计算记录的详情与产物元信息,含 startDate/endDate、computeMode、outputPath、status 和 errorMessage。计算失败时(status=3)应读 errorMessage 向用户复述失败原因,不要笼统说「计算失败」。注意 totalRowCount 可能为 0 而计算实际成功——旧版 Python 因子结果直接写 MDF/EDMS,行数不回填到该字段,产物是否存在以 mcp-factor-value-query 返回的 exists/fileCount 为准。",
|
|
1884
|
+
"inputSchema": {
|
|
1885
|
+
"type": "object",
|
|
1886
|
+
"properties": {
|
|
1887
|
+
"calculateRecordId": {
|
|
1888
|
+
"type": "string",
|
|
1889
|
+
"description": "计算记录ID,来自 mcp-factor-calculate-start 或 mcp-factor-calculate-history。"
|
|
1890
|
+
}
|
|
1891
|
+
},
|
|
1892
|
+
"required": [
|
|
1893
|
+
"calculateRecordId"
|
|
1894
|
+
],
|
|
1895
|
+
"additionalProperties": false
|
|
1896
|
+
},
|
|
1897
|
+
"ipcUri": "/zltaf_slave/v1/factor/calculate/detail",
|
|
1898
|
+
"bodyFromParams": true,
|
|
1899
|
+
"timeoutMs": 15000
|
|
1900
|
+
},
|
|
1901
|
+
{
|
|
1902
|
+
"name": "mcp-factor-value-query",
|
|
1903
|
+
"description": "查询因子值。**rows 有内容就是真实截面**(一次一个交易日,日频研发因子由代理从 EDMS 读回),verdict=values-returned,随行返回 tradeDate/total/truncated。verdict=artifact-only 表示产出在(见 Data.artifact 的 fileCount/totalBytes)但这次读不出明细(分钟频、生产域等),要如实说是读取限制,**绝不能说「因子没算出结果」**;empty 才是真没产物。\n\n不传日期返回最近一个有数据的交易日——注意计算记录的 endDate 只是请求区间,收盘前跑的计算当天可能没数据。换一天传 tradeDate,行数用 limit 截断(默认 100)。calculateRecordId 有就传;只传 factorId 时代理自动取研发域最近一次成功记录并标 calculateRecordSource=latest-success,此时要说明查的是最近一次成功计算;没有成功记录报 ErrNo 10055。要在策略逻辑里用因子值仍然用 get_factor,参数见 readWith。",
|
|
1904
|
+
"inputSchema": {
|
|
1905
|
+
"type": "object",
|
|
1906
|
+
"properties": {
|
|
1907
|
+
"factorId": {
|
|
1908
|
+
"type": "string",
|
|
1909
|
+
"description": "因子ID。"
|
|
1910
|
+
},
|
|
1911
|
+
"calculateRecordId": {
|
|
1912
|
+
"type": "string",
|
|
1913
|
+
"description": "计算记录ID,来自 mcp-factor-calculate-start / mcp-wait 的返回,或 mcp-factor-calculate-latest-success。与 factorId 至少给一个:省略时代理按 factorId 自动补该因子最近一次成功的记录。"
|
|
1914
|
+
},
|
|
1915
|
+
"tradeDate": {
|
|
1916
|
+
"type": "string",
|
|
1917
|
+
"format": "date",
|
|
1918
|
+
"description": "只取某一个交易日的截面,格式 YYYY-MM-DD。"
|
|
1919
|
+
},
|
|
1920
|
+
"startDate": {
|
|
1921
|
+
"type": "string",
|
|
1922
|
+
"format": "date",
|
|
1923
|
+
"description": "起始日期,格式 YYYY-MM-DD。"
|
|
1924
|
+
},
|
|
1925
|
+
"endDate": {
|
|
1926
|
+
"type": "string",
|
|
1927
|
+
"format": "date",
|
|
1928
|
+
"description": "结束日期,格式 YYYY-MM-DD。"
|
|
1929
|
+
},
|
|
1930
|
+
"stockCodes": {
|
|
1931
|
+
"type": "array",
|
|
1932
|
+
"items": {
|
|
1933
|
+
"type": "string"
|
|
1934
|
+
},
|
|
1935
|
+
"description": "只取指定标的,如 [\"sh600000\",\"sz000001\"]。"
|
|
1936
|
+
},
|
|
1937
|
+
"limit": {
|
|
1938
|
+
"type": "integer",
|
|
1939
|
+
"default": 100,
|
|
1940
|
+
"description": "返回条数上限,默认 100。"
|
|
1941
|
+
}
|
|
1942
|
+
},
|
|
1943
|
+
"additionalProperties": false
|
|
1944
|
+
},
|
|
1945
|
+
"ipcUri": "/zltaf_slave/v1/factor/calculate/value-query",
|
|
1946
|
+
"bodyFromParams": true,
|
|
1947
|
+
"responseTransform": "factorValues",
|
|
1948
|
+
"timeoutMs": 30000
|
|
1949
|
+
},
|
|
1950
|
+
{
|
|
1951
|
+
"name": "mcp-factor-detect-start",
|
|
1952
|
+
"description": "对一次成功的因子计算启动 Alphalens/Empyrical 检测,产出 IC、IC IR、分层收益、换手率等评价指标。需要成功计算记录的 calculateRecordId 与 snapshotId,用 mcp-factor-calculate-latest-success 获取。异步任务:返回 executionId 后立即调用 mcp-wait 阻塞等待完成;不要用 mcp-factor-task-status 轮询。也可用 mcp-factor-detect-detail 按 detectRecordId 查询终态,再读 icMean/icIr/reportJson。检测区间太短(只有几个交易日)时 IC 统计没有意义,应提醒用户拉长区间。",
|
|
1953
|
+
"inputSchema": {
|
|
1954
|
+
"type": "object",
|
|
1955
|
+
"properties": {
|
|
1956
|
+
"factorId": {
|
|
1957
|
+
"type": "string",
|
|
1958
|
+
"description": "因子ID,必送。"
|
|
1959
|
+
},
|
|
1960
|
+
"calculateRecordId": {
|
|
1961
|
+
"type": "string",
|
|
1962
|
+
"description": "成功计算记录ID,必送。"
|
|
1963
|
+
},
|
|
1964
|
+
"snapshotId": {
|
|
1965
|
+
"type": "string",
|
|
1966
|
+
"description": "源码快照ID,与计算记录配套,来自 mcp-factor-calculate-latest-success。"
|
|
1967
|
+
},
|
|
1968
|
+
"stockPool": {
|
|
1969
|
+
"type": "array",
|
|
1970
|
+
"description": "检测标的范围,取值同 mcp-factor-calculate-start,通常与计算时保持一致。",
|
|
1971
|
+
"items": {
|
|
1972
|
+
"anyOf": [
|
|
1973
|
+
{
|
|
1974
|
+
"type": "string",
|
|
1975
|
+
"enum": [
|
|
1976
|
+
"hs",
|
|
1977
|
+
"sh",
|
|
1978
|
+
"sz",
|
|
1979
|
+
"conbond",
|
|
1980
|
+
"exchange_fund",
|
|
1981
|
+
"futures"
|
|
1982
|
+
],
|
|
1983
|
+
"description": "板块范围:hs 沪深全市场、sh 沪市、sz 深市、conbond 可转债、exchange_fund 场内基金(ETF/LOF/REITs)、futures 期货。"
|
|
1984
|
+
},
|
|
1985
|
+
{
|
|
1986
|
+
"type": "string",
|
|
1987
|
+
"pattern": "^(sh|sz)\\d{6}$",
|
|
1988
|
+
"description": "指数成分股,用指数代码,如 sh000300 沪深300、sh000905 中证500、sh000852 中证1000、sh000016 上证50、sz399006 创业板指。"
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
"type": "string",
|
|
1992
|
+
"pattern": "^sw_l1:\\d{1,10}$",
|
|
1993
|
+
"description": "申万一级行业成分股,形如 sw_l1:801010。"
|
|
1994
|
+
}
|
|
1995
|
+
]
|
|
1996
|
+
}
|
|
1997
|
+
},
|
|
1998
|
+
"benchmark": {
|
|
1999
|
+
"type": "string",
|
|
2000
|
+
"description": "基准代码,如 sh000300 沪深300。省略时由服务端取默认基准。"
|
|
2001
|
+
},
|
|
2002
|
+
"startDate": {
|
|
2003
|
+
"type": "string",
|
|
2004
|
+
"format": "date",
|
|
2005
|
+
"description": "检测开始日期,格式 YYYY-MM-DD。省略时沿用计算区间。"
|
|
2006
|
+
},
|
|
2007
|
+
"endDate": {
|
|
2008
|
+
"type": "string",
|
|
2009
|
+
"format": "date",
|
|
2010
|
+
"description": "检测结束日期,格式 YYYY-MM-DD。省略时沿用计算区间。"
|
|
2011
|
+
},
|
|
2012
|
+
"paramsJson": {
|
|
2013
|
+
"type": "string",
|
|
2014
|
+
"description": "检测参数,JSON 字符串(是字符串,不是对象)。省略时服务端使用默认值,实测默认为 factorDirection=positive、icMethod=spearman、periods=[1,5,10]、quantiles=5、maxLoss=0.35、demeaned=true、longShort=true、neutralize=none、priceField=close,并做 winsorize(mad,3) + center(mean) + standardize(zscore) 预处理。只在用户明确要求改评价口径时传入。"
|
|
2015
|
+
},
|
|
2016
|
+
"applyId": {
|
|
2017
|
+
"type": "string",
|
|
2018
|
+
"description": "发布申请ID,仅发布复检场景使用,研发检测省略。"
|
|
2019
|
+
}
|
|
2020
|
+
},
|
|
2021
|
+
"required": [
|
|
2022
|
+
"factorId",
|
|
2023
|
+
"calculateRecordId"
|
|
2024
|
+
],
|
|
2025
|
+
"additionalProperties": false
|
|
2026
|
+
},
|
|
2027
|
+
"ipcUri": "/zltaf_slave/v1/factor/detect/start",
|
|
2028
|
+
"bodyFromParams": true,
|
|
2029
|
+
"timeoutMs": 30000
|
|
2030
|
+
},
|
|
2031
|
+
{
|
|
2032
|
+
"name": "mcp-factor-detect-history",
|
|
2033
|
+
"description": "分页查询检测历史,含研发检测、生产跟踪检测和发布复检。evalScene 区分场景,研发检测一般不必传。返回行含 detectRecordId、status、icMean、icIr 等,用于对比同一因子多次检测的效果变化。",
|
|
2034
|
+
"inputSchema": {
|
|
2035
|
+
"type": "object",
|
|
2036
|
+
"properties": {
|
|
2037
|
+
"factorId": {
|
|
2038
|
+
"type": "string",
|
|
2039
|
+
"description": "因子ID。省略则跨因子查询。"
|
|
2040
|
+
},
|
|
2041
|
+
"evalScene": {
|
|
2042
|
+
"type": "integer",
|
|
2043
|
+
"description": "检测场景过滤。研发检测通常省略;2 表示发布复检。"
|
|
2044
|
+
},
|
|
2045
|
+
"pageNum": {
|
|
2046
|
+
"type": "integer",
|
|
2047
|
+
"default": 1,
|
|
2048
|
+
"description": "页码,默认 1。"
|
|
2049
|
+
},
|
|
2050
|
+
"pageSize": {
|
|
2051
|
+
"type": "integer",
|
|
2052
|
+
"default": 20,
|
|
2053
|
+
"description": "每页数量,默认 20。"
|
|
2054
|
+
}
|
|
2055
|
+
},
|
|
2056
|
+
"additionalProperties": false
|
|
2057
|
+
},
|
|
2058
|
+
"ipcUri": "/zltaf_slave/v1/factor/detect/history",
|
|
2059
|
+
"bodyFromParams": true,
|
|
2060
|
+
"timeoutMs": 15000
|
|
2061
|
+
},
|
|
2062
|
+
{
|
|
2063
|
+
"name": "mcp-factor-detect-detail",
|
|
2064
|
+
"description": "查询检测报告。MCP 已把 1MB+ 的 Alphalens 明细蒸馏掉,返回 periods[] 分周期指标(icMean/icIr/tStat/pValue/icStd/换手)、quantileMean 分层收益、empyrical、threshold、verifyPassed,被省略的绘图序列列在 reportOmitted。**判断有效性要同周期一起看 icMean 和 pValue**:icMean 接近 0 且 pValue > 0.05 时不能凭符号下结论。status:0 初始、1 运行中、2 成功、3 失败、4 取消、5 跳过;仍为 1 就是还在跑。",
|
|
2065
|
+
"inputSchema": {
|
|
2066
|
+
"type": "object",
|
|
2067
|
+
"properties": {
|
|
2068
|
+
"detectRecordId": {
|
|
2069
|
+
"type": "string",
|
|
2070
|
+
"description": "检测记录ID,来自 mcp-factor-detect-start 或 mcp-factor-detect-history。"
|
|
2071
|
+
},
|
|
2072
|
+
"includeReport": {
|
|
2073
|
+
"type": "boolean",
|
|
2074
|
+
"default": false,
|
|
2075
|
+
"description": "显式原始证据口:原样返回完整 reportJson。默认蒸馏与 reportSections 选择不受影响;超过 1MB 的报告仍可能被宿主截断。"
|
|
2076
|
+
},
|
|
2077
|
+
"reportSections": {
|
|
2078
|
+
"type": "array",
|
|
2079
|
+
"items": {
|
|
2080
|
+
"type": "string",
|
|
2081
|
+
"maxLength": 128
|
|
2082
|
+
},
|
|
2083
|
+
"maxItems": 10,
|
|
2084
|
+
"description": "按需选择 reportJson 字段路径(支持点号路径,例如 alphalens.ic),结果进入 Data.reportSections;最多 10 项、每项最多 128 字符。对象过大时返回 availableReportFields 供继续下钻;选择结果共享 8 KiB JSON 内容预算,超限列入 omittedReportSections。"
|
|
2085
|
+
},
|
|
2086
|
+
"reportOffset": {
|
|
2087
|
+
"type": "integer",
|
|
2088
|
+
"minimum": 0,
|
|
2089
|
+
"default": 0,
|
|
2090
|
+
"description": "对 reportSections 选中的数组或字符串按条目/Unicode code point 分块的起始偏移;默认 0。"
|
|
2091
|
+
},
|
|
2092
|
+
"reportLimit": {
|
|
2093
|
+
"type": "integer",
|
|
2094
|
+
"minimum": 1,
|
|
2095
|
+
"maximum": 50,
|
|
2096
|
+
"default": 20,
|
|
2097
|
+
"description": "对 reportSections 选中的数组或字符串分块的最大条数/字符数;默认 20,最大 50。"
|
|
2098
|
+
}
|
|
2099
|
+
},
|
|
2100
|
+
"required": [
|
|
2101
|
+
"detectRecordId"
|
|
2102
|
+
],
|
|
2103
|
+
"additionalProperties": false
|
|
2104
|
+
},
|
|
2105
|
+
"ipcUri": "/zltaf_slave/v1/factor/detect/detail",
|
|
2106
|
+
"bodyFromParams": true,
|
|
2107
|
+
"timeoutMs": 30000
|
|
2108
|
+
},
|
|
2109
|
+
{
|
|
2110
|
+
"name": "mcp-factor-detect-stop",
|
|
2111
|
+
"description": "停止一次正在运行的因子检测。这是取消运行中的任务,不删除已有的检测记录,也不影响计算产物。",
|
|
2112
|
+
"inputSchema": {
|
|
2113
|
+
"type": "object",
|
|
2114
|
+
"properties": {
|
|
2115
|
+
"detectRecordId": {
|
|
2116
|
+
"type": "string",
|
|
2117
|
+
"description": "检测记录ID,必送。"
|
|
2118
|
+
},
|
|
2119
|
+
"reason": {
|
|
2120
|
+
"type": "string",
|
|
2121
|
+
"default": "用户取消",
|
|
2122
|
+
"description": "停止原因,默认「用户取消」。"
|
|
2123
|
+
}
|
|
2124
|
+
},
|
|
2125
|
+
"required": [
|
|
2126
|
+
"detectRecordId"
|
|
2127
|
+
],
|
|
2128
|
+
"additionalProperties": false
|
|
2129
|
+
},
|
|
2130
|
+
"ipcUri": "/zltaf_slave/v1/factor/detect/stop",
|
|
2131
|
+
"bodyFromParams": true,
|
|
2132
|
+
"timeoutMs": 30000
|
|
2133
|
+
},
|
|
2134
|
+
{
|
|
2135
|
+
"name": "mcp-factor-task-status",
|
|
2136
|
+
"description": "查询一次因子任务执行的状态,是计算与检测的手动/兜底查询入口:适用于用户主动询问进度,或 mcp-wait 异常中断后复查。按 executionId、calculateRecordId 或 detectRecordId 之一查询(只给 executionId 最直接)。返回 status(0 初始/1 运行中/2 成功/3 失败/4 取消/5 跳过)、progress、processAlive、startedAt/endedAt、errorMessage,并内嵌 calculateRecord 与 detectRecord。\n\n**progress 是真实百分比,计算开始后会一路涨**;读到 0 说明还没进计算、引擎在准备数据,这时会额外带上 dataPrep(本机下载任务的 phase/percent/files/currentFile),把「在等数据下载,已完成 X%」如实转述即可。判活始终看 processAlive,不要拿 progress 判断卡没卡。\n\n**等任务结束请用 mcp-wait,不要用本工具循环轮询。** 未进终态时返回仍带 nextPollAfterMs,那是 wait 不可用时的兜底节奏;终态不带该字段。**返回内容连续多次一模一样是因子任务的正常形态,不等于卡住**——唯一的卡死信号是进程已退出而状态仍非终态,那种情况会返回 ErrNo 10044 让你停止并如实复述。status=3 时读 errorMessage 复述真实失败原因。",
|
|
2137
|
+
"inputSchema": {
|
|
2138
|
+
"type": "object",
|
|
2139
|
+
"properties": {
|
|
2140
|
+
"executionId": {
|
|
2141
|
+
"type": "string",
|
|
2142
|
+
"description": "任务执行ID,来自 mcp-factor-calculate-start / mcp-factor-detect-start 返回的 executionId。"
|
|
2143
|
+
},
|
|
2144
|
+
"calculateRecordId": {
|
|
2145
|
+
"type": "string",
|
|
2146
|
+
"description": "计算记录ID。"
|
|
2147
|
+
},
|
|
2148
|
+
"detectRecordId": {
|
|
2149
|
+
"type": "string",
|
|
2150
|
+
"description": "检测记录ID。"
|
|
2151
|
+
}
|
|
2152
|
+
},
|
|
2153
|
+
"additionalProperties": false
|
|
2154
|
+
},
|
|
2155
|
+
"ipcUri": "/zltaf_slave/v1/factor/task/status",
|
|
2156
|
+
"bodyFromParams": true,
|
|
2157
|
+
"timeoutMs": 15000
|
|
2158
|
+
},
|
|
2159
|
+
{
|
|
2160
|
+
"name": "mcp-factor-note-save",
|
|
2161
|
+
"description": "保存因子研究笔记:实验记录、研究结论或备注。用于把一次计算/检测的判断沉淀下来,便于后续回看为什么调整了因子。relatedRefId 可关联到具体的 calculateRecordId 或 detectRecordId,把笔记挂到那次实验上。",
|
|
2162
|
+
"inputSchema": {
|
|
2163
|
+
"type": "object",
|
|
2164
|
+
"properties": {
|
|
2165
|
+
"factorId": {
|
|
2166
|
+
"type": "string",
|
|
2167
|
+
"description": "因子ID,必送。"
|
|
2168
|
+
},
|
|
2169
|
+
"noteType": {
|
|
2170
|
+
"type": "integer",
|
|
2171
|
+
"enum": [
|
|
2172
|
+
0,
|
|
2173
|
+
1,
|
|
2174
|
+
2
|
|
2175
|
+
],
|
|
2176
|
+
"default": 0,
|
|
2177
|
+
"description": "笔记类型。0 实验记录,1 研究结论,2 备注。默认 0。"
|
|
2178
|
+
},
|
|
2179
|
+
"title": {
|
|
2180
|
+
"type": "string",
|
|
2181
|
+
"description": "笔记标题。"
|
|
2182
|
+
},
|
|
2183
|
+
"contentMarkdown": {
|
|
2184
|
+
"type": "string",
|
|
2185
|
+
"description": "笔记正文,Markdown 格式。"
|
|
2186
|
+
},
|
|
2187
|
+
"allowEmpty": {
|
|
2188
|
+
"type": "boolean",
|
|
2189
|
+
"description": "是否允许保存空正文。默认不允许。"
|
|
2190
|
+
},
|
|
2191
|
+
"relatedRefId": {
|
|
2192
|
+
"type": "string",
|
|
2193
|
+
"description": "关联对象ID,可填 calculateRecordId 或 detectRecordId,把笔记挂到那次实验上。"
|
|
2194
|
+
}
|
|
2195
|
+
},
|
|
2196
|
+
"required": [
|
|
2197
|
+
"factorId"
|
|
2198
|
+
],
|
|
2199
|
+
"additionalProperties": false
|
|
2200
|
+
},
|
|
2201
|
+
"ipcUri": "/zltaf_slave/v1/factor/local/note/save",
|
|
2202
|
+
"bodyFromParams": true,
|
|
2203
|
+
"timeoutMs": 30000
|
|
2204
|
+
},
|
|
2205
|
+
{
|
|
2206
|
+
"name": "mcp-factor-note-list",
|
|
2207
|
+
"description": "按因子分页查询研究笔记列表。返回 noteId、title、noteType、relatedRefId 和正文摘要;完整正文要用 mcp-factor-note-detail 取。",
|
|
2208
|
+
"inputSchema": {
|
|
2209
|
+
"type": "object",
|
|
2210
|
+
"properties": {
|
|
2211
|
+
"factorId": {
|
|
2212
|
+
"type": "string",
|
|
2213
|
+
"description": "因子ID,必送。"
|
|
2214
|
+
},
|
|
2215
|
+
"noteType": {
|
|
2216
|
+
"type": "integer",
|
|
2217
|
+
"enum": [
|
|
2218
|
+
0,
|
|
2219
|
+
1,
|
|
2220
|
+
2
|
|
2221
|
+
],
|
|
2222
|
+
"description": "笔记类型过滤。0 实验记录,1 研究结论,2 备注。"
|
|
2223
|
+
},
|
|
2224
|
+
"relatedRefId": {
|
|
2225
|
+
"type": "string",
|
|
2226
|
+
"description": "按关联对象ID过滤。"
|
|
2227
|
+
},
|
|
2228
|
+
"pageNum": {
|
|
2229
|
+
"type": "integer",
|
|
2230
|
+
"default": 1,
|
|
2231
|
+
"description": "页码,默认 1。"
|
|
2232
|
+
},
|
|
2233
|
+
"pageSize": {
|
|
2234
|
+
"type": "integer",
|
|
2235
|
+
"default": 20,
|
|
2236
|
+
"description": "每页数量,默认 20。"
|
|
2237
|
+
}
|
|
2238
|
+
},
|
|
2239
|
+
"required": [
|
|
2240
|
+
"factorId"
|
|
2241
|
+
],
|
|
2242
|
+
"additionalProperties": false
|
|
2243
|
+
},
|
|
2244
|
+
"ipcUri": "/zltaf_slave/v1/factor/local/note/list",
|
|
2245
|
+
"bodyFromParams": true,
|
|
2246
|
+
"timeoutMs": 15000
|
|
2247
|
+
},
|
|
2248
|
+
{
|
|
2249
|
+
"name": "mcp-factor-note-detail",
|
|
2250
|
+
"description": "查询单条研究笔记的完整 Markdown 正文。上游要求同时传 factorId 和 noteId,缺一不可。",
|
|
2251
|
+
"inputSchema": {
|
|
2252
|
+
"type": "object",
|
|
2253
|
+
"properties": {
|
|
2254
|
+
"factorId": {
|
|
2255
|
+
"type": "string",
|
|
2256
|
+
"description": "因子ID,必送。"
|
|
2257
|
+
},
|
|
2258
|
+
"noteId": {
|
|
2259
|
+
"type": "string",
|
|
2260
|
+
"description": "笔记ID,来自 mcp-factor-note-list,必送。"
|
|
2261
|
+
}
|
|
2262
|
+
},
|
|
2263
|
+
"required": [
|
|
2264
|
+
"factorId",
|
|
2265
|
+
"noteId"
|
|
2266
|
+
],
|
|
2267
|
+
"additionalProperties": false
|
|
2268
|
+
},
|
|
2269
|
+
"ipcUri": "/zltaf_slave/v1/factor/local/note/detail",
|
|
2270
|
+
"bodyFromParams": true,
|
|
2271
|
+
"timeoutMs": 15000
|
|
1309
2272
|
}
|
|
1310
2273
|
]
|
|
1311
2274
|
}
|