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
47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
"""
|
|
Notification models for signal alerts.
|
|
"""
|
|
import enum
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import (
|
|
Column, Integer, String, DateTime, Boolean, Text,
|
|
ForeignKey, Enum as SQLEnum,
|
|
)
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class ChannelType(str, enum.Enum):
|
|
DISCORD = "discord"
|
|
TELEGRAM = "telegram"
|
|
|
|
|
|
class NotificationStatus(str, enum.Enum):
|
|
SENT = "sent"
|
|
FAILED = "failed"
|
|
|
|
|
|
class NotificationSetting(Base):
|
|
__tablename__ = "notification_settings"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
user_id = Column(Integer, ForeignKey("users.id"), nullable=False, index=True)
|
|
channel_type = Column(SQLEnum(ChannelType), nullable=False)
|
|
webhook_url = Column(String(500), nullable=False)
|
|
enabled = Column(Boolean, default=True)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
|
class NotificationHistory(Base):
|
|
__tablename__ = "notification_history"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
signal_id = Column(Integer, ForeignKey("signals.id"), nullable=False, index=True)
|
|
channel_type = Column(SQLEnum(ChannelType), nullable=False)
|
|
sent_at = Column(DateTime, default=datetime.utcnow)
|
|
status = Column(SQLEnum(NotificationStatus), nullable=False)
|
|
message = Column(Text)
|
|
error_message = Column(Text, nullable=True)
|