MLDZMNelx2
Updated 2023-07-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 time as (
select
case
when '{{Period}}' = 'Last 24 Hours' then 1
when '{{Period}}' = 'Last 7 Days' then 7
when '{{Period}}' = 'Last 30 Days' then 30
when '{{Period}}' = 'All Time' then 500
else 30
end as time_gp
),
price AS (
select
RECORDED_HOUR::date as day,
avg(close) as price_token
from solana.core.ez_token_prices_hourly
where SYMBOL = 'sol'
group by 1),
tb1 as (select
distinct tx_id
from solana.core.fact_events
where PROGRAM_ID='E1XRkj9fPF2NQUdoq41AHPqwMDHykYfn5PzBXAyDs7Be'
and BLOCK_TIMESTAMP>=current_date- (select time_gp from time)
and succeeded='TRUE'
),
tb2 as (select
BLOCK_TIMESTAMP,
s.tx_id,
signers[0] as trader,
pre_balances[0]/1e9 - post_balances[0]/1e9 as trade_volume,
abs(trade_volume) as volume_sol,
abs(trade_volume*price_token) as volume_usd
from solana.core.fact_transactions s
Run a query to Download Data