headitmanager11in
Updated 2023-01-09
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 tbl_NewUsers as
(
select count(1) ,created_date from (select PAYER as users , min(to_date(block_timestamp)) as created_date from flow.core.fact_transactions
where TX_SUCCEEDED='TRUE' and to_date(block_timestamp) > current_date - interval '90 days'
group by users)
group by created_date
)
,tbl_token_prices as
(
select avg(CLOSE) as prices , to_date(RECORDED_HOUR) as price_date from flow.core.fact_hourly_prices
where price_date > current_date - interval '90 days' and TOKEN='Flow'
group by price_date
)
,tbl_top50_nft as
(
select sum(PRICE) as sales_amount , CONTRACT_NAME from flow.core.ez_nft_sales
inner join flow.core.dim_contract_labels
on NFT_COLLECTION=EVENT_CONTRACT
where to_date(block_timestamp) > current_date - interval '90 days'
group by CONTRACT_NAME
order by sales_amount desc
limit 50
)
,tbl_top50nft_price as
(
select sum(PRICE)/count(*) as nft_price , to_date(block_timestamp) as date,CONTRACT_NAME as nft from flow.core.ez_nft_sales
inner join flow.core.dim_contract_labels
on NFT_COLLECTION=EVENT_CONTRACT
where to_date(block_timestamp) > current_date - interval '90 days' and nft in (select CONTRACT_NAME from tbl_top50_nft)
group by date,nft
)
, tbl_tokens_swap_to_flow as
(
select count(TRADER) ,sum(TOKEN_OUT_AMOUNT) , avg(TOKEN_OUT_AMOUNT) ,to_date(block_timestamp) as date
from flow.core.ez_swaps
where TOKEN_OUT_CONTRACT='A.1654653399040a61.FlowToken' and to_date(block_timestamp) > current_date - interval '90 days'
Run a query to Download Data