31ece2e99a
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
23 lines
885 B
SQL
23 lines
885 B
SQL
create table if not exists fvg_zones (
|
|
id bigserial primary key,
|
|
instrument_id bigint not null references instruments(id),
|
|
timeframe text not null,
|
|
direction text not null,
|
|
upper numeric(20,10) not null,
|
|
lower numeric(20,10) not null,
|
|
start_ts timestamptz not null,
|
|
end_ts timestamptz not null,
|
|
fill_pct numeric(8,4) not null default 0,
|
|
status text not null default 'open',
|
|
related_displacement_id bigint references displacement_events(id),
|
|
meta jsonb not null default '{}'::jsonb,
|
|
created_at timestamptz not null default now(),
|
|
updated_at timestamptz not null default now()
|
|
);
|
|
|
|
create index if not exists idx_fvg_zones_instr_tf_start_desc
|
|
on fvg_zones (instrument_id, timeframe, start_ts desc);
|
|
|
|
create index if not exists idx_fvg_zones_instr_tf_status_start_desc
|
|
on fvg_zones (instrument_id, timeframe, status, start_ts desc);
|