StockPred-Backend / app /config.py
Anurag33Gaikwad's picture
Update app/config.py
36d5a6b verified
Raw
History Blame Contribute Delete
1.04 kB
import os
from functools import lru_cache
from typing import List
class Settings:
# App
app_name: str = "QuantMind Backend"
environment: str = os.getenv("ENVIRONMENT", "dev")
# CORS
cors_origins: List[str] = os.getenv("CORS_ORIGINS", "*").split(",")
# Model
model_path: str = os.getenv(
"MODEL_PATH",
"model/universal_multivariate_model_v1.h5",
)
# Market data (Alpha Vantage)
alpha_vantage_api_key: str = os.getenv("ALPHA_VANTAGE_API_KEY")
# Prediction params
history_window: int = int(os.getenv("HISTORY_WINDOW", "50"))
max_forecast_days: int = int(os.getenv("MAX_FORECAST_DAYS", "14"))
def validate(self):
"""
Validate critical settings at runtime
"""
if not self.alpha_vantage_api_key:
raise RuntimeError(
"ALPHA_VANTAGE_API_KEY is not set in environment variables"
)
@lru_cache
def get_settings() -> Settings:
settings = Settings()
settings.validate()
return settings