MasiDaily Swap to selected tokens
Updated 2023-05-15
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 tb1 as ( select trunc(block_timestamp,'day') as day,
tx_id,
swapper,
b.symbol as symbol_in,
'Bonk' as symbol_out,
swap_to_amount
from solana.core.fact_swaps a join solana.core.dim_tokens b on a.swap_from_mint = b.token_address
where swap_to_mint = 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263')
,
tb2 as ( select trunc(block_timestamp,'day') as day,
tx_hash as tx_id,
origin_from_address as swapper,
symbol_in,
symbol_out,
amount_out_usd
from ethereum.core.ez_dex_swaps
where symbol_out in ('PEPE','CHAD','SHIB','WOJAK','BOB','TURBO','FLOKI')
)
,
tb3 as ( select trunc(RECORDED_HOUR,'day') as day,
avg(close) as avg_price
from solana.core.ez_token_prices_hourly
where symbol = 'bonk'
group by 1)
,
tb4 as ( select a.day,
tx_id,
swapper,
symbol_in,
symbol_out,
swap_to_amount*avg_price as amount_out_usd
from tb1 a join tb3 b on a.day = b.day)
,
tb5 as ( select *
from tb2
UNION
Run a query to Download Data