Skip to content

Add Uniswap V3 WebSocket swap price parsing#35

Open
kingzzoov-ctrl wants to merge 1 commit into
kcolbchain:mainfrom
kingzzoov-ctrl:revenue/uniswap-v3-ws-price
Open

Add Uniswap V3 WebSocket swap price parsing#35
kingzzoov-ctrl wants to merge 1 commit into
kcolbchain:mainfrom
kingzzoov-ctrl:revenue/uniswap-v3-ws-price

Conversation

@kingzzoov-ctrl
Copy link
Copy Markdown

Summary

Adds concrete Uniswap V3 Swap-event parsing to the WebSocket price feed so issue #4 can turn eth_subscribe pool logs into live PricePoint updates instead of only accepting generic JSON price messages.

What changed

  • Extended WebSocketConfig with optional asset metadata and token decimal/inversion settings for DEX pool pricing.
  • Added UNISWAP_V3_SWAP_TOPIC and parser support for Ethereum log subscription payloads.
  • Derives live pool price from sqrtPriceX96, adjusts for token decimal differences, and optionally inverts the pair direction.
  • Updates _handle_message() to prefer Uniswap V3 Swap parsing before falling back to generic websocket price messages.
  • Expanded tests for config generation, Swap-event decoding, ignored non-Swap logs, and cache updates from eth_subscription payloads.

Verification

.venv/bin/python -m pytest -q

Result: 95 passed, 2 skipped.

Closes #4

@abhicris
Copy link
Copy Markdown
Contributor

🤖 Audit verdict: safe

Feature adds legitimate Uniswap V3 swap event parsing with correct event topic, proper decimal math (sqrtPriceX96 calculations), defensive input validation, no credential leakage, and well-tested implementation.

Audited by the kcolbchain PR pipeline. See pipeline docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add real-time WebSocket price streaming

2 participants