with
degen_ape AS
(
SELECT
a.contract_address AS ca
, a.token_name AS tn
, a.token_id AS ti
FROM
solana.nft.dim_nft_metadata a
WHERE
a.token_name = 'Degen Apes'
)
,
price AS
(
SELECT
date_trunc( 'day' , a.recorded_hour ) AS dt
, avg( a.close ) AS pr
, a.symbol AS sb
FROM
solana.price.fact_token_prices_hourly a
WHERE
a.symbol = 'SOL'
GROUP BY 1 , 3
ORDER BY 1 DESC
)
,
base AS
(
SELECT
a.block_timestamp AS dt
, a.purchaser AS pc
, a.seller AS sl
, a.tx_id AS sc
, a.sales_amount * c.pr AS sv