maybeyonassushi_price_swap_vol
Updated 2022-02-12
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
swaps as (
select
block_timestamp,
pool_address,
pool_name,
tx_id,
amount_usd
from ethereum.dex_swaps
where platform = 'sushiswap'
and direction = 'IN'
),
hour24 as (
select
date(block_timestamp) as date,
-- pool_address,
-- pool_name,
count(tx_id) as swaps,
sum(amount_usd) as vol,
0.25*sum(amount_usd)/100 as fees
from swaps
where block_timestamp >= current_date - interval '30 days'
and amount_usd is not null
group by 1--,2
),
sushi_price as (
select
hour as date,
avg(price) as price
from ethereum.token_prices_hourly
where symbol = 'SUSHI'
and hour >= current_date - interval '30 days'
group by 1
)
select
Run a query to Download Data