Skip to content

Price Monitoring

Overview

The Realtime API is a stateful, event-based API that communicates over a WebSocket. The WebSocket connection requires the following parameters:

  • URL: wss://api.bmining.pro/v1/price
  • Headers:
    • Authorization: Bearer YOUR_API_KEY
Query Parameters
FieldTypeDescription
symbolStringOptional. The blockchain to monitor.

Below is a simple example using the popular ws library in Node.js to establish a socket connection, send a message from the client, and receive a response from the server. It requires that a valid API_KEY is exported in the system environment.

import WebSocket from "ws";
 
const url = "wss://api.bmining.pro/v1/price?symbol=BTC,ETH";
const ws = new WebSocket(url, {
  headers: {
    "Authorization": "Bearer " + process.env.API_KEY,
  },
});
 
ws.on("message", (message) => {
  console.log(JSON.parse(message.toString()));
});

Example

{
  "BTC": 93434.35,
  "ETH": 4092.28
}