freemartianClose table
    Updated 2023-02-17
    with Source AS (
    SELECT
    regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
    ethereum.public.udf_hex_to_int(segmented_data [0] :: STRING) AS asset,
    ethereum.public.udf_hex_to_int(segmented_data [1] :: STRING)/pow(10,8) AS Margin,
    ethereum.public.udf_hex_to_int(segmented_data [2] :: STRING)/pow(10,8) AS Leverage,
    Margin*Leverage as Trade_Volume,
    ethereum.public.udf_hex_to_int(segmented_data [4] :: STRING) AS Direction,
    ethereum.public.udf_hex_to_int(segmented_data [6] :: STRING)/pow(10,8) AS Execution_fee_ETH
    FROM
    optimism.core.fact_event_logs
    WHERE topics[0] IN
    ('0x0b78f1597afadf8fca2bae58d2b1fdf85ffd5a62a70b7c9e4212e02dd294ea50',
    ))

    SELECT
    -- tx_hash,
    -- Margin,
    -- Leverage,
    sum(Trade_Volume)
    FROM Source


    Run a query to Download Data