In my app I display prices that I receive from Binance STORJ/BTC trade stream (green color):
and they slightly differs from 15 min STORJ/BTC
market chart on Binance website:
The maximum price I received about 2020/10/24 21:04 UTC+03 is 0.00003054 (displayed at the top left corner of the chart) while the maximum price Binance website displays is 0.00003128.
My application is in C++, but it receives the trades in the same way the following JavaScript code does:
const WebSocket = require('ws');
const ws = new WebSocket("wss://stream.binance.com:9443/stream");
ws.on('open', async () =>
{
const msg =
{
method: "SUBSCRIBE",
params: ["xrpusdt@trade", "ltcusdt@trade"],
id: 1
};
ws.send(JSON.stringify(msg));
});
ws.on('message', async message =>
{
console.log(message);
});
The last 500 trades can be received the the query https://api.binance.com/api/v3/trades?symbol=STORJBTC, but the price at 2020/10/24 21:04 UTC+03 is not available.
For example, with DIA/BTC pair my app did not miss a peak price 0.000111 and displayed exactly the same chart as Binance website, compare the screenshots:
And also with BLZ/BTC the price is correct:
It is probably because Binance website displays Kline/Candlestick data with a query like https://api.binance.com/api/v3/klines?symbol=STORJBTC&interval=15m&limit=500
Another example with LSK/BTC: