Pine AnalyticsCOQ 6
Updated 2025-02-14Copy Reference Fork
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
›
⌄
SELECT
date(block_timestamp) as date,
case when token_in LIKE lower('0x420FcA0121DC28039145009570975747295f2329') then 'sell' else 'buy' end as swap_type,
count(DISTINCT tx_hash) as swaps,
count(DISTINCT origin_from_address) as swappers,
avg(
CASE when case when token_in LIKE lower('0x420FcA0121DC28039145009570975747295f2329') then amount_out_usd else amount_in_usd end > 0
then
case when token_in LIKE lower('0x420FcA0121DC28039145009570975747295f2329') then token_in else token_out end / case when token_in LIKE lower('0x420FcA0121DC28039145009570975747295f2329') then amount_out_usd else amount_in_usd end
else NULL end
) as price,
sum(
CASE
when token_in LIKE lower('0x420FcA0121DC28039145009570975747295f2329') then token_in else token_out end
) as swap_volume,
sum(
CASE
when token_in LIKE lower('0x420FcA0121DC28039145009570975747295f2329') then amount_out_usd else amount_in_usd end
) as swap_volume_usd
FROM avalanche.defi.ez_dex_swaps
WHERE token_in LIKE lower('0x420FcA0121DC28039145009570975747295f2329')
OR token_out LIKE lower('0x420FcA0121DC28039145009570975747295f2329')
GROUP BY 1,2
Auto-refreshes every 6 hours
QueryRunArchived: QueryRun has been archived