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

21 lines
732 B
SQL

create table if not exists instruments (
id bigserial primary key,
venue_id bigint not null references venues(id),
symbol text not null,
asset_class text not null,
base_asset text,
quote_asset text,
price_scale integer not null,
qty_scale integer not null,
tick_size numeric(20,10) not null,
lot_size numeric(20,10),
active boolean not null default true,
meta jsonb not null default '{}'::jsonb,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now(),
unique (venue_id, symbol)
);
create index if not exists idx_instruments_venue_id on instruments(venue_id);
create index if not exists idx_instruments_active on instruments(active);