Add options index target monitors that auto limit-close on hit.
Position and order forms can arm a target; right-side and hub panels show active monitors; expiry remains the stop with no separate SL. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -68,3 +68,28 @@ def init_options_tables(conn: sqlite3.Connection) -> None:
|
||||
)
|
||||
"""
|
||||
)
|
||||
conn.execute(
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS options_target_monitors (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
inst_id TEXT NOT NULL,
|
||||
underlying TEXT,
|
||||
opt_type TEXT,
|
||||
target_index REAL NOT NULL,
|
||||
trade_id INTEGER,
|
||||
sheets INTEGER,
|
||||
status TEXT DEFAULT 'active',
|
||||
trigger_idx REAL,
|
||||
close_ord_id TEXT,
|
||||
message TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
triggered_at TIMESTAMP
|
||||
)
|
||||
"""
|
||||
)
|
||||
conn.execute(
|
||||
"""
|
||||
CREATE INDEX IF NOT EXISTS idx_options_target_monitors_status
|
||||
ON options_target_monitors(status)
|
||||
"""
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user