germanoracle prices (PSI, MINE, ORION)
    Updated 2022-03-15
    /*Q165: Create a graph to show either:
    a) the token price 6O DAYS
    terra1p44kn7l233p7gcj0v3mzury8k7cwf4zt6gsxs5 GLOW
    terra1z7634s8kyyvjjuv7lcgkfy49hamxssxq9f9xw6 LOTA
    terra1yjg0tuhc6kzwz9jl8yqgxnf2ctwlfumnvscupp HALO (angel)
    terra1mddcdx0ujx89f38gu7zspk2r2ffdl5enyz2u03 ORION contract to swap terra1mxyp5z27xxgmv70xpqjk7jvfq54as9dfzug74m
    terra1php5m8a6qd68z02t3zpw4jv2pj4vgw4wz0t8mz WHITE WHALE */

    SELECT
    date_trunc('day', block_timestamp::date) as date,
    avg(price_usd) as price,
    symbol
    FROM terra.oracle_prices
    WHERE block_timestamp >= current_date -60
    AND symbol in ('MINE', 'PSI', 'ORION')
    GROUP BY date, symbol ORDER BY date




    /*
    SELECT
    date_trunc('day', block_timestamp) as date,
    event_attributes:"1_contract_address" as token, -- remove, added to verify
    address_name as token_name, -- can remove, added to verify
    count(distinct tx_id) as buy_counts,
    count(distinct event_attributes:sender) as buyer_counts,
    sum(event_attributes:"offer_amount"/pow(10,6)) as usd_offered, -- usd_offered
    -- avg(event_attributes:"offer_amount"/pow(10,6)) as usd_offered_avg, -- usd_offered
    sum(event_attributes:"return_amount"/pow(10,8)) as alt_bought, -- IMPORTANT ORION DECIMAL PLACE IS 8 NOT 6
    usd_offered/alt_bought as avg_buy_price
    FROM terra.msg_events
    LEFT JOIN terra.labels ON address = event_attributes:"1_contract_address" -- you can remove this if not needed
    WHERE event_type = 'from_contract'
    Run a query to Download Data