summaryrefslogtreecommitdiff
path: root/shared/alembic/versions/004_add_signal_detail_columns.py
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-02 16:05:19 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2026-04-02 16:05:19 +0900
commit4747400168279c6cfc1196d86ec77b5d7b513c61 (patch)
treeff92fd87e292c39900a6fee187fbd206a22d618a /shared/alembic/versions/004_add_signal_detail_columns.py
parentc0496919e91f110aeed7bc47b24ebc3b8348ee81 (diff)
fix: add TradeRow ORM model, SignalRow missing columns, guard Event.from_dict
- Add TradeRow ORM model matching existing trades migration table - Add conviction, stop_loss, take_profit columns to SignalRow + migration 004 - Persist conviction/stop_loss/take_profit in insert_signal() - Guard Event.from_dict against malformed data with ValueError instead of KeyError
Diffstat (limited to 'shared/alembic/versions/004_add_signal_detail_columns.py')
-rw-r--r--shared/alembic/versions/004_add_signal_detail_columns.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/shared/alembic/versions/004_add_signal_detail_columns.py b/shared/alembic/versions/004_add_signal_detail_columns.py
new file mode 100644
index 0000000..7a8a77b
--- /dev/null
+++ b/shared/alembic/versions/004_add_signal_detail_columns.py
@@ -0,0 +1,23 @@
+"""Add conviction, stop_loss, take_profit columns to signals table.
+
+Revision ID: 004
+Revises: 003
+"""
+
+import sqlalchemy as sa
+from alembic import op
+
+revision = "004"
+down_revision = "003"
+
+
+def upgrade():
+ op.add_column("signals", sa.Column("conviction", sa.Float, nullable=False, server_default="1.0"))
+ op.add_column("signals", sa.Column("stop_loss", sa.Numeric, nullable=True))
+ op.add_column("signals", sa.Column("take_profit", sa.Numeric, nullable=True))
+
+
+def downgrade():
+ op.drop_column("signals", "take_profit")
+ op.drop_column("signals", "stop_loss")
+ op.drop_column("signals", "conviction")