Files
tonghuashun_CardDemo/doc/ai-pick-interfaces.md
clz 63fcb9cbaa refactor(cards): 统一 AI 选期与市场排名卡片架构
- 将 AI Pick 重构为 NodeComponent、DataFetcher、Models 分层结构
- 新增公共 AllCardsCard 模型与卡片配置 Mock 数据
- 分离 cardConfig 与 cardData 的状态及更新职责
- 对齐两个卡片的标题、配置跳转、深色模式和说明 Sheet 设计
- 完善 AI Pick HTTP 请求、行情订阅、跳转参数及接口文档
- 保留 MarketRanking 榜单请求、行情合并和展开收起交互
2026-07-23 16:56:57 +08:00

87 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# AI 选期接口文档
本文记录 `AiPickNodeComponent` 使用的策略 HTTP 接口及 4106 行情订阅协议。当前实现位于
`entry/src/main/ets/ai-pick/AiPickDataFetcher.ets`
## 策略 HTTP 接口
### 请求
```text
GET {API_HOST}futgwapi/api/ai_diagnosis/home_strategy/v1/user_data?_=TIMESTAMP
```
| 构建模式 | API_HOST |
| --- | --- |
| Debug | `https://futures-test.10jqka.com.cn/` |
| Release | `https://ftapi.10jqka.com.cn/` |
请求头为 `Content-Type: application/json` 和客户端 Cookie。`_` 是毫秒时间戳,用于避免缓存。
### 响应
```json
{
"code": 0,
"data": [
{
"type": "custom_strategy",
"custom_strategy": {
"custom_strategy": {
"id": "1",
"strategy_name": "策略名",
"user_question": "策略描述",
"strategy_type": "custom_strategy",
"tag_list": ["自编"]
},
"detail_list": [
{
"contract": "CU2501",
"market": "70",
"contract_name": "沪铜2501",
"main_contract_type": "1"
}
],
"field_list": [],
"origin_result_list": [],
"detail_count": 1
}
}
]
}
```
HTTP 数据先生成 Tab 和合约列表;最新价、涨跌幅由行情推送补齐。
## 4106 行情订阅
```json
{
"protocolId": "4106",
"pageId": "2201",
"onlineId": "contractHQData",
"columnOrder": "55|10|4|36103|34818|6|7|66|34877",
"requestDic": "sortid=-1\r\nsortorder=0\r\npush=1\r\ndataitem=55,10,4,36103,34818,6,7,66,34877,\r\ncodelist=70(CU2501,);\r\nscenario=qht_qihuo_sort\r\nprecision=1\r\npushtime=2.5\r\n"
}
```
合约按市场分组写入 `codelist``push=1` 表示持续推送,推送间隔为 2.5 秒。关键字段:
| 字段 | ID |
| --- | ---: |
| 名称 | 55 |
| 最新价 | 10 |
| 合约代码 | 4 |
| 市场 | 36103 |
| 涨跌幅 | 34818 |
| 昨收 | 6 |
| 开盘价 | 7 |
| 昨结算 | 66 |
| 主力标记 | 34877 |
## 当前 Mock 行为
- HTTP 使用 `@ohos.net.http` 构造请求并打印参数,但不调用 `request()`
- Fetcher 延迟 300ms 返回 Mock 策略数据,不读取或更新卡片缓存。
- 行情订阅打印完整 4106 参数,每 2500ms 生成一次行情,并整体替换 `CardData`