forked from c9s/bbgo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
65 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
-- +up | ||
CREATE TABLE `trades` ( | ||
`gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, | ||
CREATE TABLE `trades` | ||
( | ||
`gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, | ||
|
||
`id` BIGINT UNSIGNED, | ||
`exchange` VARCHAR(24) NOT NULL DEFAULT '', | ||
`symbol` VARCHAR(8) NOT NULL, | ||
`price` DECIMAL(16, 8) UNSIGNED NOT NULL, | ||
`quantity` DECIMAL(16, 8) UNSIGNED NOT NULL, | ||
`quote_quantity` DECIMAL(16, 8) UNSIGNED NOT NULL, | ||
`fee` DECIMAL(16, 8) UNSIGNED NOT NULL, | ||
`fee_currency` VARCHAR(4) NOT NULL, | ||
`is_buyer` BOOLEAN NOT NULL DEFAULT FALSE, | ||
`is_maker` BOOLEAN NOT NULL DEFAULT FALSE, | ||
`side` VARCHAR(4) NOT NULL DEFAULT '', | ||
`traded_at` DATETIME(3) NOT NULL, | ||
`id` BIGINT UNSIGNED, | ||
`exchange` VARCHAR(24) NOT NULL DEFAULT '', | ||
`symbol` VARCHAR(8) NOT NULL, | ||
`price` DECIMAL(16, 8) UNSIGNED NOT NULL, | ||
`quantity` DECIMAL(16, 8) UNSIGNED NOT NULL, | ||
`quote_quantity` DECIMAL(16, 8) UNSIGNED NOT NULL, | ||
`fee` DECIMAL(16, 8) UNSIGNED NOT NULL, | ||
`fee_currency` VARCHAR(4) NOT NULL, | ||
`is_buyer` BOOLEAN NOT NULL DEFAULT FALSE, | ||
`is_maker` BOOLEAN NOT NULL DEFAULT FALSE, | ||
`side` VARCHAR(4) NOT NULL DEFAULT '', | ||
`traded_at` DATETIME(3) NOT NULL, | ||
|
||
PRIMARY KEY (`gid`), | ||
UNIQUE KEY `id` (`id`) | ||
|
||
) ENGINE=InnoDB; | ||
-- +goose Down | ||
PRIMARY KEY (`gid`), | ||
UNIQUE KEY `id` (`id`) | ||
); | ||
-- +down | ||
DROP TABLE `trades`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
-- +goose Up | ||
-- +up | ||
CREATE INDEX trades_symbol ON trades(symbol); | ||
CREATE INDEX trades_symbol_fee_currency ON trades(symbol, fee_currency, traded_at); | ||
CREATE INDEX trades_traded_at_symbol ON trades(traded_at, symbol); | ||
|
||
-- +goose Down | ||
-- +down | ||
DROP INDEX trades_symbol ON trades; | ||
DROP INDEX trades_symbol_fee_currency ON trades; | ||
DROP INDEX trades_traded_at_symbol ON trades; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
-- +goose Up | ||
-- +up | ||
ALTER TABLE `trades` | ||
ADD COLUMN `order_id` BIGINT UNSIGNED NOT NULL; | ||
|
||
-- +goose Down | ||
-- +down | ||
ALTER TABLE `trades` | ||
DROP COLUMN `order_id`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
-- +goose Up | ||
-- +up | ||
CREATE INDEX orders_symbol ON orders (exchange, symbol); | ||
CREATE UNIQUE INDEX orders_order_id ON orders (order_id, exchange); | ||
|
||
-- +goose Down | ||
-- +down | ||
DROP INDEX orders_symbol ON orders; | ||
DROP INDEX orders_order_id ON orders; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
-- +goose Up | ||
-- +up | ||
ALTER TABLE trades MODIFY COLUMN symbol VARCHAR(9); | ||
ALTER TABLE orders MODIFY COLUMN symbol VARCHAR(9); | ||
|
||
-- +goose Down | ||
-- +down | ||
ALTER TABLE trades MODIFY COLUMN symbol VARCHAR(8); | ||
ALTER TABLE orders MODIFY COLUMN symbol VARCHAR(8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters