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>
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
"""
|
|
Trading signal models.
|
|
"""
|
|
import enum
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import (
|
|
Column, Integer, String, Numeric, DateTime, Date,
|
|
Text, Enum as SQLEnum,
|
|
)
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class SignalType(str, enum.Enum):
|
|
BUY = "buy"
|
|
SELL = "sell"
|
|
PARTIAL_SELL = "partial_sell"
|
|
|
|
|
|
class SignalStatus(str, enum.Enum):
|
|
ACTIVE = "active"
|
|
EXECUTED = "executed"
|
|
EXPIRED = "expired"
|
|
|
|
|
|
class Signal(Base):
|
|
__tablename__ = "signals"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
date = Column(Date, nullable=False, index=True)
|
|
ticker = Column(String(20), nullable=False, index=True)
|
|
name = Column(String(100))
|
|
signal_type = Column(SQLEnum(SignalType), nullable=False)
|
|
entry_price = Column(Numeric(12, 2))
|
|
target_price = Column(Numeric(12, 2))
|
|
stop_loss_price = Column(Numeric(12, 2))
|
|
reason = Column(String(200))
|
|
status = Column(SQLEnum(SignalStatus), default=SignalStatus.ACTIVE)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
# Execution tracking fields
|
|
executed_price = Column(Numeric(12, 2), nullable=True)
|
|
executed_quantity = Column(Integer, nullable=True)
|
|
executed_at = Column(DateTime, nullable=True)
|