pilwon / node-yahoo-finance

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

j2 - not available #18

Open brianrising opened 8 years ago

brianrising commented 8 years ago

Using the snapshot sample, when I enter j2 (shares outstanding) as a field "N/A" is returned. When I download the csv independently it's there. Tried to find a solution but a bit new to node/javascript and finding debugging difficult. Any help would be appreciated.

Brian

Here's the call.

var yahooFinance = require('yahoo-finance'); var SYMBOL = 'SWKS'; var util = require('util');

yahooFinance.snapshot({ symbol: SYMBOL, fields: ['s', 'x', 'n', 'j1', 'j2']

}, function (err, snapshot) { //... if (err) { throw err; } console.log(util.format('=== %s ===', SYMBOL).cyan); console.log(JSON.stringify(snapshot, null, 2));

});

brianrising commented 8 years ago

Hi,

I found 'j2' appearing sanitizeSnapshotOptions (index.js) and removed it.

// Avoid CSV column result mis-alignment (000,000,000). options.fields = _.without(options.fields, 't6', 'f6', 'a5', 'b6', 'k3', 's6');

a few tests with companies that have comma's in the name (can cause misalignment in the CSV) and it's behaving itself.

{ "symbol": "SAN", "sharesOutstanding": "15272727000", "name": "Banco Santander, S.A. Sponsored", "marketCapitalization": "81.56B", "stockExchange": "NYQ", "bid": 5.39 }

So far so good.