jennifertranGMX Weekly Traders
    Updated 2023-02-08
    with
    token_price as (
    select
    hour::date as date,
    symbol,
    decimals,
    avg(price) as usdprice
    from
    ethereum.core.fact_hourly_token_prices
    where
    symbol in (
    'USDC',
    'LINK',
    'USDT',
    'WETH',
    'WBTC',
    'DAI',
    'FRAX'
    )
    or token_address in ('0x1f9840a85d5af5bf1d1762f925bdaddc4201f984')
    group by
    1,
    2,
    3
    ),
    gmx_transaction as (
    select
    block_timestamp,
    tx_hash,
    origin_from_address,
    event_inputs:value as volume,
    case
    when contract_address = '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8' then 'USDC'
    when contract_address = '0xf97f4df75117a78c1a5a0dbb814af92458539fb4' then 'LINK'
    when contract_address = '0x82af49447d8a07e3bd95bd0d56f35241523fbab1' then 'WETH'
    when contract_address = '0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f' then 'WBTC'
    Run a query to Download Data