sunslingerMonster Query
Updated 2021-09-18
999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
with ticks AS
(
SELECT
pool_address,
pool_name,
min(tick) as mintick,
max(tick) as maxtick,
avg(tick) as avgtick,
median(tick) as mediantick
from uniswapv3.pool_stats
WHERE block_timestamp >= getdate() - interval '24 hours'
--between current_timestamp - interval '24 hours' AND CURRENT_TIMESTAMP
-->=DATEADD(day, -1, CURRENT_TIMESTAMP)
-- current_timestamp - interval '2 hours' AND CURRENT_TIMESTAMP
GROUP BY 1, 2
ORDER BY pool_name ASC
),
ticks2 as
(
Select
pos.pool_address,
pos.pool_name,
pos.fee_percent,
sum(liquidity_adjusted) as liquidity_in_range,
mintick,
maxtick,
mediantick
from uniswapv3.positions as pos
inner join ticks on ticks.pool_address = pos.pool_address
where is_active = true
--and tick_lower > mediantick-mintick
--and tick_upper < mediantick+mintick
and pos.block_timestamp >= getdate() - interval '24 hours'
Run a query to Download Data