par_rnAverage NFT price in USD
    Updated 2022-11-17
    with collections as ( select contract_address,EVENT_INPUTS:tokenId as nft, count(DISTINCT(tx_hash)) as total_tx
    from ethereum.core.fact_event_logs
    where origin_to_address = lower('0x5a7749f83b81b301cab5f48eb8516b986daef23d') and
    origin_to_address = EVENT_INPUTS:to and origin_from_address = EVENT_INPUTS:from
    group by 1,2)
    ,
    label as ( select label , contract_address, nft, total_tx
    from ethereum.core.dim_labels a join collections b on a.address = b.contract_address)
    ,
    last_price as ( select max(block_timestamp) as max_date , label, nft, price_usd
    from ethereum.core.ez_nft_sales a join label b on a.nft_address = b.contract_address and tokenid = nft
    group by 2,3,4)

    select avg(price_usd) as avg_price
    from last_price
    Run a query to Download Data