Updated 2022-11-22
    with table1 as (select timestamp::Date as day, token, symbol, token_contract, ifnull(avg (price_usd),0) as price_in_USD
    from flow.core.fact_prices where token != 'Blocto'
    group by 1,2,3,4)
    select date_trunc ({{period}}, block_timestamp) as time, count (distinct tx_id) as number_of_transfers,
    count (distinct sender) as number_of_senders,
    count (distinct recipient) as number_of_receivers,
    sum (amount) as Total_token_amount,
    sum (amount*price_in_USD) as Total_USD_amount
    from flow.core.ez_token_transfers t1 join table1 t2
    on t1.token_contract = t2.token_contract and t1.block_timestamp::Date = t2.day
    where symbol ilike '{{ticker}}'
    and tx_succeeded = 'TRUE' group by 1

    Run a query to Download Data