amelia-leeUntitled Query
    Updated 2022-07-30
    WITH assets as (
    SELECT
    date_trunc('day', block_timestamp) as day,
    count(tx_hash) as txn,
    sum(raw_amount) / 1e18 as volume,
    CASE
    WHEN contract_address = '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619' THEN 'WETH'
    WHEN contract_address = '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063' THEN 'DAI'
    WHEN contract_address = '0x70c006878a5a50ed185ac4c87d837633923de296' THEN 'REVV'
    ELSE NULL
    END as fee_currencies
    FROM polygon.core.fact_token_transfers
    WHERE to_address IN (
    '0x8de9c5a032463c561423387a9648c5c7bcc5bc90' , '0x5b3256965e7c3cf26e11fcaf296dfc8807c01073' -- opensea wallets
    )
    AND from_address = '0xf715beb51ec8f63317d66f491e37e7bb048fcc2d'--opensea address
    AND fee_currencies is not NULL
    GROUP BY 1,4
    UNION
    SELECT
    date_trunc('day', block_timestamp) as day,
    count(tx_hash) as txn,
    sum(raw_amount) / 1e6 as volume,
    CASE
    WHEN contract_address = '0x2791bca1f2de4661ed88a30c99a7a9449aa84174' THEN 'USDC'
    ELSE NULL
    END as fee_currencies
    FROM polygon.core.fact_token_transfers
    WHERE to_address IN (
    '0x8de9c5a032463c561423387a9648c5c7bcc5bc90' , '0x5b3256965e7c3cf26e11fcaf296dfc8807c01073' -- opensea wallets
    )
    AND from_address = '0xf715beb51ec8f63317d66f491e37e7bb048fcc2d'--opensea address
    AND fee_currencies is not NULL
    GROUP BY 1,4
    ),
    prices as(
    Run a query to Download Data