Moe1 FUNG
Updated 2023-05-19Copy 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 prices as (
select
RECORDED_HOUR::date date,
-- ID TOKEN_CONTRACT,
TOKEN,
avg(CLOSE) as price
from
flow.core.fact_hourly_prices
where
date >= CURRENT_DATE - {{days_back}}
group by
1,
2
)
,
mid as (
select
* ,
case
when TOKEN_CONTRACT ilike '%REVV%' then 'Revv'
when TOKEN_CONTRACT ilike '%Starly%' then 'Starly'
when TOKEN_CONTRACT ilike '%Sportium%' then 'Sportium'
when TOKEN_CONTRACT ilike '%40a61.FlowToken%' then 'Flow'
when TOKEN_CONTRACT ilike '%TeleportedTetherToken%' then 'USDT'
when TOKEN_CONTRACT ilike '%FiatToken%' then 'USDC'
when TOKEN_CONTRACT ilike '%FUSD%' then 'FUSD'
when TOKEN_CONTRACT ilike '%Blocto%' then 'Blocto'
end as token from flow.core.ez_bridge_transactions
)
select
date_trunc(week,BLOCK_TIMESTAMP)::date weeks ,
b.token ,
count(distinct TX_ID) as bridge_count,
sum(bridge_count)over(partition by b.token order by weeks rows between unbounded preceding and current row ) as cumulative_bridge_count,
Run a query to Download Data