Ali3NAverage Swapped Volume Per Swapper (Traderjoe Avalanche)
Updated 2023-03-15Copy 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
27
28
29
30
31
32
33
34
35
36
›
⌄
with timetable as (
select case when '{{Time_Frame}}' = 'Last Month' then 30
when '{{Time_Frame}}' = 'Last 2 Months' then 60
when '{{Time_Frame}}' = 'Last 3 Months' then 90
when '{{Time_Frame}}' = 'Last 6 Months' then 180
when '{{Time_Frame}}' = 'Last Year' then 365
when '{{Time_Frame}}' = 'All Time' then 5000
else 5000 end as timeframe),
swaptx as (
select distinct tx_hash
from avalanche.core.ez_decoded_event_logs
where origin_to_address = lower('0x60aE616a2155Ee3d9A68541Ba4544862310933d4')
and event_name = 'Swap'
and tx_status = 'SUCCESS'),
pricet as (
select hour::date as day,
t1.symbol,
t1.address,
t1.decimals,
avg (price) as USDPrice
from avalanche.core.dim_contracts t1 join ethereum.core.fact_hourly_token_prices t2 on t1.symbol = t2.symbol
where hour >= '2021-06-29 04:40:31.000'
group by 1,2,3,4
union ALL
select hour::date as day,
t1.symbol,
t1.address,
t1.decimals,
'1' as usdprice
from avalanche.core.dim_contracts t1 join ethereum.core.fact_hourly_token_prices t2
where hour >= '2021-06-29 04:40:31.000'
and t1.symbol in ('MIM','USDC.e','USDT.e','USDt','fUSDT')
Run a query to Download Data