"""FastAPI application entry point.""" from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.config import settings from app.database import engine, Base # Import routers from app.api.v1 import backtest, data, portfolios, rebalancing # Create tables Base.metadata.create_all(bind=engine) # Create FastAPI app app = FastAPI( title=settings.app_name, version="1.0.0", description="퇴직연금 리밸런싱 + 한국 주식 Quant 분석 통합 플랫폼", ) # CORS middleware app.add_middleware( CORSMiddleware, allow_origins=["*"], # TODO: Configure for production allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) # Health check endpoint @app.get("/health") async def health_check(): """Health check endpoint.""" return { "status": "healthy", "app_name": settings.app_name, "environment": settings.environment, } # Root endpoint @app.get("/") async def root(): """Root endpoint.""" return { "message": "Pension Quant Platform API", "version": "1.0.0", "docs": "/docs", } # Include API routers app.include_router(backtest.router, prefix=f"{settings.api_v1_prefix}/backtest", tags=["backtest"]) app.include_router(data.router, prefix=f"{settings.api_v1_prefix}/data", tags=["data"]) app.include_router(portfolios.router, prefix=f"{settings.api_v1_prefix}/portfolios", tags=["portfolios"]) app.include_router(rebalancing.router, prefix=f"{settings.api_v1_prefix}/rebalancing", tags=["rebalancing"])