winnie-fsOFFICIAL Arbitrum Weekly Whales copy
    Updated 2023-03-21
    -- forked from 9502853e-61d5-45aa-a16b-d258ac4abcfa

    -- forked from 42f4773b-6332-4176-9707-e0ffb047236d

    WITH Deposits AS(
    SELECT
    TO_ADDRESS AS whale,
    sum(ETH_VALUE) AS bought_amount
    FROM arbitrum.core.fact_transactions
    WHERE BLOCK_TIMESTAMP>CURRENT_DATE-7
    AND STATUS='SUCCESS'
    GROUP BY 1
    ),

    Withdrawals AS(
    SELECT
    FROM_ADDRESS AS whale,
    sum(ETH_VALUE) AS sold_amount
    FROM arbitrum.core.fact_transactions
    WHERE BLOCK_TIMESTAMP>CURRENT_DATE-7
    AND STATUS='SUCCESS'
    GROUP BY 1
    )

    SELECT
    d.whale,
    SUBSTRING(d.whale, 38, 43) as short_address,
    d.bought_amount+w.sold_amount AS total_volume_in_ETH,
    d.bought_amount AS Volume_IN,
    w.sold_amount AS Volume_OUT
    FROM Deposits d
    JOIN withdrawals w USING(whale)
    WHERE d.whale NOT IN(lower('0x0D0707963952f2fBA59dD06f2b425ace40b492Fe'), lower('0xB38e8c17e38363aF6EbdCb3dAE12e0243582891D')
    ,lower('0xf89d7b9c864f589bbF53a82105107622B35EaA40'),lower('0x82CbeCF39bEe528B5476FE6d1550af59a9dB6Fc0'),lower('0x03E6FA590CAdcf15A38e86158E9b3D06FF3399Ba'),
    lower('0xC32eB36f886F638fffD836DF44C124074cFe3584'),lower('0xF3F094484eC6901FfC9681bCb808B96bAFd0b8a8'),
    lower('0xBE3dE7fB9Aa09B3Fa931868Fb49d5BA5fEe2eBb1'), lower('0xF977814e90dA44bFA03b6295A0616a897441aceC'))
    Run a query to Download Data