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
@@ -8,7 +8,7 @@ WITH candidates AS (
WHERE a.role IS NULL OR a.role<>'placeholder'
), balances AS (
SELECT s.id,p.outcome,SUM(p.available+p.reserved) AS shares,p.payout_per_share
FROM selected s CROSS JOIN position_sizes p ON p.market=s.id
FROM selected s CROSS JOIN position_units p ON p.market=s.id
GROUP BY s.id,p.outcome,p.payout_per_share
)
SELECT s.id,s.phase,b.outcome,b.shares,b.payout_per_share