Sandeshflow_daily
    Updated 2022-11-15
    with flow_price as
    (
    select date_trunc('hour',timestamp) as time, token_contract ,avg(price_usd) as price
    from flow.core.fact_prices
    where 1=1
    -- and symbol = 'FLOW'
    and source='coinmarketcap'
    group by time,token_contract
    ),
    combined as
    (
    select ft.block_timestamp,
    ft.tx_id,
    ft.token_contract,
    ft.amount,
    ft.tx_succeeded,p.price,ft.amount*p.price as usd from flow.core.ez_token_transfers ft
    left join flow_price p
    on ft.token_contract=p.token_contract
    and date_trunc('hour',block_timestamp)=p.time
    and ft.block_timestamp > current_date - interval ' 1 month'
    )
    select block_timestamp::date as "date",sum(usd) as total_usd from combined group by "date"
    having total_usd >100
    -- where ft.tx_id='05b8c36fe437eab3bb9e5b95d4d65831f3f5875fade88abcd10cf09e8c91aa70'

    -- limit 1
    Run a query to Download Data