31ece2e99a
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
21 lines
798 B
SQL
21 lines
798 B
SQL
create table if not exists displacement_events (
|
|
id bigserial primary key,
|
|
instrument_id bigint not null references instruments(id),
|
|
timeframe text not null,
|
|
direction text not null,
|
|
start_ts timestamptz not null,
|
|
end_ts timestamptz not null,
|
|
strength_score numeric(8,4),
|
|
body_ratio numeric(8,4),
|
|
has_fvg boolean not null default false,
|
|
is_valid boolean not null default true,
|
|
meta jsonb not null default '{}'::jsonb,
|
|
created_at timestamptz not null default now()
|
|
);
|
|
|
|
create index if not exists idx_displacement_events_instr_tf_end_desc
|
|
on displacement_events (instrument_id, timeframe, end_ts desc);
|
|
|
|
create index if not exists idx_displacement_events_instr_tf_dir_end_desc
|
|
on displacement_events (instrument_id, timeframe, direction, end_ts desc);
|