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

22 lines
878 B
SQL

create table if not exists liquidity_pools (
id bigserial primary key,
instrument_id bigint not null references instruments(id),
timeframe text not null,
side text not null,
pool_type text not null,
price_low numeric(20,10) not null,
price_high numeric(20,10) not null,
reference_ids jsonb not null default '[]'::jsonb,
status text not null default 'untouched',
created_ts timestamptz not null,
updated_ts timestamptz not null default now(),
meta jsonb not null default '{}'::jsonb,
created_at timestamptz not null default now()
);
create index if not exists idx_liquidity_pools_instr_tf_status_created_desc
on liquidity_pools (instrument_id, timeframe, status, created_ts desc);
create index if not exists idx_liquidity_pools_instr_tf_side_created_desc
on liquidity_pools (instrument_id, timeframe, side, created_ts desc);