Realtime Data
Realtime Data Websockets are designed to provide realtime data through our data streams. Realtime data is only available to clients with an API key. All data streams are available via real-time API.
Base URL: https://stream.nakji.network/
/ws
: Websockets endpoint./sse
: Server sent events endpoint.
note
Both endpoints require the inclusion of a valid API key in the URL path (/ws/<apikey>
or /sse/<apikey>
).
Request vars
streams
: stream names to subscribe to (e.g. nakji.uniswapv2.0_0_0.liquiditypool_Change)
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/<apikey>?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/<apikey>?streams=nakji.sushiswap.0_0_0.market_Trade"
curl https://stream.nakji.network/sse?streams=nakji.sushiswap.0_0_0.market_Trade
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/<apikey>?streams=nakji.aave.0_0_0.*"
curl https://stream.nakji.network/sse/<apikey>?streams=nakji.aave.0_0_0.*
multiple streams
wscat -c "wss://stream.nakji.network/ws/<apikey>?streams=x&streams=y&streams=z"
curl https://stream.nakji.network/sse/<apikey>?streams=x&streams=y&streams=z
Notes
Stream names are case sensitive. Pair IDs are case sensitive to their checksummed values.