SandeshUntitled Query
Updated 2022-10-12
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 stars_price as
(
select
recorded_at::date as "date",
symbol as stars_symbol,
avg(price) as stars_price,
avg(volume_24h) as stars_volume
from osmosis.core.dim_prices
where 1=1
and symbol='STARS'
and recorded_at > '2022-09-12'
group by "date",stars_symbol
),
swaps_from_stars as
(
select
fs.*,
'STARS' as from_currency,
coalesce(dl.project_name,fs.to_currency) as to_symbol,
p.stars_price*fs.from_amount/1e6 as usd
from
osmosis.core.fact_swaps fs
left join
osmosis.core.dim_labels dl
on fs.to_currency=dl.address
left join
stars_price p
on fs.block_timestamp::date=p."date"
where
1=1
and fs.from_currency='ibc/987C17B11ABC2B20019178ACE62929FE9840202CE79498E29FE8E5CB02B7C0A4'
and fs.block_timestamp > '2022-09-26'
and fs.tx_status='SUCCEEDED'
),
swaps_to_stars as
Run a query to Download Data