Convert NO positions and conserve collateral across fixed negative-risk groups

This commit is contained in:
2026-12-03 04:41:35 +08:00
parent dd3e563a48
commit b2b7fc4610
12 changed files with 329 additions and 5 deletions
+11
View File
@@ -189,3 +189,14 @@ CREATE TABLE IF NOT EXISTS budget_buys (
amount_cents INTEGER NOT NULL CHECK(amount_cents>0),
spent_cents INTEGER NOT NULL CHECK(spent_cents BETWEEN 0 AND amount_cents)
);
-- Each conversion adds an equal YES-minus-NO supply to every member.
-- This reserve covers that excess at the single winning member.
CREATE TABLE IF NOT EXISTS neg_risk_groups (
id TEXT PRIMARY KEY, reserve_cents INTEGER NOT NULL DEFAULT 0 CHECK(reserve_cents>=0),
winner TEXT REFERENCES markets
);
CREATE TABLE IF NOT EXISTS neg_risk_members (
market TEXT PRIMARY KEY REFERENCES markets, group_id TEXT NOT NULL REFERENCES neg_risk_groups,
ordinal INTEGER NOT NULL, UNIQUE(group_id,ordinal)
);