Skip to content

fix(ws): use !miniTicker@arr for spot prevDay stream#979

Open
pcriadoperez wants to merge 1 commit intoccxt:masterfrom
pcriadoperez:978
Open

fix(ws): use !miniTicker@arr for spot prevDay stream#979
pcriadoperez wants to merge 1 commit intoccxt:masterfrom
pcriadoperez:978

Conversation

@pcriadoperez
Copy link
Contributor

@pcriadoperez pcriadoperez commented Mar 15, 2026

Summary

  • Replaces !ticker@arr with !miniTicker@arr in the spot prevDayStream function

Closes #978

The !ticker@arr stream has been removed from Spot Testnet and is
expected to be removed from mainnet. Replace with !miniTicker@arr
as recommended by Binance docs.

Futures and delivery streams are unchanged as they still support
!ticker@arr.

Closes ccxt#978
@pcriadoperez
Copy link
Contributor Author

Test Results

Ran the following script against Spot Testnet to verify the fix:

import Binance from './dist/node-binance-api.js';

const binance = new Binance().options({
    APIKEY: '',
    APISECRET: '',
    test: true, // use testnet
});

const TIMEOUT = 15000;
let received = false;

console.log('Testing prevDay stream (now uses !miniTicker@arr)...');
console.log(`Timeout set to ${TIMEOUT / 1000}s\n`);

const timer = setTimeout(() => {
    if (!received) {
        console.error('FAIL: No data received within timeout');
        process.exit(1);
    }
}, TIMEOUT);

binance.websockets.prevDay(undefined, (error, response) => {
    if (error) {
        console.error('FAIL: Error received:', error);
        clearTimeout(timer);
        process.exit(1);
    }

    if (!received) {
        received = true;
        console.log('SUCCESS: Received data from !miniTicker@arr stream');
        console.log('Symbol:', response.symbol);
        console.log('Fields present:', Object.keys(response).join(', '));

        // These fields should be present from miniTicker
        const expectedFields = ['eventType', 'eventTime', 'symbol', 'close', 'open', 'high', 'low', 'volume', 'quoteVolume'];
        const missing = expectedFields.filter(f => response[f] === undefined);
        if (missing.length) {
            console.error('FAIL: Missing expected fields:', missing.join(', '));
        } else {
            console.log('All expected miniTicker fields present');
        }

        // These fields are NOT available in miniTicker (will be undefined)
        const unavailable = ['priceChange', 'percentChange', 'bestBid', 'bestAsk', 'numTrades'];
        const present = unavailable.filter(f => response[f] !== undefined);
        if (present.length) {
            console.log('Note: Full ticker fields also present:', present.join(', '));
        } else {
            console.log('Confirmed: Full ticker-only fields are undefined (expected with miniTicker)');
        }

        clearTimeout(timer);
        process.exit(0);
    }
});

Output

Testing prevDay stream (now uses !miniTicker@arr)...
Timeout set to 15s

SUCCESS: Received data from !miniTicker@arr stream
Symbol: BTCUSDT
Fields present: eventType, eventTime, symbol, priceChange, percentChange, averagePrice, prevClose, close, closeQty, bestBid, bestBidQty, bestAsk, bestAskQty, open, high, low, volume, quoteVolume, openTime, closeTime, firstTradeId, lastTradeId, numTrades
All expected miniTicker fields present
Confirmed: Full ticker-only fields are undefined (expected with miniTicker)

The stream connects successfully on testnet. All miniTicker fields have values; full-ticker-only fields (priceChange, percentChange, bestBid, bestAsk, numTrades) are undefined as expected since !miniTicker@arr doesn't provide them.

@pcriadoperez pcriadoperez marked this pull request as ready for review March 15, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The !ticker@arr stream doesn't work anymore at Spot Testnet

1 participant