bbgo_origin/migrations/sqlite3/20220307132917_add_positions.sql
2022-03-14 21:21:58 +08:00

24 lines
716 B
SQL

-- +up
CREATE TABLE `positions`
(
`gid` INTEGER PRIMARY KEY AUTOINCREMENT,
`strategy` VARCHAR(32) NOT NULL,
`strategy_instance_id` VARCHAR(64) NOT NULL,
`symbol` VARCHAR(20) NOT NULL,
`quote_currency` VARCHAR(10) NOT NULL,
`base_currency` VARCHAR(10) NOT NULL,
-- average_cost is the position average cost
`average_cost` DECIMAL(16, 8) NOT NULL,
`base` DECIMAL(16, 8) NOT NULL,
`quote` DECIMAL(16, 8) NOT NULL,
`trade_id` BIGINT NOT NULL,
`traded_at` DATETIME(3) NOT NULL
);
-- +down
DROP TABLE IF EXISTS `positions`;