pandaTerra - New Year, New LUNA? | Daily Values on Transaction
Updated 2023-01-25Copy 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
36
›
⌄
WITH tx_table as
(
SELECT
TX_ID,
BLOCK_TIMESTAMP,
FEE,
FEE_DENOM,
TX_SENDER
FROM
terra.core.fact_transactions
WHERE
TX_SUCCEEDED = 'TRUE' AND BLOCK_TIMESTAMP::date >= '2022-12-01'
),
price_Table as --referenced: price of $LUNA table is including the code of user Ali3N
( --having LUNA_Price < 2 and LUNA_Price > 1.22 and LUNA_Price != 1.333487
SELECT
date_trunc (hour,block_timestamp) as timestamps2,
MEDIAN(to_amount/from_amount) as LUNA_Price
FROM
terra.core.ez_swaps
WHERE
from_currency = 'uluna' and to_currency = 'ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4' and to_amount < 1e8 and from_amount < 1e8
AND block_timestamp >= '2023-01-01'
GROUP BY 1
order by 1
)
SELECT
CASE WHEN BLOCK_TIMESTAMP::date = '2022-12-24' then 'Christmas Eve'
WHEN BLOCK_TIMESTAMP::date = '2022-12-25' OR BLOCK_TIMESTAMP::date = '2022-12-26' then 'Christmas Days'
WHEN BLOCK_TIMESTAMP::date >= '2022-12-27' AND BLOCK_TIMESTAMP <= '2023-01-05' then 'Remain Days of Christmas'
ELSE 'Other days' END AS timeline,
BLOCK_TIMESTAMP::date as timestamps,
COUNT(distinct TX_SENDER) as daily_User,
COUNT(distinct TX_ID) as daily_Transaction,
(SUM(FEE) / daily_Transaction) * AVG(LUNA_Price) as daily_avr_Fee,
Run a query to Download Data