Expose aggregated binary order book depth per outcome
This commit is contained in:
@@ -73,3 +73,11 @@ CREATE VIEW IF NOT EXISTS outcome_trade_prices AS
|
||||
SELECT fill,market,outcome,at_ms,price_micros,quantity FROM trade_prices
|
||||
UNION ALL SELECT seq,market,'YES',at_ms,yes_price*10000,quantity FROM paired_fills
|
||||
UNION ALL SELECT seq,market,'NO',at_ms,(100-yes_price)*10000,quantity FROM paired_fills;
|
||||
|
||||
-- Each live binary order contributes once to each outcome's depth.
|
||||
CREATE VIEW IF NOT EXISTS visible_orders AS
|
||||
SELECT market,outcome,side,price,remaining FROM orders WHERE status='live'
|
||||
UNION ALL
|
||||
SELECT market,CASE outcome WHEN 'YES' THEN 'NO' ELSE 'YES' END,
|
||||
CASE side WHEN 'buy' THEN 'sell' ELSE 'buy' END,100-price,remaining
|
||||
FROM orders WHERE status='live';
|
||||
|
||||
Reference in New Issue
Block a user