2026-09-11 14:44:29 +08:00
|
|
|
"""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
|
2026-09-11 20:27:56 +08:00
|
|
|
from app.service.advisor_rollout_service import enforce_advisor_rollout
|
2026-09-11 14:44:29 +08:00
|
|
|
from app.service.asset_allocation_service import AssetAllocationService
|
|
|
|
|
|
|
|
|
|
router = APIRouter(
|
|
|
|
|
prefix="/api/v1/advisor", tags=["advisor-asset-allocation"],
|
2026-09-11 20:27:56 +08:00
|
|
|
dependencies=[Depends(enforce_rate_limit), Depends(enforce_advisor_rollout)],
|
2026-09-11 14:44:29 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@router.post("/asset-allocation")
|
|
|
|
|
async def generate_asset_allocation(
|
|
|
|
|
payload: AssetAllocationQuery,
|
|
|
|
|
context: RequestContext = Depends(build_request_context), # noqa: B008
|
|
|
|
|
) -> dict[str, object]:
|
2026-09-11 16:42:31 +08:00
|
|
|
return await AssetAllocationService(enforce_profile_governance=True).generate_for_agent(
|
|
|
|
|
payload, context
|
|
|
|
|
)
|