Phase 1: - Real-time signal alerts (Discord/Telegram webhook) - Trading journal with entry/exit tracking - Position sizing calculator (Fixed/Kelly/ATR) Phase 2: - Pension asset allocation (DC/IRP 70% risk limit) - Drawdown monitoring with SVG gauge - Benchmark dashboard (portfolio vs KOSPI vs deposit) Phase 3: - Tax benefit simulation (Korean pension tax rules) - Correlation matrix heatmap - Parameter optimizer with grid search + overfit detection
55 lines
1.5 KiB
Python
55 lines
1.5 KiB
Python
"""
|
|
Tax simulation API endpoints.
|
|
"""
|
|
from fastapi import APIRouter
|
|
|
|
from app.schemas.tax_simulation import (
|
|
AccumulationRequest,
|
|
AccumulationResponse,
|
|
PensionTaxRequest,
|
|
PensionTaxResponse,
|
|
TaxDeductionRequest,
|
|
TaxDeductionResponse,
|
|
)
|
|
from app.services.tax_simulation import (
|
|
calculate_pension_tax,
|
|
calculate_tax_deduction,
|
|
simulate_accumulation,
|
|
)
|
|
|
|
router = APIRouter(prefix="/api/tax", tags=["tax-simulation"])
|
|
|
|
|
|
@router.post("/deduction", response_model=TaxDeductionResponse)
|
|
async def tax_deduction(request: TaxDeductionRequest):
|
|
"""연간 세액공제 계산."""
|
|
result = calculate_tax_deduction(
|
|
annual_income=request.annual_income,
|
|
contribution=request.contribution,
|
|
account_type=request.account_type.value,
|
|
)
|
|
return result
|
|
|
|
|
|
@router.post("/pension-tax", response_model=PensionTaxResponse)
|
|
async def pension_tax(request: PensionTaxRequest):
|
|
"""연금 수령 시 세금 비교."""
|
|
result = calculate_pension_tax(
|
|
withdrawal_amount=request.withdrawal_amount,
|
|
withdrawal_type=request.withdrawal_type.value,
|
|
age=request.age,
|
|
)
|
|
return result
|
|
|
|
|
|
@router.post("/accumulation", response_model=AccumulationResponse)
|
|
async def accumulation(request: AccumulationRequest):
|
|
"""적립 시뮬레이션."""
|
|
result = simulate_accumulation(
|
|
monthly_contribution=request.monthly_contribution,
|
|
years=request.years,
|
|
annual_return=request.annual_return,
|
|
tax_deduction_rate=request.tax_deduction_rate,
|
|
)
|
|
return result
|