16 lines
408 B
SQL
16 lines
408 B
SQL
CREATE TABLE trades (
|
|
id SERIAL PRIMARY KEY,
|
|
trade_id integer NOT NULL,
|
|
product CHAR(6) NOT NULL,
|
|
price NUMERIC(1000, 8) NOT NULL,
|
|
size NUMERIC(1000, 8) NOT NULL,
|
|
buy BOOLEAN NOT NULL DEFAULT FALSE,
|
|
sell BOOLEAN NOT NULL DEFAULT FALSE,
|
|
timestamp TIMESTAMPTZ NOT NULL);
|
|
|
|
CREATE UNIQUE INDEX product_trade_id_index ON trades (
|
|
product,
|
|
trade_id);
|
|
|
|
CREATE INDEX timestamp_index ON trades (timestamp);
|