degenbot.uniswap.v3_snapshot ============================ .. py:module:: degenbot.uniswap.v3_snapshot .. autoapi-nested-parse:: Uniswap V3 pool snapshot and subscription handler. Module Contents --------------- .. py:class:: UniswapV3LiquiditySnapshotSource Bases: :py:obj:`degenbot.uniswap.concentrated.snapshot_readers.LiquiditySnapshotSource`, :py:obj:`Protocol` A minimal protocol for retrieving pool data from a generic source. Any class implementing the protocol must implement these methods, transforming data as necessary to return the specified types. .. py:method:: get_liquidity_map(pool_address: degenbot.types.chain.ChecksummedAddress) -> degenbot.uniswap.concentrated.snapshot_readers.LiquidityMap | None Return liquidity map. :returns: The liquidity map for the pool, or None if not found. .. py:method:: get_pools() -> set[degenbot.types.chain.ChecksummedAddress] Return pools. :returns: The set of pool addresses. .. py:class:: MonolithicJsonFileSnapshot Bases: :py:obj:`degenbot.uniswap.concentrated.snapshot_readers.MonolithicJsonFileSnapshotBase` A pool liquidity source backed by a single JSON file. .. py:method:: get_liquidity_map(pool_address: degenbot.types.chain.ChecksummedAddress) -> degenbot.uniswap.concentrated.snapshot_readers.LiquidityMap | None Return liquidity map. :returns: The liquidity map for the pool, or None if not found. .. py:class:: IndividualJsonFileSnapshot Bases: :py:obj:`degenbot.uniswap.concentrated.snapshot_readers.IndividualJsonFileSnapshotBase` Snapshot source backed by a directory of JSON files. .. py:class:: DatabaseSnapshot Bases: :py:obj:`degenbot.uniswap.concentrated.snapshot_readers.DatabaseSnapshotBase`\ [\ :py:obj:`degenbot.types.chain.ChecksummedAddress`\ ] Snapshot source backed by the built-in SQLite database. .. py:method:: get_liquidity_map(pool_address: degenbot.types.chain.ChecksummedAddress) -> degenbot.uniswap.concentrated.snapshot_readers.LiquidityMap | None Return liquidity map. :returns: The liquidity map for the pool, or None if not found. .. py:class:: UniswapV3LiquiditySnapshot Bases: :py:obj:`degenbot.uniswap.concentrated.snapshot_readers.LiquiditySnapshotBase`\ [\ :py:obj:`degenbot.types.chain.ChecksummedAddress`\ , :py:obj:`degenbot.uniswap.v3_types.UniswapV3PoolLiquidityMappingUpdate`\ , :py:obj:`degenbot.uniswap.v3_types.UniswapV3LiquidityEvent`\ , :py:obj:`UniswapV3LiquiditySnapshotSource`\ ] Retrieve and maintain liquidity positions for Uniswap V3 pools. .. py:method:: pending_updates(pool_address: str) -> tuple[degenbot.uniswap.v3_types.UniswapV3PoolLiquidityMappingUpdate, ...] Consume pending liquidity updates for the pool. :returns: A tuple of liquidity mapping updates for the pool. .. py:method:: tick_bitmap(pool_address: str | bytes) -> dict[int, degenbot.uniswap.concentrated.types.BitmapAtWord] | None Consume the tick initialization bitmaps for the pool. :returns: The tick bitmap dict, or None if no snapshot exists. .. py:method:: tick_data(pool_address: str | bytes) -> dict[int, degenbot.uniswap.concentrated.types.LiquidityAtTick] | None Consume the liquidity mapping for the pool. :returns: The tick data dict, or None if no snapshot exists. .. py:method:: update(pool: degenbot.types.chain.HexAddress, tick_data: dict[int, degenbot.uniswap.concentrated.types.LiquidityAtTick], tick_bitmap: dict[int, degenbot.uniswap.concentrated.types.BitmapAtWord]) -> None Update the liquidity mapping for the pool. :raises UnknownPool: If the pool has no snapshot.