sriniflow playing around events
Updated 2022-11-16Copy 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 date_trunc('day', timestamp) as "day", token_contract, avg(price_usd) as "price_usd"
-- from flow.core.fact_prices
-- where timestamp >= '2022-11-01'
-- group by 1, 2
-- ),
-- fungible_token_transfers as (
-- select tf."day", tf.tx_id, tf.token_contract, tf."token_amount",
-- case
-- when tf.token_contract = 'A.ead892083b3e2c6c.DapperUtilityCoin' then 1
-- else pr."price_usd"
-- end as "price_usd"
-- from (
-- select date_trunc('day', block_timestamp) as "day", tx_id, token_contract, sum(amount) as "token_amount"
-- from flow.core.ez_token_transfers
-- WHERE block_timestamp >= '2022-11-01'
-- and tx_succeeded = TRUE
-- group by 1, 2, 3
-- union all
-- select date_trunc('day', block_timestamp) as "day", tx_id, currency as "token_contract", sum(price) as "token_amount"
-- from flow.core.ez_nft_sales
-- where block_timestamp >= '2022-11-01'
-- and tx_succeeded = TRUE
-- group by 1, 2, 3
-- ) tf
-- left join prices pr
-- on tf.token_contract = pr.token_contract and tf."day" = pr."day"
-- ),
with events AS (
SELECT *
FROM FLOW.CORE.FACT_EVENTS
WHERE block_timestamp > '2022-11-13'
),
Run a query to Download Data