ArioGas Guzzlers - Osmo - 1
Updated 2022-11-16Copy Reference Fork
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
›
⌄
with price as (
select
date_trunc('day', recorded_at) as date,
avg (price) as Osmo_price
from osmosis.core.dim_prices
where symbol = 'OSMO'
group by 1
),
gas as (
select
BLOCK_TIMESTAMP::date as date,
TX_ID,
((split(fee,'uosmo')[0]::numeric)/pow(10,6)) * Osmo_price as Gas_USD,
Osmo_price
from osmosis.core.fact_transactions a join price b on a.BLOCK_TIMESTAMP::date = b.date
where 1=1
and TX_STATUS = 'SUCCEEDED'
and BLOCK_TIMESTAMP >= CURRENT_DATE - 30
and BLOCK_TIMESTAMP < CURRENT_DATE
and fee ilike '%uosmo%'
)
select
date,
count(distinct TX_ID) as "# TXs",
sum(Gas_USD) as "Gas Amount-USD",
sum("Gas Amount-USD") over(order by date) as "Total Amount USD of Gas",
percentile_cont(0.1) within group(order by Gas_USD) as "%10",
percentile_cont(0.5) within group(order by Gas_USD) as "%50",
percentile_cont(0.9) within group(order by Gas_USD) as "%90",
avg(Gas_USD) as "AVG Gas Amount-USD",
avg(Osmo_price) as Osmo_price
from gas
group by 1
order by date asc
Run a query to Download Data