node-yahoo-finance icon indicating copy to clipboard operation
node-yahoo-finance copied to clipboard

Date is off by one

Open jwallden opened this issue 8 years ago • 2 comments

Today it's October 2nd. When i do yahoofinance.snapshot({ symbol: 'AAPL', fields: ['c1', 'c', 'c6', 'k2', 'p2', 'd1', 'd2', 't1'] }, function(err, snapshot){ console.log(snapshot); }); i expect to get data from the last traded day, which is September 30th. However, I get data from September 29. This seems to be true even if i try to get historical data. Even if I set the 'to' date to today, I still get last data from September 29.

jwallden avatar Oct 02 '16 21:10 jwallden

I second that. the API is always showing 1 day less while using 'finance.historical'

sarjarapu avatar Oct 27 '17 17:10 sarjarapu

Confirming that the bug is from the Yahoo itself. Double checked the same via Browser / Charles as well.

Any time there is &period1=1508644800&period2=1509076800 kinda parameters in the query string, Yahoo is doing 1 day less than what you give. Temp fix sounds stupid but works! Give period2 or to value in this lib, 1 day higher

image

vs

image

sarjarapu avatar Oct 27 '17 18:10 sarjarapu