Agg trades startTime and endTime not working
cecilymiller opened this issue · comments
binance.aggTrades("BTCUSDT", { startTime: 1587704945000, endTime: 1587713502000 }, (error, response) => {
console.log('response', response); // empty, no results
})
If there is not a bug, that means there weren't any trade actions over 2 hours, which cannot be true.
I have tried several other startTime
and endTime
combinations and each time no trades are returned.
- use Error Handling or at least reporting for all financial applications
example:
binance.aggTrades( "BTCUSDT", { startTime, endTime }, ( error, response ) => {
if ( error ) return console.warn( error );
console.log( 'response', response );
} )
-
More than 1 hours between startTime and endTime are not allowed.
-
Binance downtime was during the window you specified: https://binance.zendesk.com/hc/en-us/articles/360042668671
-
Working example:
const oneHour = 60 * 60 * 1e3, now = new Date().getTime();
const startTime = now - oneHour, endTime = now;
const aggTrades = await binance.aggTrades( "BTCUSDT", { startTime, endTime } );
console.info( aggTrades );
Thanks for fast reply.
More than 1 hours between startTime and endTime are not allowed.
https://github.com/binance-exchange/binance-api-node#aggtrades - docs says the following:
startTime
andendTime
must be less than 24 hours.
That is from different API but I assume the both uses the same endpoints to fetch the data under the hood.
Anyway, thanks for your answer, I just wanted to point out that a bit misleading info