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.2 KiB
41 lines
1.2 KiB
3 years ago
|
-- todo: Decimal is had to deserialize as number so we use text
|
||
3 years ago
|
create table if not exists orders
|
||
3 years ago
|
(
|
||
|
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,
|
||
3 years ago
|
term text not null,
|
||
|
origin text not null
|
||
3 years ago
|
);
|
||
|
|
||
3 years ago
|
create unique index if not exists orders_uuid
|
||
|
on orders (uuid);
|
||
3 years ago
|
|
||
|
create table if not exists cfds
|
||
|
(
|
||
|
id integer primary key autoincrement,
|
||
3 years ago
|
order_id integer unique not null,
|
||
|
order_uuid text unique not null,
|
||
3 years ago
|
quantity_usd text not null,
|
||
|
|
||
3 years ago
|
foreign key (order_id) references orders (id)
|
||
3 years ago
|
);
|
||
|
|
||
3 years ago
|
create unique index if not exists cfd_order_uuid
|
||
|
on cfds (order_uuid);
|
||
3 years ago
|
|
||
|
create table if not exists cfd_states
|
||
|
(
|
||
3 years ago
|
id integer primary key autoincrement,
|
||
|
cfd_id integer not null,
|
||
|
state text not null,
|
||
3 years ago
|
foreign key (cfd_id) references cfds (id)
|
||
|
);
|