pilwon / node-yahoo-finance

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

Historical returns an extra row for LSE symbos with null prices (e.g. VOD.L) #64

Open ChristianTreo opened 5 years ago

ChristianTreo commented 5 years ago

When running historical quotes on any LSE stock, (with the *.L notation), historical() returns an extra day with null prices - see example below.

You can change the symbol between a US Stock, such as AAPL, and you won't get the additional day. It may be that yahoo doesn't provide a price for the most recent date in some cases (and in this example). Perhaps your code is expecting a number of days, and adding in the extra one - just a thought.

var yahooFinance = require('yahoo-finance');

yahooFinance.historical({
  symbol: 'GLEN.L',
  from: '2019-07-03',
  to: '2019-07-05',
  // period: 'd'  // 'd' (daily), 'w' (weekly), 'm' (monthly), 'v' (dividends only)
}, function (err, quotes) {
    if (err) {
        console.log (err)
}
console.log (quotes)

});
/*

[ { date: Thu Jul 04 2019 05:00:00 GMT+0100 (British Summer Time), 
    open: 275.700012, 
    high: 276.5, 
    low: 271.600006, 
    close: 272.700012, 
    adjClose: 272.700012, 
    volume: 30167384, 
    symbol: 'GLEN.L' }, 
  { date: Wed Jul 03 2019 05:00:00 GMT+0100 (British Summer Time), 
    open: 277.899994, 
    high: 280.549988, 
    low: 275.700012, 
    close: 276.850006, 
    adjClose: 276.850006, 
    volume: 53012321, 
    symbol: 'GLEN.L' }, 
  { date: Tue Jul 02 2019 05:00:00 GMT+0100 (British Summer Time), 
    open: null, 
    high: null, 
    low: null, 
    close: null, 
    adjClose: null, 
    volume: null, 
    symbol: 'GLEN.L' } ] 
*/