Baselight
Sign In

Query Result

Loading...Loading chart...
1SELECT 
2    l.name,
3    MIN(l.price_adj) as ask_price,
4    MAX(o.price_adj) as bid_price,
5    MIN(l.price_adj) - MAX(o.price_adj) as spread,
6    ROUND(((MIN(l.price_adj) - MAX(o.price_adj)) / MIN(l.price_adj)) * 100, 2) as spread_percentage,
7    SPLIT_PART(l.name, '.', -1) as tld
8FROM "@blt.doma_testnet_core.listings" l
9INNER JOIN "@blt.doma_testnet_core.offers" o ON l.name = o.name
10WHERE l.expires_at > CURRENT_TIMESTAMP 
11    AND o.expires_at > CURRENT_TIMESTAMP
12    AND l.currency_symbol = o.currency_symbol
13GROUP BY l.name, tld
14HAVING MAX(o.price_adj) > 0
15    AND MIN(l.price_adj) - MAX(o.price_adj) >= 0
16ORDER BY spread_percentage ASC
17LIMIT 50

Share link

Anyone who has the link will be able to view this.