SniperUntitled Query
    Updated 2022-11-06
    with price as (
    select hour::date as date,
    symbol,
    decimals,
    avg (price) as usdprice
    from ethereum.core.fact_hourly_token_prices
    where (symbol in ('USDC','MIM','LINK','USDT','WETH','WBTC','DAI','FRAX')
    or token_address in ('0x1f9840a85d5af5bf1d1762f925bdaddc4201f984'))
    group by 1,2,3),

    gmx as (
    select block_timestamp,
    tx_hash,
    origin_from_address,
    event_inputs:value as volume,
    decode(contract_address , '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8' , 'USDC'
    , '0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a' , 'MIM'
    , '0xf97f4df75117a78c1a5a0dbb814af92458539fb4' , 'LINK'
    , '0x82af49447d8a07e3bd95bd0d56f35241523fbab1' , 'WETH'
    , '0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f' , 'WBTC'
    , '0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0' , 'UNI'
    ,'0xda10009cbd5d07dd0cecc66161fc93d7c9000da1' , 'DAI'
    ,'0x17fc002b466eec40dae837fc4be5c67993ddbd6f' , 'FRAX'
    , '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9' , 'USDT'
    , contract_address ) as Token_Symbol
    from arbitrum.core.fact_event_logs
    where origin_to_address in ('0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba','0xb87a436b93ffe9d75c5cfa7bacfff96430b09868')
    and tx_status= 'SUCCESS'
    and event_name = 'Transfer'
    and event_inputs:value is not null ),

    maintable as (
    select t1.*,
    (t1.volume / pow (10,t2.decimals)) * t2.usdprice as Volume1
    from gmx t1 join price t2 on t1.block_timestamp::date = t2.date and t1.Token_Symbol = t2.symbol
    where Volume1 > 1 )
    Run a query to Download Data