Fundamental_Analysis/services/data-persistence-service/Cargo.toml
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

84 lines
2.4 KiB
TOML

[package]
name = "data-persistence-service"
version = "0.1.2"
edition = "2021"
authors = ["Lv, Qi <lvsoft@gmail.com>"]
default-run = "data-persistence-service-server"
[lib]
name = "data_persistence_service"
path = "src/lib.rs"
[[bin]]
name = "data-persistence-service-server"
path = "src/main.rs"
[[bin]]
name = "api-cli"
path = "src/bin/api-cli.rs"
# The cli feature is not yet compatible with the new architecture.
# required-features = ["service_kit/api-cli"]
[dependencies]
service_kit = { version = "0.1.2", default-features = true }
anyhow = "1.0"
rmcp = { version = "0.8.5", features = [
"transport-streamable-http-server",
"transport-worker"
] }
# Web framework
axum = "0.8"
tokio = { version = "1.0", features = ["full"] }
tower-http = { version = "0.6.6", features = ["cors", "trace"] }
tower = { version = "0.5", features = ["util"] }
# Observability
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
# OpenAPI & Schema
utoipa = { version = "5.4", features = ["axum_extras", "chrono", "uuid"] }
utoipa-swagger-ui = { version = "9.0", features = ["axum"] }
# Environment variables
dotenvy = "0.15"
# Error Handling
thiserror = "2.0.17"
# Database
sqlx = { version = "0.8.6", features = [ "runtime-tokio-rustls", "postgres", "chrono", "uuid", "json", "rust_decimal" ] }
rust_decimal = { version = "1.36", features = ["serde"] }
chrono = { version = "0.4", features = ["serde"] }
uuid = { version = "1", features = ["serde", "v4"] }
# WASM CLI UI
rust-embed = "8.7"
axum-embed = "0.1.0"
[dev-dependencies]
http-body-util = "0.1"
tower = { version = "0.5", features = ["util"] }
# Feature 管理:默认全部启用,可选择性关闭
[features]
default = ["swagger-ui"]
swagger-ui = []
wasm-cli = []
# 让模板的 `mcp` 特性联动 service_kit 的 mcp 功能
mcp = ["service_kit/mcp"]
# 可选:透传 api-cli 给 service_kit
# api-cli = ["service_kit/api-cli"]
# --- For Local Development ---
# If you are developing `service_kit` locally, uncomment the following lines
# in your project's `.cargo/config.toml` file (create it if it doesn't exist)
# to make Cargo use your local version instead of the one from git.
#
# [patch.'https://github.com/lvsoft/service_kit']
# service_kit = { path = "../service_kit" } # Note: Adjust the path if your directory structure is different.