Afonso_Diaz2023-05-24 11:20 PM
Updated 2023-05-24
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
t1 as (
select
recorded_at::date as date,
currency,
symbol,
avg(price) as price_usd
from osmosis.core.dim_prices
where currency in (
'ibc/10E5E5B06D78FFBB61FD9F89209DEE5FD4446ED0550CBB8E3747DA79E10D9DC6',
'ibc/6F62F01D913E3FFE472A38C78235B8F021B511BC6596ADFF02615C8F83D3B373'
)
group by 1, 2, 3
),
t2 as (
select
tx_id,
block_timestamp::date as day,
'ARB' as symbol,
trader,
(from_amount/1e18) * price_usd as amount_usd,
datediff(d, '2023-05-14', block_timestamp::date) + 1 as day_number
from osmosis.core.fact_swaps a
join t1 on block_timestamp::date = date and t1.currency = a.from_currency
where tx_succeeded = 1
and from_currency = 'ibc/10E5E5B06D78FFBB61FD9F89209DEE5FD4446ED0550CBB8E3747DA79E10D9DC6' --$ARB
and day_number > 0 and day_number <= 7
union all
select
tx_id,
block_timestamp::date as day,
'ARB' as symbol,
Run a query to Download Data