Skip to main content

Uniswap V3 Position Table

Description

NFT-based liquidity positions with range and valuation per snapshot. Ideal for LP strategy analysis and "in-range" detection.

Schema

FieldTypeDescription
idBYTESDeterministic ID (MD5 of pool_id, position_id, block_number)
uniswap_v3_pool_idSTRINGFK → uniswap_v3_pool.id.
datetimeTIMESTAMPSnapshot time (UTC).
block_numberINTEGERSnapshot block.
position_idINTEGERPosition NFT ID.
owner_addressSTRINGCurrent owner address.
raw_amount_0BIGNUMERICToken0 amount (smallest unit).
raw_amount_1BIGNUMERICToken1 amount (smallest unit).
value_usd_0FLOATUSD value of token0 in the position.
value_usd_1FLOATUSD value of token1 in the position.
liquidityBIGNUMERICAmount of liquidity provided.
lower_tickINTEGERLower bound of the range.
upper_tickINTEGERUpper bound of the range.
active_rangeBOOLEANTRUE if current price is within the range.
ingested_atTIMESTAMPInsert time (UTC).

Example Queries

Latest snapshot of LPs in a specific pool

DECLARE target_pool STRING DEFAULT 'WETH/USDC 0.05%';

WITH target AS (
SELECT id FROM `defi_prepared.uniswap_v3_pool` WHERE name = target_pool LIMIT 1
)
SELECT pos.*
FROM `defi_prepared.uniswap_v3_position` pos
WHERE pos.uniswap_v3_pool_id = (SELECT id FROM target)
QUALIFY ROW_NUMBER() OVER (PARTITION BY position_id ORDER BY datetime DESC) = 1
ORDER BY position_id;

All "in-range" positions at a specific timestamp

SELECT p.name, pos.position_id, pos.owner_address, pos.liquidity
FROM `defi_prepared.uniswap_v3_position` pos
JOIN `defi_prepared.uniswap_v3_pool` p ON pos.uniswap_v3_pool_id = p.id
WHERE pos.datetime = TIMESTAMP('2025-01-01 00:00:00+00')
AND pos.active_range = TRUE
ORDER BY p.name, pos.position_id;