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
›
⌄
-- forked from 09 @ https://flipsidecrypto.xyz/edit/queries/d76eeb4e-4d22-479b-9f2f-3f085d4815c6
-- forked from 02 @ https://flipsidecrypto.xyz/edit/queries/fc24708f-a4aa-4ad2-aa12-0aff848d6685
-- forked from 01 @ https://flipsidecrypto.xyz/edit/queries/e5d1d527-a362-4edb-b94c-f16a8212a9c9
--- stake = DelegatorTokensCommitted , TokensCommitted
--- unstake = DelegatorUnstakedTokensWithdrawn , UnstakedTokensWithdrawn
--- reward = DelegatorRewardTokensWithdrawn , RewardTokensWithdrawn
with
token_price AS
(
SELECT
date_trunc( 'day' , a.recorded_hour ) AS day
, avg( a.close ) AS price_usd
, a.token AS token_symbol
, a.id AS token_id
FROM
flow.core.fact_hourly_prices a
WHERE
a.token = 'Flow'
GROUP BY
1 , 3 , 4
ORDER BY
1 DESC
)
,
fees AS
(
SELECT
a.tx_id AS tx_address
, (( a.event_data:executionEffort + a.event_data:inclusionEffort ) * a.event_data:amount ) * b.price_usd AS fees
Run a query to Download Data