Skip to main content

Overview

Stream real-time token USD prices via Server-Sent Events (SSE) with DexPaprika’s public streaming endpoint. Get price updates roughly every 1 second with no API key required. Base URL: https://streaming.dexpaprika.com Endpoint: GET /stream Protocol: HTTP/1.1 with text/event-stream (SSE)

Getting Started

Basic Example

curl -N "https://streaming.dexpaprika.com/stream?method=t_p&chain=ethereum&address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
This opens a streaming connection to Ethereum WETH price updates.

Request Parameters

ParameterTypeRequiredDescription
methodstringYesStreaming method. Must be t_p (token price)
chainstringYesBlockchain network slug (e.g., ethereum, solana)
addressstringYesToken contract address or canonical address on the chain
limitintegerNoOptional: close stream after emitting N events

Request Examples

curl -N "https://streaming.dexpaprika.com/stream?method=t_p&chain=ethereum&address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&limit=3"

Response Format

Status: 200 OK on success Content-Type: text/event-stream Format: Newline-delimited SSE events

Event Payload

data: {"a":"<token_address>","c":"<chain>","p":"<price_usd>","t":<unix_timestamp>}
event: t_p

Response Fields

FieldTypeDescription
astringToken address
cstringChain slug
pstringPrice in USD (numeric string for precision)
tintegerSend timestamp (Unix seconds)

Example Response

{"a":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","c":"ethereum","p":"3997.5514026436525223","t":1761733397}

Event Variants

Each tick can emit up to three price events with the same schema but different computation strategies:

Available Variants

VariantEvent NameUse CaseCharacteristics
v3t_p_v3Default choiceMost stable, canonical price
v2t_p_v2BalancedSmoother than v1, slightly lagged
v1t_pReal-time needsMost reactive, can be noisier
// Prefer v3 (canonical), fall back to v2, then v1
function selectPrice(eventsForTick) {
  const latestByName = Object.create(null);
  for (const ev of eventsForTick) latestByName[ev.event] = ev.data;
  const v3 = latestByName['t_p_v3'];
  const v2 = latestByName['t_p_v2'];
  const v1 = latestByName['t_p'];
  const chosen = v3 ?? v2 ?? v1;
  return chosen ? Number(chosen.p) : null;
}

Usage Examples

Node.js Quick Listener

const url = new URL('https://streaming.dexpaprika.com/stream');
url.searchParams.set('method', 't_p');
url.searchParams.set('chain', 'ethereum');
url.searchParams.set('address', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2');
url.searchParams.set('limit', '5');

(async () => {
  const res = await fetch(url.toString());
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
  const reader = res.body.getReader();
  const decoder = new TextDecoder();
  let buf = '';

  for (;;) {
    const { value, done } = await reader.read();
    if (done) break;
    buf += decoder.decode(value, { stream: true });
    const chunks = buf.split('\n\n');
    buf = chunks.pop() || '';

    for (const chunk of chunks) {
      const lines = chunk.split('\n').filter(Boolean);
      const map = Object.fromEntries(lines.map(line => {
        const i = line.indexOf(': ');
        return i > 0 ? [line.slice(0, i), line.slice(i + 2)] : [line, ''];
      }));
      if (map.event && map.data) {
        try {
          const payload = JSON.parse(map.data);
          console.log(`[${map.event}]`, payload);
        } catch (e) {
          console.warn('Bad JSON:', map.data);
        }
      }
    }
  }
})().catch(err => {
  console.error(err);
  process.exit(1);
});

Browser (EventSource)

function startStream() {
  const url = new URL('https://streaming.dexpaprika.com/stream');
  url.searchParams.set('method', 't_p');
  url.searchParams.set('chain', 'ethereum');
  url.searchParams.set('address', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2');

  const es = new EventSource(url.toString());

  function handle(evt) {
    try {
      const data = JSON.parse(evt.data);
      console.log(`[${evt.type}]`, data);
    } catch (_) {}
  }

  es.addEventListener('t_p', handle);
  es.addEventListener('t_p_v2', handle);
  es.addEventListener('t_p_v3', handle);

  es.onerror = () => {
    // Simple reconnect on error
    es.close();
    setTimeout(startStream, 1000);
  };
}

startStream();

Error Handling

HTTP Status Codes

StatusReasonResolution
400 Bad RequestMissing/invalid parametersCheck method, chain, address, limit
400 Unsupported chainChain not supportedUse /networks endpoint to find valid chains
400 Asset not foundToken address invalid for chainVerify address belongs to the specified chain
429 Too Many RequestsGlobal capacity exceededRetry with exponential backoff

Common Errors

invalid method: method must be 't_p'
asset address is required
chain is required
unsupported chain
asset not found
invalid limit parameter
limit must be greater than 0
Validation occurs in sequence. When testing limit errors, use a known-valid token address (e.g., WETH on Ethereum) to avoid hitting asset not found before the limit validation.

Integration Tips

Supported Networks

Use the Networks endpoint to discover supported chains.

One Asset Per Connection

Open separate connections for multiple assets. This endpoint streams a single token per connection.

Handle Precision

Parse numeric strings as numbers to preserve price precision in your client.

Reconnection Logic

Implement standard SSE reconnection patterns to handle network interruptions gracefully.

Next Steps

Get Support


FAQs

No. The streaming endpoint is public; no API keys or registration required.
This endpoint streams one asset per connection. For multiple assets, open separate connections.
Target emission is ~1 second per connection, subject to server load and network conditions.
Default to t_p_v3 (canonical). Use t_p_v2 for balance between stability and responsiveness, or t_p for maximum immediacy.
Implement standard SSE reconnection logic with exponential backoff on network failures.
Yes, this endpoint provides prices in USD. Numeric values are provided as strings to preserve precision.