hessWeekly Swappers (Cell)
Updated 2024-10-26
999
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 swaps as ( select block_timestamp::date as date,
tx_hash,
platform,
swapper,
token_in,
case when token_in = '0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12' then 'CELL'
when token_in = '0x4def3d3dee27308886f0a3611dd161ce34f977a9a5de4e80b237225923492a2a::coin::T' then 'GARI' else SYMBOL_IN end as symb_in,
amount_in,
amount_in_usd,
case when token_out = '0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12' then 'CELL'
when token_out = '0x4def3d3dee27308886f0a3611dd161ce34f977a9a5de4e80b237225923492a2a::coin::T' then 'GARI' else SYMBOL_OUT end as symb_out,
token_out,
amount_out,
amount_out_usd
from aptos.defi.ez_dex_swaps
where platform = 'cellana')
,
price as ( Select trunc(TO_TIMESTAMP(value[0]::string),'day') as day,
'0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12' as tok_address,
avg(value[1]) as avg_price
from (
SELECT livequery.live.udf_api(
'https://api.coingecko.com/api/v3/coins/cellena-finance/market_chart?vs_currency=usd&days=90') as resp
)
,LATERAL FLATTEN (input => resp:data:prices)
group by all
UNION
select hour::date as day,
'0x84d7aeef42d38a5ffc3ccef853e1b82e4958659d16a7de736a29c55fbbeb0114::staked_aptos_coin::StakedAptosCoin' as tok_address,
avg(price) as avg_price
from aptos.price.ez_prices_hourly
where symbol = 'APT'
group by 1,2
UNION
select hour::date as day,
'0xd11107bdf0d6d7040c6c0bfbdecb6545191fdf13e8d8d259952f53e1713f61b5::staked_coin::StakedAptos' as tok_address,
QueryRunArchived: QueryRun has been archived