mirror of
https://github.com/c9s/bbgo.git
synced 2024-09-20 08:11:08 +00:00
migrations: add margin_liquidations table
This commit is contained in:
parent
17e575df33
commit
79fbad1266
|
@ -19,8 +19,7 @@ CREATE TABLE `margin_interests`
|
|||
|
||||
`time` DATETIME(3) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`gid`),
|
||||
UNIQUE KEY (`transaction_id`)
|
||||
PRIMARY KEY (`gid`)
|
||||
);
|
||||
|
||||
-- +down
|
||||
|
|
33
migrations/mysql/20220531015005_margin_liquidations.sql
Normal file
33
migrations/mysql/20220531015005_margin_liquidations.sql
Normal file
|
@ -0,0 +1,33 @@
|
|||
-- +up
|
||||
CREATE TABLE `margin_liquidations`
|
||||
(
|
||||
`gid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
|
||||
`exchange` VARCHAR(24) NOT NULL DEFAULT '',
|
||||
|
||||
`symbol` VARCHAR(24) NOT NULL DEFAULT '',
|
||||
|
||||
`order_id` BIGINT UNSIGNED NOT NULL,
|
||||
|
||||
`is_isolated` BOOL NOT NULL DEFAULT false,
|
||||
|
||||
`average_price` DECIMAL(16, 8) UNSIGNED NOT NULL,
|
||||
|
||||
`price` DECIMAL(16, 8) UNSIGNED NOT NULL,
|
||||
|
||||
`quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,
|
||||
|
||||
`executed_quantity` DECIMAL(16, 8) UNSIGNED NOT NULL,
|
||||
|
||||
`side` VARCHAR(5) NOT NULL DEFAULT '',
|
||||
|
||||
`time_in_force` VARCHAR(5) NOT NULL DEFAULT '',
|
||||
|
||||
`updated_time` DATETIME(3) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`gid`),
|
||||
UNIQUE KEY (`order_id`, `exchange`)
|
||||
);
|
||||
|
||||
-- +down
|
||||
DROP TABLE IF EXISTS `margin_liquidations`;
|
30
migrations/sqlite3/20220531015005_margin_liquidations.sql
Normal file
30
migrations/sqlite3/20220531015005_margin_liquidations.sql
Normal file
|
@ -0,0 +1,30 @@
|
|||
-- +up
|
||||
CREATE TABLE `margin_liquidations`
|
||||
(
|
||||
`gid` INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
|
||||
`exchange` VARCHAR(24) NOT NULL DEFAULT '',
|
||||
|
||||
`symbol` VARCHAR(24) NOT NULL DEFAULT '',
|
||||
|
||||
`order_id` INTEGER NOT NULL,
|
||||
|
||||
`is_isolated` BOOL NOT NULL DEFAULT false,
|
||||
|
||||
`average_price` DECIMAL(16, 8) NOT NULL,
|
||||
|
||||
`price` DECIMAL(16, 8) NOT NULL,
|
||||
|
||||
`quantity` DECIMAL(16, 8) NOT NULL,
|
||||
|
||||
`executed_quantity` DECIMAL(16, 8) NOT NULL,
|
||||
|
||||
`side` VARCHAR(5) NOT NULL DEFAULT '',
|
||||
|
||||
`time_in_force` VARCHAR(5) NOT NULL DEFAULT '',
|
||||
|
||||
`updated_time` DATETIME(3) NOT NULL
|
||||
);
|
||||
|
||||
-- +down
|
||||
DROP TABLE IF EXISTS `margin_liquidations`;
|
|
@ -60,6 +60,7 @@ type MarginBorrowRepayService interface {
|
|||
}
|
||||
|
||||
type MarginInterest struct {
|
||||
Exchange ExchangeName `json:"exchange" db:"exchange"`
|
||||
Asset string `json:"asset" db:"asset"`
|
||||
Principle fixedpoint.Value `json:"principle" db:"principle"`
|
||||
Interest fixedpoint.Value `json:"interest" db:"interest"`
|
||||
|
@ -69,6 +70,7 @@ type MarginInterest struct {
|
|||
}
|
||||
|
||||
type MarginLoan struct {
|
||||
Exchange ExchangeName `json:"exchange" db:"exchange"`
|
||||
TransactionID uint64 `json:"transactionID" db:"transaction_id"`
|
||||
Asset string `json:"asset" db:"asset"`
|
||||
Principle fixedpoint.Value `json:"principle" db:"principle"`
|
||||
|
@ -77,6 +79,7 @@ type MarginLoan struct {
|
|||
}
|
||||
|
||||
type MarginRepay struct {
|
||||
Exchange ExchangeName `json:"exchange" db:"exchange"`
|
||||
TransactionID uint64 `json:"transactionID" db:"transaction_id"`
|
||||
Asset string `json:"asset" db:"asset"`
|
||||
Principle fixedpoint.Value `json:"principle" db:"principle"`
|
||||
|
@ -85,6 +88,7 @@ type MarginRepay struct {
|
|||
}
|
||||
|
||||
type MarginLiquidation struct {
|
||||
Exchange ExchangeName `json:"exchange" db:"exchange"`
|
||||
AveragePrice fixedpoint.Value `json:"averagePrice" db:"average_price"`
|
||||
ExecutedQuantity fixedpoint.Value `json:"executedQuantity" db:"executed_quantity"`
|
||||
OrderID uint64 `json:"orderID" db:"order_id"`
|
||||
|
|
Loading…
Reference in New Issue
Block a user