sarathopensea fee3
    Updated 2022-07-28
    with weth as (select HOUR::date date,avg(PRICE) PRICE
    from ethereum.core.fact_hourly_token_prices
    where HOUR::date>='2022-01-01'
    and token_address='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
    group by 1)
    select block_timestamp::date date,sum(RAW_AMOUNT/1e18*b.price) usd_fee
    from polygon.core.fact_token_transfers a
    left join weth b on a.block_timestamp::date=b.date
    where 1=1
    and FROM_ADDRESS='0xf715beb51ec8f63317d66f491e37e7bb048fcc2d' and TO_ADDRESS='0x8de9c5a032463c561423387a9648c5c7bcc5bc90'
    and CONTRACT_ADDRESS='0x7ceb23fd6bc0add59e62ac25578270cff1b9f619'
    --and TX_HASH='0x1e19fdc20534d88bf77ae0db65ba0149a00b5d190afbb8df9701926b74125eff' and block_timestamp::date='2022-07-27'
    group by 1
    Run a query to Download Data