pilwon / node-yahoo-finance

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

Not working for symbol having '&' #29

Closed jiteshanand closed 5 years ago

jiteshanand commented 7 years ago

It is not working for symbol having '&' in them.

For example 'M&M.NS' and when I tried on yahoo finance with the same symbol, It works.

P.S. I have also tried with 'M%26M.NS'.

Thanks

ChristianTreo commented 5 years ago

Works for me:

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

yahooFinance.historical({
  symbol: 'M&M.NS',
  from: '2019-07-01',
  to: '2019-07-08',
  period: 'd'  // 'd' (daily), 'w' (weekly), 'm' (monthly), 'v' (dividends only)
}, function (err, quotes) {
    if (err) {
        console.log (err)
    } else {
        console.log (quotes)
    }

});

Results in:

[ { date: 2019-07-08T04:00:00.000Z,
    open: 640.349976,
    high: 645.200012,
    low: 626.200012,
    close: 635.849976,
    adjClose: 635.849976,
    volume: 3903971,
    symbol: 'M&M.NS' },
  { date: 2019-07-05T04:00:00.000Z,
    open: 672,
    high: 675.299988,
    low: 638.5,
    close: 642.049988,
    adjClose: 642.049988,
    volume: 3039710,
    symbol: 'M&M.NS' },
  { date: 2019-07-04T04:00:00.000Z,
    open: 671.5,
    high: 674.200012,
    low: 665.299988,
    close: 672.150024,
    adjClose: 672.150024,
    volume: 1777421,
    symbol: 'M&M.NS' },
  { date: 2019-07-03T04:00:00.000Z,
    open: 668.950012,
    high: 675,
    low: 663.299988,
    close: 669.25,
    adjClose: 669.25,
    volume: 2615478,
    symbol: 'M&M.NS' },
  { date: 2019-07-02T04:00:00.000Z,
    open: 661,
    high: 668.5,
    low: 656.299988,
    close: 666.25,
    adjClose: 666.25,
    volume: 2275170,
    symbol: 'M&M.NS' },
  { date: 2019-07-01T04:00:00.000Z,
    open: 657.299988,
    high: 663.450012,
    low: 654.450012,
    close: 660,
    adjClose: 660,
    volume: 3547891,
    symbol: 'M&M.NS' } ]
ChristianTreo commented 5 years ago

Perhaps it's time to close this one...

pilwon commented 5 years ago

@ChristianTreo Thanks-