前端: 新增 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,不受我们缓存控制;页面数值展示走自有缓存通路,统一且可控。
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""
|
|
Application settings management using Pydantic
|
|
"""
|
|
from typing import List, Optional
|
|
from pydantic_settings import BaseSettings
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings loaded from environment variables."""
|
|
APP_NAME: str = "Fundamental Analysis System"
|
|
APP_VERSION: str = "1.0.0"
|
|
DEBUG: bool = False
|
|
|
|
# Default database URL switched to SQLite (async) to avoid optional driver issues.
|
|
# You can override via config or env to PostgreSQL later.
|
|
DATABASE_URL: str = "sqlite+aiosqlite:///./app.db"
|
|
DATABASE_ECHO: bool = False
|
|
|
|
# API settings
|
|
API_V1_STR: str = "/api"
|
|
ALLOWED_ORIGINS: List[str] = ["http://localhost:3000", "http://127.0.0.1:3000"]
|
|
|
|
# External service credentials, can be overridden
|
|
GEMINI_API_KEY: Optional[str] = None
|
|
TUSHARE_TOKEN: Optional[str] = None
|
|
|
|
# Microservices
|
|
CONFIG_SERVICE_BASE_URL: str = "http://config-service:7000/api/v1"
|
|
DATA_PERSISTENCE_BASE_URL: str = "http://data-persistence-service:3000/api/v1"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = True
|
|
|
|
# Global settings instance
|
|
settings = Settings()
|