Team Ai
Apppublic

blackopsrepl/portfolio-optimization-python

sourceHugging Faceapache-2.0updated 10mo agoView on Hugging Face
1likes
score_analysis.py24 linesDownload Raw Back to portfolio_optimization
1"""
2Score Analysis DTOs for Portfolio Optimization.
3
4These data transfer objects are used for the /analyze endpoint
5to provide detailed constraint-by-constraint score breakdown.
6"""
7from pydantic import BaseModel
8from typing import List
9
10
11class MatchAnalysisDTO(BaseModel):
12    """A single constraint match (violation or reward)."""
13    name: str
14    score: str
15    justification: str
16
17
18class ConstraintAnalysisDTO(BaseModel):
19    """Analysis of a single constraint across all matches."""
20    name: str
21    weight: str
22    score: str
23    matches: List[MatchAnalysisDTO]
24