diff --git a/.gitignore b/.gitignore index d36fd8d9c..c0c1ccacf 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,5 @@ /config/bbgo.yaml /pkg/server/assets.go + +bbgo.sqlite3 diff --git a/migrations/mysql/20211211020303_add_ftx_kline.sql b/migrations/mysql/20211211020303_add_ftx_kline.sql new file mode 100644 index 000000000..21827730e --- /dev/null +++ b/migrations/mysql/20211211020303_add_ftx_kline.sql @@ -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 diff --git a/migrations/sqlite3/20211211020303_add_ftx_kline.sql b/migrations/sqlite3/20211211020303_add_ftx_kline.sql new file mode 100644 index 000000000..83da4ff73 --- /dev/null +++ b/migrations/sqlite3/20211211020303_add_ftx_kline.sql @@ -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