elenahooPrice history top 10 collections by total sale in USD
    Updated 2021-08-29
    --with coll_hist as(
    select
    token_metadata:collection_name::string as "Collection",
    year(block_timestamp) || '-' || month(block_timestamp) as date,
    median(price_usd) as median_price,
    count(ethereum.nft_events.token_id) as count_sale
    from ethereum.nft_events
    left join ethereum.nft_metadata on ethereum.nft_events.token_id = ethereum.nft_metadata.token_id
    and ethereum.nft_events.contract_address = ethereum.nft_metadata.contract_address
    where ethereum.nft_events.contract_address in ('0x059edd72cd353df5106d2b9cc5ab83a52287ac3a','0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270')
    and event_type = 'sale'
    and token_metadata:collection_name is not null
    --and tx_currency in ('ETH','WETH')
    and price is not null
    and price_usd > 0
    and token_metadata:collection_name::string in
    (select
    token_metadata:collection_name
    from ethereum.nft_events
    left join ethereum.nft_metadata on ethereum.nft_events.token_id = ethereum.nft_metadata.token_id
    and ethereum.nft_events.contract_address = ethereum.nft_metadata.contract_address
    where ethereum.nft_events.contract_address in ('0x059edd72cd353df5106d2b9cc5ab83a52287ac3a','0xa7d8d9ef8d8ce8992df33d8b8cf4aebabd5bd270')
    and event_type = 'sale'
    and token_metadata:collection_name is not null
    and year(block_timestamp) || '-' || month(block_timestamp) is not null
    group by 1
    order by sum(price_usd) desc
    limit 10
    )
    group by "Collection", date
    order by "Collection", date
    --)
    --select Collection,
    -- date,
    -- min(avg_)
    -- from coll_hist
    Run a query to Download Data