exchange:

backtest: add ftx kline table
This commit is contained in:
TonyQ 2021-12-11 02:11:01 +08:00
parent b71d0f5b6e
commit 5fb50fa2cb
3 changed files with 65 additions and 0 deletions

2
.gitignore vendored
View File

@ -32,3 +32,5 @@
/config/bbgo.yaml /config/bbgo.yaml
/pkg/server/assets.go /pkg/server/assets.go
bbgo.sqlite3

View File

@ -0,0 +1,33 @@
-- +up
-- +begin
create table if not exists ftx_klines
(
gid bigint unsigned auto_increment
primary key,
exchange varchar(10) not null,
start_time datetime(3) not null,
end_time datetime(3) not null,
`interval` varchar(3) not null,
symbol varchar(12) not null,
open decimal(16,8) unsigned not null,
high decimal(16,8) unsigned not null,
low decimal(16,8) unsigned not null,
close decimal(16,8) unsigned default 0.00000000 not null,
volume decimal(20,8) unsigned default 0.00000000 not null,
closed tinyint(1) default 1 not null,
last_trade_id int unsigned default '0' not null,
num_trades int unsigned default '0' not null,
quote_volume decimal(32,4) default 0.0000 not null,
taker_buy_base_volume decimal(32,8) not null,
taker_buy_quote_volume decimal(32,4) default 0.0000 not null
);
-- +end
-- +begin
create index klines_end_time_symbol_interval
on ftx_klines (end_time, symbol, `interval`);
-- +end
-- +down
-- +begin
drop table ftx_klines;
-- +end

View File

@ -0,0 +1,30 @@
-- +up
-- +begin
CREATE TABLE `ftx_klines`
(
`gid` INTEGER PRIMARY KEY AUTOINCREMENT,
`exchange` VARCHAR(10) NOT NULL,
`start_time` DATETIME(3) NOT NULL,
`end_time` DATETIME(3) NOT NULL,
`interval` VARCHAR(3) NOT NULL,
`symbol` VARCHAR(7) NOT NULL,
`open` DECIMAL(16, 8) NOT NULL,
`high` DECIMAL(16, 8) NOT NULL,
`low` DECIMAL(16, 8) NOT NULL,
`close` DECIMAL(16, 8) NOT NULL DEFAULT 0.0,
`volume` DECIMAL(16, 8) NOT NULL DEFAULT 0.0,
`closed` BOOLEAN NOT NULL DEFAULT TRUE,
`last_trade_id` INT NOT NULL DEFAULT 0,
`num_trades` INT NOT NULL DEFAULT 0,
`quote_volume` DECIMAL NOT NULL DEFAULT 0.0,
`taker_buy_base_volume` DECIMAL NOT NULL DEFAULT 0.0,
`taker_buy_quote_volume` DECIMAL NOT NULL DEFAULT 0.0
);
-- +end
-- +down
-- +begin
drop table ftx_klines;
-- +end