0xHaM-dLabel Count
Updated 2024-06-01Copy 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
›
⌄
-- forked from Playwo / Users Total @ https://flipsidecrypto.xyz/Playwo/q/jnbOOVFcO0wH/users-total
WITH timeframe AS (
SELECT date_day AS date
FROM crosschain.core.dim_dates
),
volume_events AS (
SELECT
a__contract_address.tx_id,
a__contract_address.block_timestamp,
a__contract_address.attribute_value AS contract,
a_volume_usd.attribute_value AS volume
FROM
osmosis.core.fact_msg_attributes AS a__contract_address,
osmosis.core.fact_msg_attributes AS a_volume_usd
WHERE a__contract_address.block_timestamp > (SELECT min(date) FROM timeframe)
AND a__contract_address.attribute_key = '_contract_address'
AND a_volume_usd.attribute_key = 'volume-usd'
AND a__contract_address.tx_id = a_volume_usd.tx_id
AND a__contract_address.msg_index = a_volume_usd.msg_index
AND (a__contract_address.msg_group = a_volume_usd.msg_group OR a__contract_address.msg_group IS NULL AND a_volume_usd.msg_group IS NULL)
)
, lstTb as (
SELECT
block_timestamp,
TX_FROM as trader,
tx_id,
NVL(volume, 0) AS volume_usd
FROM volume_events
JOIN osmosis.core.fact_transactions using(tx_id, block_timestamp)
)
-- forked from 0xDataWolf / Retention Pareto Demo @ https://flipsidecrypto.xyz/0xDataWolf/q/6IUCfIcpSTMC/retention-pareto-demo
, get_volume_per_user as ( -- this is data prep
select
QueryRunArchived: QueryRun has been archived