Yousefi_1994RaceDay - Distribution Average Purchase frequency
    Updated 2022-10-24
    with race_day_nft_sales_by_stable_coin as (
    select
    tx_id,
    block_timestamp,
    nft_id,
    buyer,
    seller,
    price
    from flow.core.ez_nft_sales
    where nft_collection = 'A.329feb3ab062d289.RaceDay_NFT'
    and tx_succeeded = true
    and currency in ('A.3c5959b568896393.FUSD', 'A.ead892083b3e2c6c.DapperUtilityCoin')
    and block_timestamp <= current_date - 1
    ),
    race_day_nft_sales_by_flow_coin as (
    select
    tx_id,
    block_timestamp,
    nft_id,
    buyer,
    seller,
    price as flow_price
    from flow.core.ez_nft_sales
    where nft_collection = 'A.329feb3ab062d289.RaceDay_NFT'
    and tx_succeeded = true
    and currency = 'A.1654653399040a61.FlowToken'
    and block_timestamp <= current_date - 1
    ),
    flow_price_usd as (
    select
    timestamp::date as days,
    avg(price_usd) as price_usd
    from flow.core.fact_prices
    where token_contract = 'A.1654653399040a61.FlowToken'
    group by days
    ),
    Run a query to Download Data