messariTHORChain TVL Breakdown
Updated 2025-01-06
999
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
28
29
30
31
32
33
34
35
36
›
⌄
WITH total_value_pooled AS (
SELECT
day,
total_value_pooled,
total_value_pooled_usd
FROM thorchain.defi.fact_daily_tvl
ORDER BY day DESC
),
-- Synths
daily_synth_depth AS (
SELECT
to_date(block_timestamp) as day,
pool_name AS asset,
avg(POWER(10,-8) * synth_e8) AS cumulative_depth
FROM thorchain.defi.fact_block_pool_depths
WHERE pool_name LIKE '%.%' AND synth_e8 <> 0
GROUP BY day, asset
),
synth_change AS (
SELECT *, cumulative_depth - coalesce(lag(cumulative_depth) over (order by asset, day), 0) as asset_change
FROM daily_synth_depth
),
synth_prices AS (
SELECT
to_date(block_timestamp) as day,
avg(asset_usd) as asset_usd,
pool_name as asset
FROM thorchain.price.fact_prices
GROUP BY day, asset
ORDER BY day DESC
),
synth_joined AS (
SELECT
a.day,
a.asset,
a.asset_change,
QueryRunArchived: QueryRun has been archived