Mikey_SOL - nft
Updated 2023-04-13Copy 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 prices as ( -- Wsol prices on ethereum. solana price table doesn't cover nowadays.
select
PRICE as hourly_prices,
"HOUR"
from ethereum.core.fact_hourly_token_prices
where "HOUR"::DATE between '2022-11-01' and '2022-11-14'
and TOKEN_ADDRESS ILIKE '0xD31a59c85aE9D8edEFeC411D448f90841571b89c'
),
daily_prices as (
select
avg(hourly_prices) as daily_prices,
date_trunc('day', "HOUR") as "date"
from prices
group by 2
),
SOL_data as (
select
tx_id as tx_hash,
seller,
purchaser as buyer,
mint as nft_contract,
sales_amount as NFT_price,
block_timestamp
from solana.core.fact_nft_sales
),
sales as (
select
block_timestamp,
nft_contract,
(NFT_price * hourly_prices) as USD_price
from SOL_data
join prices
on "HOUR" = date_trunc('hour', block_timestamp)
),
average_nft_prices as (
select
Run a query to Download Data