All checks were successful
Deploy to Production / deploy (push) Successful in 1m32s
Phase 1 (Critical): - Add bulk rebalance apply API + UI with confirmation modal - Add strategy results to portfolio targets flow (shared component) Phase 2 (Important): - Show current holdings in signal execute modal with auto-fill - Add DC pension risk asset ratio warning (70% limit) - Add KOSPI benchmark comparison to portfolio returns - Track signal execution details (price, quantity, timestamp) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
63 lines
1.4 KiB
Python
63 lines
1.4 KiB
Python
"""
|
|
Signal related Pydantic schemas.
|
|
"""
|
|
from datetime import date, datetime
|
|
from decimal import Decimal
|
|
from typing import Optional, List
|
|
from enum import Enum
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
from app.schemas.portfolio import FloatDecimal
|
|
|
|
|
|
class SignalExecuteRequest(BaseModel):
|
|
portfolio_id: int
|
|
quantity: int = Field(..., gt=0)
|
|
price: FloatDecimal = Field(..., gt=0)
|
|
|
|
|
|
class SignalType(str, Enum):
|
|
BUY = "buy"
|
|
SELL = "sell"
|
|
PARTIAL_SELL = "partial_sell"
|
|
|
|
|
|
class SignalStatus(str, Enum):
|
|
ACTIVE = "active"
|
|
EXECUTED = "executed"
|
|
EXPIRED = "expired"
|
|
|
|
|
|
class SignalResponse(BaseModel):
|
|
id: int
|
|
date: date
|
|
ticker: str
|
|
name: Optional[str] = None
|
|
signal_type: str
|
|
entry_price: Optional[FloatDecimal] = None
|
|
target_price: Optional[FloatDecimal] = None
|
|
stop_loss_price: Optional[FloatDecimal] = None
|
|
reason: Optional[str] = None
|
|
status: str
|
|
created_at: datetime
|
|
executed_price: Optional[FloatDecimal] = None
|
|
executed_quantity: Optional[int] = None
|
|
executed_at: Optional[datetime] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class ActivePosition(BaseModel):
|
|
ticker: str
|
|
name: Optional[str] = None
|
|
entry_date: date
|
|
entry_price: FloatDecimal
|
|
current_price: FloatDecimal
|
|
shares: int
|
|
stop_loss_price: FloatDecimal
|
|
target_price: FloatDecimal
|
|
pnl_percent: FloatDecimal
|
|
pnl_amount: FloatDecimal
|