Cancel outstanding orders when their trading key misses its heartbeat

This commit is contained in:
2026-12-03 05:57:49 +08:00
parent d01ab8f15c
commit 2306c6fd96
14 changed files with 296 additions and 9 deletions
+10
View File
@@ -245,3 +245,13 @@ CREATE TABLE IF NOT EXISTS execution_fees (
taker_order INTEGER NOT NULL REFERENCES orders(seq), fee_micros INTEGER NOT NULL CHECK(fee_micros>0)
);
CREATE INDEX IF NOT EXISTS fees_by_order ON execution_fees(taker_order);
CREATE TABLE IF NOT EXISTS order_keys (
order_seq INTEGER PRIMARY KEY REFERENCES orders(seq), key_id TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS order_heartbeats (
account TEXT NOT NULL REFERENCES accounts(id), key_id TEXT NOT NULL,
heartbeat_id TEXT NOT NULL, deadline_ms INTEGER NOT NULL,
PRIMARY KEY(account,key_id)
);
CREATE INDEX IF NOT EXISTS heartbeat_deadlines ON order_heartbeats(deadline_ms);