You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

41 lines
1.3 KiB

-- todo: Decimal is had to deserialize as number so we use text
create table if not exists orders
(
id integer primary key autoincrement,
uuid text unique not null,
trading_pair text not null,
position text not null,
initial_price text not null,
min_quantity text not null,
max_quantity text not null,
leverage integer not null,
liquidation_price text not null,
creation_timestamp text not null,
term text not null,
origin text not null,
oracle_event_id text not null
);
create unique index if not exists orders_uuid
on orders (uuid);
create table if not exists cfds
(
id integer primary key autoincrement,
order_id integer unique not null,
order_uuid text unique not null,
quantity_usd text not null,
foreign key (order_id) references orders (id)
);
create unique index if not exists cfd_order_uuid
on cfds (order_uuid);
create table if not exists cfd_states
(
id integer primary key autoincrement,
cfd_id integer not null,
state text not null,
foreign key (cfd_id) references cfds (id)
);