fix(ws): use !miniTicker@arr for spot prevDay stream#979
Open
pcriadoperez wants to merge 1 commit intoccxt:masterfrom
Open
fix(ws): use !miniTicker@arr for spot prevDay stream#979pcriadoperez wants to merge 1 commit intoccxt:masterfrom
pcriadoperez wants to merge 1 commit intoccxt:masterfrom
Conversation
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
Contributor
Author
Test ResultsRan 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);
}
});OutputThe stream connects successfully on testnet. All miniTicker fields have values; full-ticker-only fields (priceChange, percentChange, bestBid, bestAsk, numTrades) are |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
!ticker@arrwith!miniTicker@arrin the spotprevDayStreamfunctionCloses #978