added ftse to today
This commit is contained in:
parent
c6bb63fa6a
commit
94f7a4b944
10
ftsetest.js
Normal file
10
ftsetest.js
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
*
|
||||
* User: Martin Donnelly
|
||||
* Date: 2016-06-23
|
||||
* Time: 11:41
|
||||
*
|
||||
*/
|
||||
var ftse = require('ftse')('100', 10, 'risers', function(items) {
|
||||
console.log(items); // Array
|
||||
});
|
@ -55,6 +55,16 @@ html(lang="en")
|
||||
if data.fitbit.summary
|
||||
h2 Fitbit
|
||||
p Yesterday you walked #{data.fitbit.summary.steps} steps and covered #{data.fitbit.summary.distances[0].distance} km.
|
||||
.ftse
|
||||
if data.ftse
|
||||
h2 FTSE
|
||||
each line in data.ftse
|
||||
table
|
||||
tr
|
||||
td= line.name
|
||||
td= line.price
|
||||
td= line.change_amount
|
||||
td= line.change_percent
|
||||
.swedish
|
||||
h2 Word of the day
|
||||
p(style="font-weight:900;")= data.swedish.xml.words.word
|
||||
|
1665
lib/newdata.json
1665
lib/newdata.json
File diff suppressed because it is too large
Load Diff
13
lib/today.js
13
lib/today.js
@ -14,6 +14,7 @@ var trains = require('./today/trains');
|
||||
var history = require('./today/history');
|
||||
var mdMailer = require('./today/mailer');
|
||||
var mdFitbit = require('./today/fitbit');
|
||||
var todayFTSE = require('./today/todayftse');
|
||||
var db_name = 'silvrgit';
|
||||
var dbCouch = nano.use(db_name);
|
||||
|
||||
@ -21,7 +22,7 @@ require('sugar-date');
|
||||
|
||||
var todayCache = {
|
||||
last: 0, data: {
|
||||
trains: {last: 0, data: []}, weather: {}, history: [], today: '', tv: {entries: []}, cal: {today: [], tomorrow: [], week: []}, swedish: {}, fitbit: {}
|
||||
trains: {last: 0, data: []}, weather: {}, history: [], today: '', tv: {entries: []}, cal: {today: [], tomorrow: [], week: []}, swedish: {}, fitbit: {}, ftse:{}
|
||||
}, expire: ((60 * 1000) * 60)
|
||||
};
|
||||
var file = __dirname + '/' + 'newdata.json';
|
||||
@ -191,6 +192,14 @@ module.exports = {
|
||||
logger.error(e);
|
||||
});
|
||||
|
||||
todayFTSE.getFTSE()
|
||||
.then((d) => {
|
||||
todayCache.data.ftse = d;
|
||||
})
|
||||
.catch((e) => {
|
||||
logger.error(e);
|
||||
});
|
||||
|
||||
|
||||
for (var t = 0; t < calHandler.calendars.length;t++) {
|
||||
calHandler.getAdvancedCalV3(calHandler.calendars[t])
|
||||
@ -237,7 +246,7 @@ setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
// MdMailer.sendEmailV1(todayCache, __dirname);
|
||||
// saveToDB(todayCache);
|
||||
// saveData();
|
||||
saveData();
|
||||
}, 45000);
|
||||
cron.schedule('45 6 * * *', function() {
|
||||
module.exports.preLoadToday();
|
||||
|
30
lib/today/todayftse.js
Normal file
30
lib/today/todayftse.js
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
*
|
||||
* User: Martin Donnelly
|
||||
* Date: 2016-06-23
|
||||
* Time: 11:45
|
||||
*
|
||||
*/
|
||||
var ftse = require('ftse');
|
||||
|
||||
|
||||
module.exports = {
|
||||
|
||||
getFTSE: function() {
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
"use strict";
|
||||
|
||||
var err = 0;
|
||||
ftse('100', 10, 'risers', function(items) {
|
||||
|
||||
if (items === err) {
|
||||
return reject(err);
|
||||
}
|
||||
return resolve(items);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
};
|
@ -29,6 +29,7 @@
|
||||
"errorhandler": "^1.4.3",
|
||||
"express": "^4.13.4",
|
||||
"express-session": "^1.13.0",
|
||||
"ftse": "^1.0.6",
|
||||
"ical2json": "^0.2.0",
|
||||
"logger": "0.0.1",
|
||||
"method-override": "^2.3.5",
|
||||
|
Loading…
Reference in New Issue
Block a user