Afonso_Diaz2023-05-27 11:51 PM
Updated 2023-05-28
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 t as (
select
recorded_hour::date as date,
currency,
symbol,
avg(price) as price_usd
from osmosis.core.ez_prices
group by 1, 2, 3
),
t2 as (
select
block_timestamp,
iff(block_timestamp::date >= '2023-05-25', 'After Listing on Coinbase', 'Before Listing on Coinbase') as timespan,
tx_id,
trader as swapper,
(from_amount / pow(10, from_decimal)) * price_usd as amount_usd
from osmosis.core.fact_swaps a
join t on date = block_timestamp::date and t.currency = a.from_currency and symbol = 'OSMO'
where tx_succeeded = 1
union all
select
block_timestamp,
iff(block_timestamp::date >= '2023-05-25', 'After Listing on Coinbase', 'Before Listing on Coinbase') as timespan,
tx_id,
trader as swapper,
(to_amount / pow(10, to_decimal)) * price_usd as amount_usd
from osmosis.core.fact_swaps a
join t on date = block_timestamp::date and t.currency = a.to_currency and symbol = 'OSMO'
where tx_succeeded = 1
),
t3 as (
select
Run a query to Download Data