granadohoRune Price vs Swap Volume
Updated 2022-01-23
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
28
29
30
31
32
33
34
35
36
›
⌄
with rune_price as (
select
date(block_timestamp) as date,
avg(rune_usd) as daily_average_rune_price
from thorchain.prices
group by date(block_timestamp)
order by date(block_timestamp) asc
), swap_to_rune as (
select
date(block_timestamp) as date,
sum(to_amount) as amount_of_rune
from thorchain.swaps
where to_asset = 'THOR.RUNE' and from_asset != 'THOR.RUNE'
group by date(block_timestamp)
order by date(block_timestamp) asc
), swap_from_rune as (
select
date(block_timestamp) as date,
sum(to_amount) as amount_of_rune
from thorchain.swaps
where from_asset = 'THOR.RUNE' and to_asset != 'THOR.RUNE'
group by date(block_timestamp)
order by date(block_timestamp) asc
)
SELECT
a.date,
a.daily_average_rune_price,
b.amount_of_rune as buy_volume,
c.amount_of_rune as sell_volume
FROM rune_price a
JOIN swap_to_rune b ON a.date = b.date
JOIN swap_from_rune c ON a.date = c.date
WHERE a.date >= '2021-11-01'
Run a query to Download Data