aster2709volume by day
Updated 2025-01-07
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 eth_price as (
select price as eth_price from blast.price.ez_prices_hourly
where token_address = '0x4300000000000000000000000000000000000004'
order by hour desc
limit 1
),
btc_price as (
select price as btc_price from ethereum.price.ez_prices_hourly
where token_address = '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599'
order by hour desc
limit 1
)
select date_trunc('day', minute) as day, amm_name, sum(volume_usd) as volume_usd from (
select case
when decoded_log['amm'] = '0x82f35795dbe3a34e7c3242826e5ac92d150c097e' then 'punks'
when decoded_log['amm'] = '0x234fd1e34c60be2ffb3b6ea8aa2387644f1e35f9' then 'ppg'
when decoded_log['amm'] = '0x80532f01ed2cc8e962251ba23d2a3f481e62a203' then 'milady'
when decoded_log['amm'] = '0xc0aa1eb6746111e9a5d2aeab6efe66a1f2358e02' then 'monke'
when decoded_log['amm'] = '0xdefcca12e39a868b9de2fddb8f281b5e4a38818c' then 'puppets'
when decoded_log['amm'] = '0x8111acc4cb1c9b9d8960107f37592144459d121b' then 'remilio'
when decoded_log['amm'] = '0xe16d67b1a744c2f3e8a46c29c4ac005590455358' then 'sproto'
when decoded_log['amm'] = '0x4c4763782260e5d05beb6d3a85a4550824bf4a71' then 'schizo'
else 'unknown'
end as amm_name,
case when contract_address = '0xffc0555ec5f5c44a6b529cef94b9055799696272' then cast(decoded_log['exchangedQuote'] as float) / 1e18 * eth_price
else cast(decoded_log['exchangedQuote'] as float) / 1e18 * btc_price
end as volume_usd,
date_trunc('minute', block_timestamp) as minute
from (
select * from blast.core.ez_decoded_event_logs
where event_name = 'PositionChanged'
and (contract_address = '0xffc0555ec5f5c44a6b529cef94b9055799696272' or contract_address = '0x0c2309c6554aabbfbca7d5219545795dcaf6f4a9')
and cast(decoded_log['tradeType'] as float) < 2) a cross join eth_price b cross join btc_price c)
group by 1,2
QueryRunArchived: QueryRun has been archived