Fundamental_Analysis/services/data-persistence-service/.sqlx/query-242e6f3319cfa0c19b53c4da80993a1da3cb77f58a3c0dac0260bf3adb4e501f.json
Lv, Qi 21155bc4f8 feat(realtime): 接入前端实时报价并完善后端缓存
前端: 新增 RealTimeQuoteResponse 类型;新增 useRealtimeQuote Hook 并在报告页图表旁展示价格与时间戳(严格 TTL,无兜底)

FastAPI: 新增 GET /financials/{market}/{symbol}/realtime?max_age_seconds=.. 只读端点;通过 DataPersistenceClient 读取 Rust 缓存

Rust: 新增 realtime_quotes hypertable 迁移;新增 POST /api/v1/market-data/quotes 与 GET /api/v1/market-data/quotes/{symbol}?market=..;新增 DTO/Model/DB 函数;修正 #[api] 宏与路径参数;生成 SQLx 离线缓存 (.sqlx) 以支持离线构建

Python: DataPersistenceClient 新增 upsert/get 实时报价,并调整 GET 路径与参数

说明: TradingView 图表是第三方 websocket,不受我们缓存控制;页面数值展示走自有缓存通路,统一且可控。
2025-11-09 05:12:14 +08:00

96 lines
1.9 KiB
JSON

{
"db_name": "PostgreSQL",
"query": "\n SELECT symbol, market, ts, price, open_price, high_price, low_price, prev_close, change, change_percent, volume, source, updated_at\n FROM realtime_quotes\n WHERE symbol = $1 AND market = $2\n ORDER BY ts DESC\n LIMIT 1\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "symbol",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "market",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "ts",
"type_info": "Timestamptz"
},
{
"ordinal": 3,
"name": "price",
"type_info": "Numeric"
},
{
"ordinal": 4,
"name": "open_price",
"type_info": "Numeric"
},
{
"ordinal": 5,
"name": "high_price",
"type_info": "Numeric"
},
{
"ordinal": 6,
"name": "low_price",
"type_info": "Numeric"
},
{
"ordinal": 7,
"name": "prev_close",
"type_info": "Numeric"
},
{
"ordinal": 8,
"name": "change",
"type_info": "Numeric"
},
{
"ordinal": 9,
"name": "change_percent",
"type_info": "Numeric"
},
{
"ordinal": 10,
"name": "volume",
"type_info": "Int8"
},
{
"ordinal": 11,
"name": "source",
"type_info": "Varchar"
},
{
"ordinal": 12,
"name": "updated_at",
"type_info": "Timestamptz"
}
],
"parameters": {
"Left": [
"Text",
"Text"
]
},
"nullable": [
false,
false,
false,
false,
true,
true,
true,
true,
true,
true,
true,
true,
false
]
},
"hash": "242e6f3319cfa0c19b53c4da80993a1da3cb77f58a3c0dac0260bf3adb4e501f"
}