mutual-fund / app /models /goal_models.py
lucifer7210's picture
Upload 21 files
eb606e1 verified
from pydantic import BaseModel, Field
from typing import List, Dict, Optional, Any
from datetime import datetime
from enum import Enum
class RiskTolerance(str, Enum):
CONSERVATIVE = "Conservative"
MODERATE = "Moderate"
AGGRESSIVE = "Aggressive"
class InvestmentExperience(str, Enum):
BEGINNER = "Beginner"
INTERMEDIATE = "Intermediate"
ADVANCED = "Advanced"
class TaxBracket(str, Enum):
TEN_PERCENT = "10%"
TWENTY_PERCENT = "20%"
THIRTY_PERCENT = "30%"
class PriorityLevel(str, Enum):
LOW = "Low"
MEDIUM = "Medium"
HIGH = "High"
CRITICAL = "Critical"
class ClientProfile(BaseModel):
age: int = Field(ge=18, le=100)
monthly_income: float = Field(gt=0)
risk_tolerance: RiskTolerance
investment_experience: InvestmentExperience
tax_bracket: TaxBracket
monthly_savings: float = Field(gt=0)
class InvestmentGoal(BaseModel):
name: str
amount: float = Field(gt=0)
inflation_adjusted_amount: float = Field(gt=0)
years: int = Field(ge=1, le=40)
priority: PriorityLevel
required_sip: float = Field(ge=0)
expected_inflation: float = Field(ge=0, le=20)
id: int
class GoalsDashboard(BaseModel):
goals: List[InvestmentGoal]
total_required_sip: float
monthly_savings: float
shortfall: float
surplus: float
class SIPCalculationRequest(BaseModel):
monthly_amount: float = Field(gt=0)
annual_return: float = Field(ge=0)
years: int = Field(ge=1)
class SIPCalculationResponse(BaseModel):
maturity_amount: float
total_invested: float
gains: float
return_multiple: float
yearly_breakdown: Optional[List[Dict[str, Any]]] = None
class RequiredSIPRequest(BaseModel):
target_amount: float = Field(gt=0)
years: int = Field(ge=1)
expected_return: float = Field(ge=0)
class RequiredSIPResponse(BaseModel):
required_sip: float
class GoalsDashboardRequest(BaseModel):
goals: List[InvestmentGoal]
monthly_savings: float