Apply market tick changes atomically and resume their event history

This commit is contained in:
2026-12-03 06:40:56 +08:00
parent 2269752b9e
commit 53b36cce82
12 changed files with 309 additions and 2 deletions
+8
View File
@@ -265,3 +265,11 @@ CREATE TABLE IF NOT EXISTS market_tick_sizes (
market TEXT PRIMARY KEY REFERENCES markets(id),
step_micros INTEGER NOT NULL CHECK(step_micros IN (100000,10000,5000,2500,1000,100))
);
CREATE TABLE IF NOT EXISTS tick_changes (
seq INTEGER PRIMARY KEY, market TEXT NOT NULL REFERENCES market_tick_sizes(market),
at_ms INTEGER NOT NULL CHECK(at_ms>=0), old_micros INTEGER, new_micros INTEGER NOT NULL,
request_id TEXT NOT NULL REFERENCES requests(id) DEFERRABLE INITIALLY DEFERRED,
UNIQUE(market,at_ms)
);
CREATE INDEX IF NOT EXISTS tick_changes_by_seq ON tick_changes(market,seq);