Skip to main content

Overview

  • Dataset ID: 0402
  • Tables:
    • blockdb0402_token_to_token_prices_l2_v1_snapshots — Level-2 impact grid (0..+radius bps for token_in → token_out). Insert the reverse token order to capture the opposite direction.
    • blockdb0402_token_to_token_l2_v1_points — Per-grid-point executable size and realized price at each basis-point offset from mid.
Default grid_step_bps is 10 bps and grid_radius_bps is 1000 bps (±10%) which produces 101 grid points. If you need even more granularity, you can check Token-to-Token Prices L3.

Snapshot Table Columns (blockdb0402_token_to_token_prices_l2_v1_snapshots)

ColumnTypeDescription
snapshot_idBIGINTIdentity column for the price snapshot at this impact layer.
pool_uidBIGINTForeign key referencing blockdb0203_liquidity_pools_v1.uid for the pool in question.
block_numberBIGINTCanonical block height within the originating chain.
block_timeTIMESTAMPTZUTC timestamp for the block that produced this record.
tx_indexINTEGERZero-based transaction index within the block, used for deterministic ordering.
log_indexINTEGERZero-based log index within the transaction, uniquely identifying the emitted event.
token_inBYTEAAddress of the token treated as the input leg for this measurement.
token_outBYTEAAddress of the token treated as the output leg for this measurement.
current_priceNUMERIC(78,18)Normalized mid price at snapshot time (token_out per 1 token_in).
grid_step_bpsSMALLINTBasis-point gap between adjacent grid points in the impact curve.
grid_radius_bpsINTEGERTotal extent of the impact grid from mid price, expressed in basis points.
grid_pointsSMALLINTSerialized list of price/size tuples representing the impact grid.
_tracing_idBYTEABlockDB lineage identifier that links this record to lineage APIs.
_genesis_tracing_idsBYTEA[]Tracing identifiers for the raw artifacts (blocks, logs, proofs) that seeded this record.
_parent_tracing_idsBYTEA[]Tracing identifiers for upstream derived records referenced during computation.
_created_atTIMESTAMPTZRecord creation timestamp.
_updated_atTIMESTAMPTZRecord last update timestamp.
Constraints & Indexes: Address lengths (token_in, token_out) are enforced at 20 bytes, while grid_step_bps, grid_radius_bps, and grid_points must satisfy the normalized SKU formula (grid_radius_bps / grid_step_bps) + 1. Uniqueness over (pool_uid, token_in, token_out, grid_step_bps, grid_radius_bps, block_number, tx_index, log_index) ensures one snapshot per event/pair/grid. Hot indexes include (pool_uid, block_number DESC, tx_index DESC, log_index DESC), (token_in, token_out), and (block_number, tx_index, log_index) for fast filtering.

Grid Points Table Columns (blockdb0402_token_to_token_l2_v1_points)

ColumnTypeDescription
snapshot_idBIGINTForeign key to blockdb0402_token_to_token_prices_l2_v1_snapshots.snapshot_id; cascades on delete.
point_indexSMALLINTZero-based index (0 … grid_points - 1). Serves as part of the primary key.
offset_bps_absINTEGERAbsolute basis-point offset from mid price (e.g., 0, 10, 20 … 1000).
size_inNUMERIC(78,18)Gross input size (excludes fees) required to reach this point.
size_outNUMERIC(78,18)Token out received at this point (excludes fees).
price_at_pointNUMERIC(78,18)Average realized price (token_out per 1 token_in) including fee + impact.
Constraints & Indexes: Primary key (snapshot_id, point_index) plus a FK back to the snapshot guarantees idempotency. Checks enforce non-negative offsets, and indexes on (snapshot_id, offset_bps_abs) support monotonic scans across the grid.

Use Cases

  • Depth & impact modeling for execution algorithms
  • Market-making simulation and slippage profiling
  • MEV and arbitrage detection at grid resolution
  • Feature engineering for price impact models
  • Real-time liquidity monitoring and alerting