pinehearstMars - DEX Swap USD Volume
Updated 2023-02-25
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
›
⌄
WITH
enriched_dex_swap AS (
SELECT
block_timestamp,
tx_id,
trader,
from_symbol,
from_amount,
from_amount * a.price as from_usd,
to_symbol,
to_amount,
to_amount * b.price as to_usd,
nvl(from_usd, to_usd) as amount_usd
FROM
osmosis.mars.ez_swaps
LEFT JOIN osmosis.core.ez_prices a ON date_trunc('hour', block_timestamp) = a.recorded_hour
AND a.currency = from_currency
LEFT JOIN osmosis.core.ez_prices b ON date_trunc('hour', block_timestamp) = b.recorded_hour
AND b.currency = to_currency
where
tx_succeeded = true
)
SELECT
date(block_timestamp) as date,
count(distinct trader) as "Traders",
count(distinct tx_Id) as "Distinct Txn Count",
sum(amount_usd) as "Volume (USD)",
sum("Volume (USD)") over (order by date) as "osmosis.mars.ez_liquidity_provider_actionsCumulative (USD)"
FROM enriched_dex_swap
GROUP BY 1
ORDER BY 1 DESC
Run a query to Download Data