Mr_AceONCHAIN HIGHEST
    Updated 2024-05-02
    WITH A AS (
    SELECT
    DATE_TRUNC('DAY', BLOCK_TIMESTAMP) AS DAY,
    MEDIAN(TO_AMOUNT / FROM_AMOUNT) AS PRICE,
    AVG(TO_AMOUNT / FROM_AMOUNT) AS "AVERAGE PRICE"
    FROM
    osmosis.defi.fact_swaps
    WHERE
    TO_CURRENCY = 'ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4'
    AND FROM_CURRENCY = 'ibc/1480B8FD20AD5FCAE81EA87584D269547DD4D436843C1D20F15E00EB64743EF4'
    AND FROM_AMOUNT != 0
    AND TO_AMOUNT != 0
    AND DAY >= '2024-01-01'
    GROUP BY
    1
    ),
    B AS (
    SELECT
    DATE_TRUNC('DAY', BLOCK_TIMESTAMP) AS DAYS,
    COUNT(DISTINCT TRADER) AS "TOTAL TRADERS OVERTIME",
    COUNT(DISTINCT TX_ID) AS "TOTAL TRADES OVERTIME",
    SUM(COUNT(DISTINCT TRADER)) OVER () AS "TOTAL TRADERS",
    SUM(COUNT(DISTINCT TX_ID)) OVER () AS "TOTAL TRADES"
    FROM
    osmosis.defi.fact_swaps
    WHERE
    (
    FROM_CURRENCY LIKE 'ibc/1480B8FD20AD5FCAE81EA87584D269547DD4D436843C1D20F15E00EB64743EF4'
    OR TO_CURRENCY LIKE 'ibc/1480B8FD20AD5FCAE81EA87584D269547DD4D436843C1D20F15E00EB64743EF4'
    )
    AND BLOCK_TIMESTAMP >= '2024-01-01'
    AND FROM_AMOUNT IS NOT NULL
    AND TO_AMOUNT IS NOT NULL
    AND TO_AMOUNT != 0
    AND FROM_AMOUNT != 0
    GROUP BY