- Add pykrx-openapi dependency - New krx_client.py wrapper module - ETFCollector: Open API bulk fetch + pykrx fallback - ETFPriceCollector: Open API date-based bulk + pykrx fallback - StockCollector: Open API base_info + daily_trade + pykrx fallback - PriceCollector: Open API date-based bulk + pykrx fallback - ValuationCollector: pykrx retained (Open API has no PER/PBR) - generate_snapshots.py: Open API + pykrx fallback - Auto-switch based on KRX_OPENAPI_KEY env var - All 278 tests passing
50 lines
1.0 KiB
Python
50 lines
1.0 KiB
Python
"""
|
|
Application configuration using Pydantic Settings.
|
|
"""
|
|
|
|
from pydantic_settings import BaseSettings
|
|
from functools import lru_cache
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
# Application
|
|
app_name: str = "Galaxis-Po"
|
|
debug: bool = False
|
|
|
|
# Database
|
|
database_url: str
|
|
|
|
# JWT
|
|
jwt_secret: str
|
|
jwt_algorithm: str = "HS256"
|
|
access_token_expire_minutes: int = 60 * 24 # 24 hours
|
|
|
|
# CORS
|
|
cors_origins: str = "http://localhost:3000"
|
|
|
|
# Admin user (auto-created on startup if not exists)
|
|
admin_username: str = ""
|
|
admin_email: str = ""
|
|
admin_password: str = ""
|
|
|
|
# External APIs
|
|
kis_app_key: str = ""
|
|
kis_app_secret: str = ""
|
|
kis_account_no: str = ""
|
|
dart_api_key: str = ""
|
|
krx_openapi_key: str = ""
|
|
|
|
# Notifications (optional)
|
|
discord_webhook_url: str = ""
|
|
telegram_bot_token: str = ""
|
|
telegram_chat_id: str = ""
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = False
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|