Coinpaprika 1.0.0

The Coinpaprika async API.

Example node client:

import WebSocket from "ws";

try {
  const ws = new WebSocket("wss://streaming.coinpaprika.com/ticks", {
    headers: {
      Authorization: "API-TOKEN",
    },
  });
  const pingInterval = 120;
  const subscribePayload = {
    event: "subscribe",
    ids: ["btc-bitcoin", "eth-ethereum" ],
    quotes: ["BTC", "USD"]
  };

  let heartbeat: NodeJS.Timeout;

  ws.on("open", () => {
    heartbeat = setTimeout(
      (ws: WebSocket) => {
        ws.terminate();
      },
      2 * pingInterval * 1000,
      ws
    );
    ws.send(JSON.stringify(subscribePayload));
  });

  ws.on("ping", () => {
    clearTimeout(heartbeat);
  });

  ws.on("message", (data) => {
    console.log(data.toString());
  });
  ws.on("error", (err) => {
    console.log(`error on ws ${err}`);
  });
} catch (e) {
  console.log("no websocket srv");
}

Servers

  • streaming.coinpaprika.comwsspublic

    Production api with ticker data

    Security:
    • HTTP API key
      • Name: Authorization
      • In: header

Operations

  • SUB /ticks

    Send messages to the API

    Operation IDsendMessage

    Available only on servers:

    Accepts the following message:

    operation

    Subscribe to a topic on a single or multiple currencies.

    Message IDoperation
    object

    Examples

  • PUB /ticks

    Messages that you receive from the API

    Operation IDprocessMessage

    Available only on servers:

    Accepts the following message:

    currency

    Currency data.

    Message IDcurrency
    object

    Examples

Messages

  • #1ping

    Ping server to determine whether connection is alive

    Message IDping

    Client can ping server to determine whether connection is alive, server responds with pong. This is an application level ping as opposed to default ping in websockets standard which is server initiated

    object
    object
  • #2pong

    Pong is a response to ping message

    Message IDpong

    Server pong response to a ping to determine whether connection is alive. This is an application level pong as opposed to default pong in websockets standard which is sent by client in response to a ping

    object
  • #3operation

    Subscribe to a topic on a single or multiple currencies.

    Message IDoperation
    object
  • #4currency

    Currency data.

    Message IDcurrency
    object

Schemas

  • object
  • object
  • object
  • object
  • reqid
    integer

    Client originated ID reflected in response message.