MasiPairs
Updated 2024-08-01
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
›
⌄
with tb1 as ( select recorded_hour::date as date,
symbol,
currency,
avg(PRICE) as avg_pirce
from osmosis.price.ez_prices
group by 1,2,3)
,
tb2 as (select block_timestamp::date as day,
tx_id,
trader,
from_amount/pow(10,from_decimal) as from_amt,
b.symbol as from_token_name,
from_amt*b.avg_pirce as from_amt_usd,
to_amount/pow(10,to_decimal) as to_amt,
to_amt*c.avg_pirce as to_amt_usd,
c.symbol as to_token_name,
case when from_amt_usd is null then to_amt_usd else from_amt_usd end as amount_usd
from osmosis.defi.fact_swaps a left outer join tb1 b on a.from_currency = b.currency and a.block_timestamp::date = b.date
left outer join tb1 c on a.to_currency = c.currency and a.block_timestamp::date = c.date
where (b.symbol = 'AXL'
or c.symbol = 'AXL')
)
select concat(from_token_name,'->',to_token_name) as pair,
count(DISTINCT trader) as traders,
count(DISTINCT tx_id) as swaps,
sum(amount_usd) as volume
from tb2
group by 1
having pair is not null
QueryRunArchived: QueryRun has been archived