scorch⚡️RUNE Trader Count and Trades copy copy
Updated 2024-08-21Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
›
⌄
-- forked from 0xHaM-d / ⚡️RUNE Trader Count and Trades copy @ https://flipsidecrypto.xyz/0xHaM-d/q/B9CHceD3jp8g/rune-trader-count-and-trades-copy
-- forked from Deebs-DeFi-j9fRbz / RUNE Trader Count and Trades @ https://flipsidecrypto.xyz/Deebs-DeFi-j9fRbz/q/R8mFcODVrthD/rune-trader-count-and-trades
select
date_trunc('{{Time_Interval}}', block_timestamp) as date,
count(distinct(from_address)) as number_of_traders,
count(distinct(tx_id)) as number_of_swaps,
avg(number_of_swaps) over (order by date rows between 6 preceding and current row) as "7d-MA # Swaps",
avg(number_of_traders) over (order by date rows between 6 preceding and current row) as "7d-MA # Traders"
from thorchain.defi.fact_swaps
where date BETWEEN '{{start_date}}' and Current_date() - 1
-- and date != date_trunc('day', current_date)
group by 1
ORDER BY 2 DESC
QueryRunArchived: QueryRun has been archived