pilwon / node-yahoo-finance

Yahoo Finance historical quotes and snapshot data downloader written in Node.js
491 stars 123 forks source link

Date is off by one #28

Open jwallden opened 7 years ago

jwallden commented 7 years ago

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.

sarjarapu commented 6 years ago

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

sarjarapu commented 6 years ago

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