Files
group_fqcd_jr/app/api/controllers/asset_allocation.py
T

26 lines
977 B
Python

"""Analysis-only dynamic asset allocation endpoint."""
from fastapi import APIRouter, Depends
from app.api.dependencies.auth import build_request_context
from app.api.dependencies.rate_limit import enforce_rate_limit
from app.api.schemas.asset_allocation import AssetAllocationQuery
from app.core.contracts import RequestContext
from app.service.advisor_rollout_service import enforce_advisor_rollout
from app.service.asset_allocation_service import AssetAllocationService
router = APIRouter(
prefix="/api/v1/advisor", tags=["advisor-asset-allocation"],
dependencies=[Depends(enforce_rate_limit), Depends(enforce_advisor_rollout)],
)
@router.post("/asset-allocation")
async def generate_asset_allocation(
payload: AssetAllocationQuery,
context: RequestContext = Depends(build_request_context), # noqa: B008
) -> dict[str, object]:
return await AssetAllocationService(enforce_profile_governance=True).generate_for_agent(
payload, context
)