SELECTmin(block_number) as block_number,min(block_timestamp_last) as block_timestamp, reserve0 AS"USDC Pool Liquidity", reserve1 AS"WETH Pool Liquidity", price0 AS"WETH/USDC", price1 AS"USDC/WETH"FROM eth.sushiswap.pool_stats_detailedWHERE token0_symbol ='USDC'AND token1_symbol ='WETH'and block_timestamp_last > UNIX_TIMESTAMP() -60*60-- 1 hourGROUP BY price0, price1, reserve0, reserve1ORDER BY block_number DESCLIMIT10
Advanced Liquidity Aggregations for USD Token Pairs
Typical query time: <10 seconds
SELECT token0_symbol, token1_symbol,min(block_number) AS min_block_number,max(block_number) AS max_block_number,max(reserve0) AS max_liquidity0,min(reserve0) AS min_liquidity0,avg(reserve0) AS avg_liquidity0,max(reserve1) AS max_liquidity1,min(reserve1) AS min_liquidity1,avg(reserve1) AS avg_liquidity1,max(price0) AS max_price0,min(price0) AS min_price0,avg(price0) AS avg_price0FROM eth.uniswap_v2.pool_stats_detailedWHERE (token0_symbol LIKE'%USD%'OR token1_symbol LIKE'%USD%')and block_timestamp_last > UNIX_TIMESTAMP() -60*60-- 1 hourGROUP BY pool_address, token0_symbol, token1_symbolORDER BY avg_liquidity1 DESCLIMIT10
Over the past few days, which pair that included USDC had the largest change in liquidity during a single hour?
Typical query time: <10 seconds
SELECT"hour", change_in_min_reserve0, change_in_min_reserve1, pool_address, token0_symbol, token1_symbolFROM ( SELECT "hour", reserve0_min_next_hour - reserve0_min as change_in_min_reserve0, reserve1_min_next_hour - reserve1_min as change_in_min_reserve1, pool_address, token0_symbol, token1_symbol
FROM (SELECT"hour", reserve0_min, reserve1_min, pool_address, token0_symbol, token1_symbol,LEAD(reserve0_min,1) OVER (PARTITIONBY pool_addressORDER BY"hour" ) reserve0_min_next_hour,LEAD(reserve1_min,1) OVER (PARTITIONBY pool_addressORDER BY"hour" ) reserve1_min_next_hourFROM eth.sushiswap.pool_liquidity_stats_by_hourWHERE"hour">'2022-02-10 00:00:00.000' ))WHERE change_in_min_reserve0 IS NOT NULL AND change_in_min_reserve1 IS NOT NULL AND (token0_symbol = 'USDC' OR token1_symbol = 'USDC')
ORDER BY change_in_min_reserve0 descLIMIT10
Sushiswap top 10 pools with highest number of swaps
Typical query time: <10 seconds
SELECTaddress,count(1) AS tx_countFROM eth.sushiswap.recent_event_swapsGROUP BYaddressORDER BY tx_count DESCLIMIT10