46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
from dataclasses import dataclass
|
|
from typing import Dict, List, Optional
|
|
from datetime import datetime
|
|
|
|
@dataclass
|
|
class PortfolioAllocation:
|
|
ticker: str
|
|
price: float
|
|
yield_annual: float
|
|
initial_shares: float
|
|
initial_allocation: float
|
|
distribution: str
|
|
|
|
@dataclass
|
|
class MonthlyData:
|
|
month: int
|
|
total_value: float
|
|
monthly_income: float
|
|
cumulative_income: float
|
|
shares: Dict[str, float]
|
|
prices: Dict[str, float]
|
|
yields: Dict[str, float]
|
|
|
|
@dataclass
|
|
class DripConfig:
|
|
months: int
|
|
erosion_type: str
|
|
erosion_level: Dict
|
|
dividend_frequency: Dict[str, int] = None
|
|
|
|
def __post_init__(self):
|
|
if self.dividend_frequency is None:
|
|
self.dividend_frequency = {
|
|
"Monthly": 12,
|
|
"Quarterly": 4,
|
|
"Semi-Annually": 2,
|
|
"Annually": 1,
|
|
"Unknown": 12 # Default to monthly if unknown
|
|
}
|
|
|
|
@dataclass
|
|
class DripResult:
|
|
monthly_data: List[MonthlyData]
|
|
final_portfolio_value: float
|
|
total_income: float
|
|
total_shares: Dict[str, float] |