HosseinUntitled Query
Updated 2022-10-29Copy 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
›
⌄
with
price_list as (
select
date_trunc('day', block_timestamp)::date as day,
avg(swap_to_amount) / avg(swap_from_amount) as price
from solana.fact_swaps
where 1 = 1
and swap_from_mint = 'So11111111111111111111111111111111111111112'
and swap_to_mint in ('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v')
and swap_to_amount > 0
and swap_from_amount > 0
and day >= current_date - interval '3 months'
group by day
),
list2 as (
select
date_trunc('day', a.block_timestamp)::date as day,
project_name,
tx_id,
purchaser,
seller,
sales_amount * price as usd_price
from solana.core.fact_nft_sales a
join solana.core.dim_nft_metadata b
join price_list
on price_list.day = a.day
and a.mint = b.mint
where sales_amount > 0
and marketplace = 'coral cube'
and succeeded = 1
)
select * from list2 limit 10;
Run a query to Download Data