Files
signal-platform/alembic/versions/009_reset_activation_gate.py
T
dennisthiessen c34f3cb1a4
Deploy / lint (push) Successful in 9s
Deploy / test (push) Successful in 46s
Deploy / deploy (push) Successful in 28s
redesign activation gate to expected value + make pipelines cron-configurable
Diagnosing "no qualified signals for 5 days": setups were generated but none
qualified. The gate required BOTH a high min_rr (2.0) AND a high
min_target_probability (60), which became contradictory after the Jun-15
probability recalibration — probability already embeds R:R via the 1/(rr+1) ruin
term, so high-R:R targets are inherently low-probability and nothing cleared both.

Gate is now expected value (R): p*rr - (1-p) from the primary target's
probability. R:R and confidence stay as floors; high-conviction / exclude-conflicts
/ min-target-probability become optional tighteners (default off). Defaults:
min_expected_value=0.15, min_rr=1.2, min_confidence=55. EV is only enforced when
computable. Migration 009 clears stored activation_* rows so the new defaults
apply. Backtest sweeps min_expected_value instead of target probability.

Scheduling: pipelines are now cron-configurable in Admin -> Jobs. daily_pipeline
(full, default 0 7 * * *) plus a new light intraday_pipeline (OHLCV + outcome eval,
default hourly US session) that keeps prices/live-R:R current without setup churn.
Fundamentals on its own early weekly cron. Timezone configurable (default
Europe/Berlin). Moving interval->CronTrigger also fixes the restart-deferral bug
where an interval job's countdown resets on every process restart.

319 backend unit tests pass; frontend tsc clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 14:46:38 +02:00

41 lines
1.4 KiB
Python

"""reset activation gate settings for the EV-based redesign
The activation gate was redesigned around expected value (R): the core test is
now ``min_expected_value`` instead of the old, self-contradicting pair of a high
``min_rr`` AND a high ``min_target_probability`` (with the post-recalibration
probability model the two could not be satisfied together, so nothing qualified).
The conviction / conflict toggles are now optional tighteners that default off.
Stored ``activation_*`` rows from the old gate no longer map cleanly onto the new
one, so they are cleared here and the redesigned code defaults take effect. Re-tune
in Admin → Activation (validated against the Track Record's backtest EV sweep).
Revision ID: 009
Revises: 008
Create Date: 2026-06-23 00:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "009"
down_revision: Union[str, None] = "008"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.execute(
sa.text("DELETE FROM system_settings WHERE key LIKE 'activation\\_%' ESCAPE '\\'")
)
def downgrade() -> None:
# One-way data reset — the old per-key values aren't recoverable. Code defaults
# apply until re-tuned, so there is nothing to restore.
pass