Files
ai-exchange/migrations/014_create_bias_snapshots.sql
T
2026-04-24 13:39:01 +08:00

24 lines
861 B
SQL

create table if not exists bias_snapshots (
id bigserial primary key,
instrument_id bigint not null references instruments(id),
bias_tf text not null,
setup_tf text not null,
trigger_tf text not null,
snapshot_ts timestamptz not null,
daily_bias text not null,
confidence numeric(8,4),
execution_intensity text not null,
narrative_code text,
draw_side text,
range_id bigint references dealing_ranges(id),
reason_codes jsonb not null default '[]'::jsonb,
meta jsonb not null default '{}'::jsonb,
created_at timestamptz not null default now()
);
create index if not exists idx_bias_snapshots_instr_snapshot_desc
on bias_snapshots (instrument_id, snapshot_ts desc);
create index if not exists idx_bias_snapshots_instr_bias_snapshot_desc
on bias_snapshots (instrument_id, daily_bias, snapshot_ts desc);