MadiAVG floor price 60 days
    Updated 2022-10-29
    with 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.TO_ADDRESS as buyers,
    c.RAW_AMOUNT/pow(10, 18) as amount_eth
    from df1 a join polygon.core.fact_transactions b on a.BLOCK_TIMESTAMP = b.BLOCK_TIMESTAMP and a.TX_HASH = b.TX_HASH
    join polygon.core.fact_token_transfers c on b.BLOCK_TIMESTAMP = c.BLOCK_TIMESTAMP and b.TX_HASH = c.tx_hash),
    df_floor as (
    select
    ROW_NUMBER() OVER(ORDER BY date_trunc('day',BLOCK_TIMESTAMP) asc) AS Number_of_the_day,
    date_trunc('day',BLOCK_TIMESTAMP) as date,
    'Azuki' as collection,
    min(PRICE) as floor_price_eth
    from ethereum.core.ez_nft_sales
    where EVENT_TYPE = 'sale' and date <= '2022-03-12' and (CURRENCY_SYMBOL = 'ETH' or CURRENCY_SYMBOL = 'WETH')
    and NFT_ADDRESS = lower('0xED5AF388653567Af2F388E6224dC7C4b3241C544') and PRICE != 0
    group by date

    UNION ALL
    select
    ROW_NUMBER() OVER(ORDER BY date_trunc('day',BLOCK_TIMESTAMP) asc) AS Number_of_the_day,
    date_trunc('day',BLOCK_TIMESTAMP) as date,
    'Doodles' as collection,
    Run a query to Download Data