Lightweight Python library for reading Uniswap V3 prices and tick data via Web3.
Project description
uniswap-viewer
uniswap-viewer - A lightweight Uniswap V3 data access library for Python.
This library provides a convenient interface for accessing on-chain data from Uniswap V3 pools, including price calculation, tick information, and block streaming.
Features:
- Support for both synchronous and asynchronous Web3 clients.
- Price retrieval based on
sqrtPriceX96and token decimals. - Tick data decoding using Uniswap V3 ABI and tick key mappings.
- Tick spacing and tick slot calculations based on pool fee tiers.
- Utility functions for ABI loading and token address filtering.
- Block streaming generator to react to new blocks in real time.
Modules:
utils.py: Internal helpers (ABI loading, tick keys, address filtering).viewer_sync.py: Synchronous Uniswap V3 pool viewer usingweb3.py.viewer_async.py: Asynchronous viewer compatible with async Web3 providers.- (Pluggable design: future viewers can be added for batched queries, multicall, etc.)
Requirements:
- Python 3.8+
web3library (with appropriate provider setup)
Usage example (sync): >>> from uniswap_viewer.viewer_sync import Viewer >>> from web3 import Web3 >>> w3 = Web3(Web3.HTTPProvider(...)) >>> v = Viewer(w3, token0_address, token1_address, fee=3000) >>> v.init() >>> price = v.get_price()
Usage example (async): >>> from uniswap_viewer.viewer_async import Viewer >>> from web3 import AsyncWeb3 >>> w3 = AsyncWeb3(...) >>> v = Viewer(w3, token0_address, token1_address, fee=3000) >>> await v.init() >>> price = await v.get_price()
This library is designed for developers, analysts, and trading systems that need efficient and readable access to raw Uniswap V3 data without relying on external APIs like The Graph.
License: MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uniswap_viewer-0.1.0.tar.gz.
File metadata
- Download URL: uniswap_viewer-0.1.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6527860fa230f7679ce3703e79fb104d3b45fdccc0ba6c3e170bd26dd6b29a2
|
|
| MD5 |
1ee8ae19f9f95165474eab31613a33b3
|
|
| BLAKE2b-256 |
fdd3420b95acd96ce52dd0c28d5ec6891bd67f567fecb04658cf2bf5283e1946
|
File details
Details for the file uniswap_viewer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: uniswap_viewer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3dfdeb9c887b1919c15ee255827c48d1789cefa82614b04fe18f87c532b00d65
|
|
| MD5 |
2a15cbe139e3d88ba44c8e8cbf80068e
|
|
| BLAKE2b-256 |
79a82f467694cebc2085bb35c1ef5bee9266f3bf8a97c562bf4832f6ab8c0d14
|