Account for fractional outcome sets from split through redemption

This commit is contained in:
2026-12-03 06:53:37 +08:00
parent 7b26767a97
commit 2c4179a64e
17 changed files with 492 additions and 108 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
WITH balances AS (
SELECT market,outcome,available,reserved,available+reserved AS size,phase,payout_per_share
FROM position_sizes WHERE account=?1 AND (?2 IS NULL OR market=?2)
FROM position_units WHERE account=?1 AND (?2 IS NULL OR market=?2)
), holdings AS (
SELECT b.*,
CASE WHEN b.phase<>'resolved' THEN MIN(b.size,COALESCE(other.size,0)) ELSE 0 END AS pairs,