princefarzamTo KAVA
Updated 2023-12-22
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 Swaps AS (
SELECT
date_trunc('day', BLOCK_TIMESTAMP) :: date as day,
Count(DISTINCT TRADER) AS Number_of_Swappers,
Count(DISTINCT TX_ID) AS Number_of_Swaps,
Sum(TO_AMOUNT / 1e6) AS Swap_Volume_to_KAVA,
Avg(Swap_Volume_to_KAVA) over (
Order by
day
) as avg_Swap_Volume_to_KAVA
FROM
osmosis.defi.fact_swaps
WHERE
TO_CURRENCY = 'ibc/57AA1A70A4BC9769C525EBF6386F7A21536E04A79D62E1981EFCEF9428EBB205' --KAVA contract
AND BLOCK_TIMESTAMP >= '2023-06-01'
AND TX_SUCCEEDED = TRUE
GROUP BY
day
ORDER BY
day ASC
),
KAVA_Price AS (
SELECT
date_trunc('day', RECORDED_HOUR) :: date as day,
AVG(PRICE) AS KAVA_Price
FROM
osmosis.price.ez_prices
WHERE
CURRENCY = 'ibc/57AA1A70A4BC9769C525EBF6386F7A21536E04A79D62E1981EFCEF9428EBB205'
GROUP BY
day
ORDER BY
day ASC
)
SELECT
S.day AS date,
QueryRunArchived: QueryRun has been archived