Afonso_Diaz2023-08-20 12:27 AM
Updated 2023-08-19
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
t1 as (
select
hour::date as date,
avg(price) as price_usd
from ethereum.core.fact_hourly_token_prices
where symbol = 'WBTC'
and date >= '2023-08-01'
group by 1
),
t2 as (
select
tx_to as user,
sum(amount) as inflow_volume_btc
from solana.core.fact_transfers
where mint = '6DNSN2BJsaPFdFFc1zP37kkeNe4Usc1Sqkzr9C9vPWcU'
and block_timestamp::date >= '2023-08-01'
group by 1
union all
select
signers[0] as user,
sum(abs(d.value:uiTokenAmount:uiAmount - c.value:uiTokenAmount:uiAmount)) as inflow_volume_btc
from solana.core.fact_events a
join solana.core.fact_transactions b
using (tx_id),
table(flatten(input => post_token_balances)) c,
table(flatten(input => pre_token_balances)) d
where a.block_timestamp::date >= '2023-08-01'
and b.block_timestamp::date >= '2023-08-01'
and program_id = '87MEvHZCXE3ML5rrmh5uX1FbShHmRXXS32xJDGbQ7h5t'
and d.value:mint = '6DNSN2BJsaPFdFFc1zP37kkeNe4Usc1Sqkzr9C9vPWcU'
and c.value:mint = '6DNSN2BJsaPFdFFc1zP37kkeNe4Usc1Sqkzr9C9vPWcU'
Run a query to Download Data