0xaimanTop Swap Trades on FLOW
    Updated 2023-05-16
    WITH
    raw AS (
    SELECT
    tx_id,
    date(block_timestamp) as day,
    swap_contract,
    CONCAT(fhp1.token, ' --> ', fhp2.token) AS swap_direction,
    trader,
    fhp1.token AS token_out_symbol,
    token_out_contract,
    token_out_amount,
    fhp2.token AS token_in_symbol,
    token_in_contract,
    token_in_amount
    FROM
    flow.core.ez_swaps es
    INNER JOIN flow.core.fact_hourly_prices fhp1 ON fhp1.id = es.token_out_contract
    INNER JOIN flow.core.fact_hourly_prices fhp2 ON fhp2.id = es.token_in_contract
    where fhp1.token!=fhp2.token
    GROUP BY
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11
    ),
    price AS (
    WITH
    rawx AS (
    Run a query to Download Data