MultipartiteDerived Asset pools' cumulative liquidity fees in RUNE
Updated 2024-04-03
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
›
⌄
⌄
WITH
grouped AS (
SELECT DATE_trunc('minute', block_timestamp) AS time,
SUM(liq_fee_in_rune_e8) AS grouped_liq_fee_in_rune_e8,
FROM thorchain.defi.fact_swaps_events
WHERE pool_name LIKE 'THOR.%'
GROUP BY time
)
SELECT time,
SUM(grouped_liq_fee_in_rune_e8) OVER(ORDER BY time ASC) / 1e8 AS cumulative_derived_asset_pools_liq_fee_in_rune
FROM grouped
ORDER BY time DESC
-- Previous query deprecated as taking too long to run.
/*
SELECT DATE_trunc('minute', reftable.block_timestamp) AS time,
block_id, pool_name, liq_fee_in_rune_e8 / 1e8 AS liq_fee_in_rune,
SUM(liq_fee_in_rune_e8) OVER(ORDER BY event_id ASC) / 1e8 AS cumulative_liq_fee_in_rune,
tx_id
FROM (thorchain.defi.fact_swaps_events AS reftable INNER JOIN thorchain.core.dim_block
ON reftable.dim_block_id = dim_block.dim_block_id)
WHERE pool_name LIKE 'THOR.%'
QUALIFY liq_fee_in_rune_e8 = MAX(liq_fee_in_rune_e8) OVER(PARTITION BY time)
ORDER BY event_id DESC
*/
Auto-refreshes every 24 hours
QueryRunArchived: QueryRun has been archived