diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-02 16:05:19 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-04-02 16:05:19 +0900 |
| commit | 4747400168279c6cfc1196d86ec77b5d7b513c61 (patch) | |
| tree | ff92fd87e292c39900a6fee187fbd206a22d618a /shared/alembic/versions | |
| parent | c0496919e91f110aeed7bc47b24ebc3b8348ee81 (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')
| -rw-r--r-- | shared/alembic/versions/004_add_signal_detail_columns.py | 23 |
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") |
