SleepyBN stats
Updated 2023-05-21Copy Reference Fork
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 prep as(
select date_trunc('day', block_timestamp) day,
trader,
tx_id,
token_in_contract,
token_in_amount
from flow.core.ez_swaps
where day >= current_date - {{days_back}}
),
prices as(
select
date_trunc('day', recorded_hour) day,
id,
token,
avg(close) price
from flow.core.fact_hourly_prices
where recorded_hour::date >=
(select min(block_timestamp::date) from flow.core.ez_swaps)
group by day, id, token
),
swapper_first_activity as(
select trader,
min(block_timestamp::date) first_action_day
from flow.core.ez_swaps
group by trader
),
daily_new_swappers as(
select first_action_day day,
count(trader) new_swappers
from swapper_first_activity
group by day
order by day
),
daily_prep as(
select
prep.day,
Run a query to Download Data