Skip to main content

Realtime Data

Realtime Data Websockets are designed to provide realtime data through our data streams. All data streams are available via real-time API.

Base URL: https://stream.nakji.network/

Request vars

  • streams: stream names to subscribe to (e.g. nakji.common.0_0_0.liquiditypool_change-1m0s)

Additionally, for nakji.common streams:

  • namespace (optional): dApp name (e.g. uniswapv2)
  • subjects (optional): pair addresses within the namespace (e.g. 0x123)
note

Both endpoints only support unidirectional data transmission at this time.

Response data structures depend on the data that is indexed for that specific stream.

Examples

You can use wscat to test the websockets endpoint from your terminal. You can use curl to query the SSE endpoint.

  >> curl -i -X GET "https://stream.nakji.network/sse?streams=nakji.uniswapv3.0_0_0.*"

data: {"ts":"2022-08-05T07:56:40Z", "sender":"TLGDhuXR803G7qg0vzU0qXCj+Oc=", "recipient":"VheKDV8wG69s8+HNU9mGNDc0W/k=", "amount0":"DqxxmMI=", "amount1":"Ag1xadJofYbF", "sqrtPriceX96":"X8OsNX7VBsbQjGitOsU=", "liquidity":"89RQdAFLs6g=", "tick":"AxWn"}
event: nakji.uniswapv3.0_0_0.pool_swap

data: {"ts":"2022-08-05T07:56:40Z", "sender":"3vHA3tm+x/GhZwgZgzJA8CeyXv8=", "recipient":"5msxZ41sFunr81gminkLdjwTN1A=", "amount0":"C7k+CXiT+w==", "amount1":"EHts78SCbHY=", "sqrtPriceX96":"ExReU3RO6wFGsmmTNA==", "liquidity":"KFN1laaCOCQ=", "tick":"5l8="}
event: nakji.uniswapv3.0_0_0.pool_swap

data: {"ts":"2022-08-05T07:56:40Z", "sender":"aLNGWDP7cqcOzfSF4OTHvYZl/EU=", "recipient":"aLNGWDP7cqcOzfSF4OTHvYZl/EU=", "amount0":"Nf+cJhut8eCy", "amount1":"kalIY8qAAA==", "sqrtPriceX96":"AaaFiOq77r0qbAbR", "liquidity":"BVgdTXtmTyD14w==", "tick":"AYoY"}
event: nakji.uniswapv3.0_0_0.pool_swap

single stream

wscat -c "wss://stream.nakji.network/ws?streams=nakji.common.0_0_0.market_trade-1m0s&namespace=sushiswap&subjects=<pairid>"
curl https://stream.nakji.network/sse?streams=nakji.common.0_0_0.market_trade-1m0s&namespace=sushiswap&subjects=<pairid>

wildcard streams

# You can subscribe to all events in a stream name family.
# For example, for all Aave events you can subscribe to `nakji.aave.0_0_0.*`
wscat -c "wss://stream.nakji.network/ws?streams=nakji.aave.0_0_0.*"
curl https://stream.nakji.network/sse?streams=nakji.aave.0_0_0.*

multiple streams

wscat -c "wss://stream.nakji.network/ws?streams=x&streams=y&streams=z"
curl https://stream.nakji.network/sse?streams=x&streams=y&streams=z

Notes

Stream names are case sensitive. Pair IDs are case sensitive to their checksummed values.

For common streams, additional parameters namespace and subjects can be passed to further narrow down incoming messages.