Afonso_Diaz2023-05-24 07:28 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
group by 1, 2, 3
),
t2 as (
select
tx_id,
block_timestamp,
trader,
from_amount/1e18 as amount_arb,
(from_amount/1e18) * price_usd as amount_usd
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
union all
select
tx_id,
block_timestamp,
trader,
to_amount/1e18 as amount_arb,
(to_amount/1e18) * price_usd as amount_usd
from osmosis.core.fact_swaps a
join t1 on block_timestamp::date = date and t1.currency = a.to_currency
where tx_succeeded = 1
and to_currency = 'ibc/10E5E5B06D78FFBB61FD9F89209DEE5FD4446ED0550CBB8E3747DA79E10D9DC6' --$ARB
Run a query to Download Data