Expose account executions with original order, role and fill economics

This commit is contained in:
2026-12-03 04:12:22 +08:00
parent 5cbbdcbe64
commit 66f42f7b7f
11 changed files with 221 additions and 12 deletions
+11
View File
@@ -93,3 +93,14 @@ CREATE TRIGGER IF NOT EXISTS finish_deadline AFTER UPDATE OF status ON orders
WHEN OLD.status='live' AND NEW.status<>'live' BEGIN
UPDATE order_deadlines SET pending=0 WHERE seq=NEW.seq;
END;
-- A present row with no taker records an opening auction. Older executions
-- have no row and retain an unknown role.
CREATE TABLE IF NOT EXISTS execution_context (
execution INTEGER PRIMARY KEY, taker_order INTEGER REFERENCES orders(seq)
);
CREATE INDEX IF NOT EXISTS account_orders_history ON orders(account,seq);
CREATE INDEX IF NOT EXISTS fills_by_bid ON fills(bid,seq);
CREATE INDEX IF NOT EXISTS fills_by_ask ON fills(ask,seq);
CREATE INDEX IF NOT EXISTS paired_by_yes ON paired_fills(yes_order,seq);
CREATE INDEX IF NOT EXISTS paired_by_no ON paired_fills(no_order,seq);