samosmosis swaps table with homemade usd prices
Updated 2022-10-21Copy Reference Fork
999
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 raw_swaps as (
select
block_timestamp,
tx_id,
from_amount / pow(10, from_decimal) as from_amount_adj,
from_currency,
l.project_name as from_currency_name,
to_amount / pow(10 , to_decimal) as to_amount_adj,
to_currency,
m.project_name as to_currency_name
from osmosis.core.fact_swaps s
left join osmosis.core.dim_labels l on s.from_currency = l.address
left join osmosis.core.dim_labels m on s.from_currency = m.address
where block_timestamp >= '2022-10-01'
and tx_status = 'SUCCEEDED'
),
daily_osmo_price_raw as (
select
block_timestamp,
tx_id,
from_amount_adj,
from_currency,
from_currency_name,
to_amount_adj,
to_currency,
to_currency_name,
case when from_currency = 'uosmo' then to_amount_adj/from_amount_adj
else to_amount_adj/from_amount_adj end as osmo_daily_price_raw
Run a query to Download Data