Query editor
-- use until dex prices includes GHOWITH gho_buys AS (SELECT block_time, token_sold_amount/cast(token_bought_amount_raw as double)*1000000000000000000 as priceFROM dex.tradesWHERE token_bought_address = 0x40d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2fAND blockchain = 'ethereum'AND block_date > date('2023-07-14')AND token_sold_symbol IN ('USDC', 'USDT')),gho_sells AS (SELECT block_time, cast(token_bought_amount_raw as double)/cast(token_sold_amount_raw as double)*1000000000000 as priceFROM dex.tradesWHERE token_sold_address = 0x40d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2fAND blockchain = 'ethereum'AND block_date > date('2023-07-14')AND token_bought_symbol IN ('USDC', 'USDT'))SELECT coalesce(b.block_time, s.block_time) as time, coalesce(avg(b.price), avg(s.price)) as price, 1 as pegFROM gho_buys b, gho_sells sGROUP BY 1, 3ORDER BY 1