17 lines
670 B
SQL
17 lines
670 B
SQL
CREATE TABLE IF NOT EXISTS option_orders (
|
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
user_id INT NOT NULL,
|
|
symbol VARCHAR(20) NOT NULL,
|
|
amount DECIMAL(18, 8) NOT NULL,
|
|
direction ENUM('up', 'down') NOT NULL,
|
|
duration INT NOT NULL, -- in seconds (60, 90, 120, 180, 300)
|
|
profit_rate DECIMAL(5, 2) NOT NULL, -- e.g. 0.08 for 8%
|
|
opening_price DECIMAL(18, 8) NOT NULL,
|
|
closing_price DECIMAL(18, 8) DEFAULT NULL,
|
|
status ENUM('pending', 'completed') DEFAULT 'pending',
|
|
result ENUM('none', 'win', 'loss') DEFAULT 'none',
|
|
profit DECIMAL(18, 8) DEFAULT 0,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
settle_at TIMESTAMP NULL
|
|
);
|