Madibuyers/sellers ratio by period
    Updated 2022-10-29
    with azuki as (
    select BLOCK_TIMESTAMP, SELLER_ADDRESS, BUYER_ADDRESS
    from ethereum.core.ez_nft_sales
    where EVENT_TYPE = 'sale' and date_trunc('day',BLOCK_TIMESTAMP) <= '2022-03-12' and (CURRENCY_SYMBOL = 'ETH' or CURRENCY_SYMBOL = 'WETH' ) and (NFT_ADDRESS = lower('0xED5AF388653567Af2F388E6224dC7C4b3241C544')) and PRICE >0),

    Doodles as (
    select BLOCK_TIMESTAMP, SELLER_ADDRESS, BUYER_ADDRESS
    from ethereum.core.ez_nft_sales
    where EVENT_TYPE = 'sale' and date_trunc('day',BLOCK_TIMESTAMP) <= '2021-12-15' and (CURRENCY_SYMBOL = 'ETH' or CURRENCY_SYMBOL = 'WETH' ) and (NFT_ADDRESS = lower('0x8a90cab2b38dba80c64b7734e58ee1db38b8992e')) and PRICE >0),

    goblin as (
    select BLOCK_TIMESTAMP, SELLER_ADDRESS, BUYER_ADDRESS
    from ethereum.core.ez_nft_sales
    where EVENT_TYPE = 'sale' and date_trunc('day',BLOCK_TIMESTAMP) <= '2022-07-19' and (CURRENCY_SYMBOL = 'ETH' or CURRENCY_SYMBOL = 'WETH' ) and (NFT_ADDRESS = lower('0xbCe3781ae7Ca1a5e050Bd9C4c77369867eBc307e')) and PRICE >0),

    df1 as (SELECT CASE WHEN contract_address = '0x8d0501d85becda92b89e56177ddfcea5fc1f0af2' then 'The Senses'
    end as collection, *
    from polygon.core.fact_event_logs
    WHERE EVENT_REMOVED = 'false' and TX_STATUS = 'SUCCESS' and contract_address = '0x8d0501d85becda92b89e56177ddfcea5fc1f0af2' and date_trunc('day', BLOCK_TIMESTAMP) >= '2022-08-19'
    ),

    df as (
    SELECT a.BLOCK_TIMESTAMP, c.FROM_ADDRESS as FROM_ADDRESS, c.TO_ADDRESS as buyers
    from df1 a join polygon.core.fact_token_transfers c on a.BLOCK_TIMESTAMP = c.BLOCK_TIMESTAMP),

    datafr as (

    SELECT date_trunc('day',BLOCK_TIMESTAMP) as date, ROW_NUMBER() OVER(ORDER BY date_trunc('day',BLOCK_TIMESTAMP) asc) AS Number_of_the_day,
    'Azuki' as Collection, count (DISTINCT BUYER_ADDRESS) / count (DISTINCT SELLER_ADDRESS) as buyers_purch_ratio
    from azuki group by date

    UNION ALL

    SELECT date_trunc('day',BLOCK_TIMESTAMP) as date, ROW_NUMBER() OVER(ORDER BY date_trunc('day',BLOCK_TIMESTAMP) asc) AS Number_of_the_day,
    'Doodles' as Collection, count (DISTINCT BUYER_ADDRESS) / count (DISTINCT SELLER_ADDRESS) as buyers_purch_ratio
    from Doodles group by date
    Run a query to Download Data