2021-01-15 02:31:37 +00:00
|
|
|
-- +up
|
2020-11-06 03:58:29 +00:00
|
|
|
CREATE TABLE `klines`
|
|
|
|
(
|
|
|
|
`gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
2020-11-08 04:13:34 +00:00
|
|
|
`exchange` VARCHAR(10) NOT NULL,
|
2020-11-06 03:58:29 +00:00
|
|
|
`start_time` DATETIME(3) NOT NULL,
|
|
|
|
`end_time` DATETIME(3) NOT NULL,
|
|
|
|
`interval` VARCHAR(3) NOT NULL,
|
2022-03-11 05:57:21 +00:00
|
|
|
`symbol` VARCHAR(20) NOT NULL,
|
2020-11-06 03:58:29 +00:00
|
|
|
`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 NOT NULL DEFAULT 0.0,
|
|
|
|
`volume` DECIMAL(16, 8) UNSIGNED NOT NULL DEFAULT 0.0,
|
|
|
|
`closed` BOOL NOT NULL DEFAULT TRUE,
|
2020-11-06 16:49:17 +00:00
|
|
|
`last_trade_id` INT UNSIGNED NOT NULL DEFAULT 0,
|
|
|
|
`num_trades` INT UNSIGNED NOT NULL DEFAULT 0,
|
2020-11-06 03:58:29 +00:00
|
|
|
|
|
|
|
PRIMARY KEY (`gid`)
|
|
|
|
|
2021-01-15 02:31:37 +00:00
|
|
|
);
|
2020-11-06 03:58:29 +00:00
|
|
|
|
2020-11-06 13:40:48 +00:00
|
|
|
CREATE INDEX `klines_end_time_symbol_interval` ON klines (`end_time`, `symbol`, `interval`);
|
2020-11-06 03:58:29 +00:00
|
|
|
CREATE TABLE `okex_klines` LIKE `klines`;
|
|
|
|
CREATE TABLE `binance_klines` LIKE `klines`;
|
|
|
|
CREATE TABLE `max_klines` LIKE `klines`;
|
|
|
|
|
2021-01-15 02:31:37 +00:00
|
|
|
-- +down
|
2020-11-08 04:13:34 +00:00
|
|
|
DROP INDEX `klines_end_time_symbol_interval` ON `klines`;
|
2020-11-06 03:58:29 +00:00
|
|
|
DROP TABLE `binance_klines`;
|
|
|
|
DROP TABLE `okex_klines`;
|
|
|
|
DROP TABLE `max_klines`;
|
|
|
|
DROP TABLE `klines`;
|
|
|
|
|