CryptoIcicleEVM - 7. Derivative Daze - 1
    Updated 2023-02-13
    -- Derivatives DEX Gains Network recently crossed a major milestone, with more than $1.5 million in trading volume on Arbitrum,
    -- fueling further interest in derivatives trading on the platform.
    -- Building on this Dune dashboard, create a dashboard that shows the following data for Gains Network and any other derivatives trading markets you can find:
    -- Total volume
    -- Total traders
    -- Total trade fees
    -- Trade volume over the past day/month/three months
    -- Traders over the past day/month/three months


    -- Note: We link to a Dune dashboard as a source of inspiration. You are free to choose your own preferred publishing platform.
    -- USDC Payouts:

    -- Rank USDC amount
    -- First place 400
    -- Second place 200
    -- Third place 200
    -- 4th through 15th place 75
    -- 16th through 21st place 50

    -- SQL Credit : https://app.flipsidecrypto.com/velocity/queries/8c79c7a3-10e6-4d2c-9dde-4982dd6d65a3

    with pricetable 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')) --UNI
    )
    and date >= CURRENT_DATE - {{n_days_ago}}
    group by 1,2,3),

    gmxtable as (
    select block_timestamp,
    Run a query to Download Data