feat: 迭代03-05 交易记录接入、行情实时、QMT连接配置、data store 标准化

- R-004 QMT连接配置:多配置管理 + 会话头部快捷切换(03-QMT连接配置)
- R-005 WS盘中价格实时更新:服务端中转+缓存+前端轮询(04-WS盘中价格实时更新)
- R-006 策略数据 JSON data store 标准化(store.json/market.json/schema.json)
- R-007 交易记录接入:当日订单+成交单表合并(委托主行+展开成交明细)、时间段查询(今日/本周/本月+手动起止)、费用计算(佣金费率万m_dCommission+最低5元、印花税卖出万5、过户费双向万0.1)
- 架构治理:api 按领域拆分、component 目录、QmtHealthMonitor
This commit is contained in:
2026-09-01 13:21:49 +08:00
parent 5a723d514e
commit bb3f8bd28d
57 changed files with 5244 additions and 397 deletions
+11 -2
View File
@@ -6,20 +6,27 @@
import { useState, useEffect, useCallback } from 'react';
import { useRpc } from './connection.jsx';
import { LoadState } from './LoadState.jsx';
import { useMarket } from '../market/MarketDataProvider.jsx';
import { PriceCell } from './PriceCell.jsx';
export function AllPositionsTab(props) {
const [positions, setPositions] = useState(null);
const [error, setError] = useState(null);
const [loading, setLoading] = useState(true);
const call = useRpc();
const { getPrice, registerCodes } = useMarket();
const load = useCallback(async () => {
setLoading(true);
setError(null);
try {
const res = await call('one-divine-lot/summary');
if (res && res.ok) setPositions(res.value);
else setError((res && res.error && res.error.message) || '加载失败');
if (res && res.ok) {
setPositions(res.value);
// 上报持仓 code 给行情 Provider(去重:不再由 Provider 自拉 positions
const codes = (res.value?.positions ?? []).map((p) => p.code).filter(Boolean);
registerCodes(codes);
} else setError((res && res.error && res.error.message) || '加载失败');
} catch (e) {
setError(e.message);
} finally {
@@ -40,6 +47,7 @@ export function AllPositionsTab(props) {
<tr style={{ textAlign: 'left', borderBottom: '2px solid #ddd' }}>
<th style={{ padding: '8px 6px', lineHeight: '24px' }}>代码</th>
<th style={{ padding: '8px 6px', lineHeight: '24px' }}>名称</th>
<th style={{ padding: '8px 6px', lineHeight: '24px' }}>现价</th>
<th style={{ padding: '8px 6px', lineHeight: '24px' }}>总持仓</th>
<th style={{ padding: '8px 6px', lineHeight: '24px' }}>已分配</th>
<th style={{ padding: '8px 6px', lineHeight: '24px' }}>未分配</th>
@@ -51,6 +59,7 @@ export function AllPositionsTab(props) {
<tr key={p.code} style={{ borderBottom: '1px solid #eee' }}>
<td style={{ padding: '8px 6px', lineHeight: '24px' }}>{p.code}</td>
<td style={{ padding: '8px 6px', lineHeight: '24px' }}>{p.name}</td>
<PriceCell price={getPrice(p.code)?.lastPrice} lastClose={getPrice(p.code)?.lastClose} />
<td style={{ padding: '8px 6px', lineHeight: '24px' }}>{p.totalVolume}</td>
<td style={{ padding: '8px 6px', lineHeight: '24px' }}>{p.allocated}</td>
<td style={{ padding: '8px 6px', lineHeight: '24px', color: p.unallocated > 0 ? '#e65100' : '#2e7d32' }}>{p.unallocated}</td>