You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.9 KiB

"""
期货股票数据统一平台 - 配置文件
"""
import os
from functools import lru_cache
from typing import Optional
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
"""应用配置"""
# 应用基础配置
APP_NAME: str = "金融数据中台"
APP_VERSION: str = "2.0.0"
DEBUG: bool = True
API_PREFIX: str = "/api" # v2 路由使用 /api/v2/xxx
# 服务器配置
HOST: str = "0.0.0.0"
PORT: int = 8000
# 安全配置
SECRET_KEY: str = "your-secret-key-change-in-production"
ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60
REFRESH_TOKEN_EXPIRE_DAYS: int = 7
# 数据库配置 - TimescaleDB (时序数据)
TIMESCALE_DB_URL: str = "postgresql://postgres:postgres@timescaledb:5432/kline_data"
# 数据库配置 - SQLite (配置数据)
SQLITE_DB_PATH: str = "/app/data/config.db"
# Redis 配置
REDIS_URL: str = "redis://redis:6379/0"
REDIS_HOST: str = "redis"
REDIS_PORT: int = 6379
REDIS_DB: int = 0
# amazingData SDK 配置 - 银河证券星耀数智量化平台
AMAZING_DATA_HOST: str = "140.206.44.234"
AMAZING_DATA_PORT: int = 8600
AMAZING_DATA_ACCOUNT: str = "11200008169"
AMAZING_DATA_PASSWORD: str = "11200008169@2026"
AMAZING_DATA_ENV: str = "production" # simulation or production
# 日志配置
LOG_LEVEL: str = "INFO"
LOG_FORMAT: str = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
# CORS 配置
CORS_ORIGINS: list = ["*"]
# 限流配置
RATE_LIMIT_PER_MINUTE: int = 60
# WebSocket 配置
WS_HEARTBEAT_INTERVAL: int = 30
class Config:
env_file = ".env"
case_sensitive = True
@lru_cache()
def get_settings() -> Settings:
"""获取配置单例"""
return Settings()
settings = get_settings()