Skip to content

Instantly share code, notes, and snippets.

@junajan
Created January 5, 2017 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save junajan/4e1be6f7926e176fbd7c404470af8133 to your computer and use it in GitHub Desktop.
Save junajan/4e1be6f7926e176fbd7c404470af8133 to your computer and use it in GitHub Desktop.
var MarketData = require("barchart-market-data-api");
var code = "6c0c63ab7c0bc4d3ea113ad26789e64c"
var md = new MarketData(code);
var ops= {
startDate: '20100101',
endDate: '20170101',
maxRecords: 1000000
}
md.getHistory('IBM', 'dailyContinue', ops).then(function (history) {
console.log(" ===== LEN: %d =====", history.length)
console.log("FIRST:", history[0])
console.log("LAST:", history[history.length - 1])
// console.log('History data:', history);
});
============= RES =============
===== LEN: 505 =====
FIRST: { symbol: 'IBM',
timestamp: '2015-01-05T00:00:00-05:00',
tradingDay: '2015-01-05',
open: 150.4377,
high: 150.4377,
low: 148.4974,
close: 148.7959,
volume: 5231706,
openInterest: null }
LAST: { symbol: 'IBM',
timestamp: '2017-01-04T00:00:00-05:00',
tradingDay: '2017-01-04',
open: 167.77,
high: 169.87,
low: 167.36,
close: 169.26,
volume: 3381400,
openInterest: null }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment