HosseinUntitled Query
Updated 2022-11-15Copy 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
near as (
select date_trunc('day', timestamp)::date as day,
symbol,
avg (price_usd) as usdprice
from near.core.fact_prices
where timestamp >= '{{ start_date }}'
group by day, symbol
),
flow as (
select date_trunc('day', timestamp)::date as day,
token_contract,
avg (price_usd) as usdprice
from flow.core.fact_prices
where timestamp >= '{{ start_date }}'
group by token_contract, day
),
osmosis as (
select date_trunc('day', recorded_at)::date as day,
symbol,
avg (price) as osmo_usd
from osmosis.core.dim_prices
where day >= '{{ start_date }}'
group by day, symbol
),
maintable as (
select 'NEAR' as chain,
date_trunc(day,block_timestamp) as date,
case when date >= '2022-11-07' then 'After Collapse'
else 'Before Collapse' end as timespan,
count (distinct tx_hash) as TX_Count,
count (distinct trader) as Users_Count,
sum (amount_in*usdprice) as Swap_Volume,
Run a query to Download Data