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
60 lines
2.6 KiB
Python
60 lines
2.6 KiB
Python
"""add notification settings and history tables
|
|
|
|
Revision ID: d4e5f6a7b8c9
|
|
Revises: c3d4e5f6a7b8
|
|
Create Date: 2026-03-29 10:00:00.000000
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = 'd4e5f6a7b8c9'
|
|
down_revision: Union[str, None] = 'c3d4e5f6a7b8'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
'notification_settings',
|
|
sa.Column('id', sa.Integer(), primary_key=True, autoincrement=True),
|
|
sa.Column('user_id', sa.Integer(), sa.ForeignKey('users.id'), nullable=False),
|
|
sa.Column('channel_type', sa.Enum('discord', 'telegram', name='channeltype'), nullable=False),
|
|
sa.Column('webhook_url', sa.String(500), nullable=False),
|
|
sa.Column('enabled', sa.Boolean(), server_default='true'),
|
|
sa.Column('created_at', sa.DateTime(), server_default=sa.func.now()),
|
|
sa.Column('updated_at', sa.DateTime(), server_default=sa.func.now()),
|
|
)
|
|
op.create_index('ix_notification_settings_id', 'notification_settings', ['id'])
|
|
op.create_index('ix_notification_settings_user_id', 'notification_settings', ['user_id'])
|
|
|
|
op.create_table(
|
|
'notification_history',
|
|
sa.Column('id', sa.Integer(), primary_key=True, autoincrement=True),
|
|
sa.Column('signal_id', sa.Integer(), sa.ForeignKey('signals.id'), nullable=False),
|
|
sa.Column('channel_type', sa.Enum('discord', 'telegram', name='channeltype', create_type=False), nullable=False),
|
|
sa.Column('sent_at', sa.DateTime(), server_default=sa.func.now()),
|
|
sa.Column('status', sa.Enum('sent', 'failed', name='notificationstatus'), nullable=False),
|
|
sa.Column('message', sa.Text(), nullable=True),
|
|
sa.Column('error_message', sa.Text(), nullable=True),
|
|
)
|
|
op.create_index('ix_notification_history_id', 'notification_history', ['id'])
|
|
op.create_index('ix_notification_history_signal_id', 'notification_history', ['signal_id'])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index('ix_notification_history_signal_id', table_name='notification_history')
|
|
op.drop_index('ix_notification_history_id', table_name='notification_history')
|
|
op.drop_table('notification_history')
|
|
|
|
op.drop_index('ix_notification_settings_user_id', table_name='notification_settings')
|
|
op.drop_index('ix_notification_settings_id', table_name='notification_settings')
|
|
op.drop_table('notification_settings')
|
|
|
|
sa.Enum(name='notificationstatus').drop(op.get_bind(), checkfirst=True)
|
|
sa.Enum(name='channeltype').drop(op.get_bind(), checkfirst=True)
|