Skip to content

Commit

Permalink
Updated the stock information to the yahoo yql service. (#354)
Browse files Browse the repository at this point in the history
Added the change percentage.
  • Loading branch information
kurtdb authored and evancohen committed Jul 22, 2016
1 parent 023f086 commit 83dd214
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<div class="stock">
<div class="stock-information" ng-repeat="quote in stock">
<span><i class="fa fa-rss fade" style="margin-right: 5px";></i></span>
<span fade>{{quote.resource.fields.issuer_name}}: ${{quote.resource.fields.price | number : 3}}</span>
<span fade>{{quote.Name}}: ${{quote.LastTradePriceOnly | number : 3}} ({{quote.Change}}%)</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -200,7 +200,7 @@ <h2>{{ 'commands.title' | translate }}</h2>
<p></p>
<div><span class="fitbit-subtitle" ng-show="fbSleep.sleep[0]">{{'fitbit.sleepLastNight' | translate}}</span></div>
<div><span class="fitbit-item" ng-show="fbSleep.sleep[0]">{{(fbSleep.sleep[0].minutesAsleep/60 | number:2 )}} {{'fitbit.hours' | translate}} / {{fbSleep.sleep[0].minutesAwake }} min {{'fitbit.awake' | translate}} // {{(fbSleep.sleep[0].efficiency)}} % {{'fitbit.efficient' | translate}}</span></div>
<div><span class="fitbit-item" ng-show="fbSleep.sleep[0]">{{'fitbit.awake' | translate}}/{{'fitbit.restless' | translate}}: {{fbSleep.sleep[0].awakeCount}} / {{fbSleep.sleep[0].restlessCount}}</span></div>
<div><span class="fitbit-item" ng-show="fbSleep.sleep[0]">{{'fitbit.awake' | translate}}/{{'fitbit.restless' | translate}}: {{fbSleep.sleep[0].awakeCount}} / {{fbSleep.sleep[0].restlessCount}}</span></div>
<p></p>
<div><span class="fitbit-subtitle">{{'fitbit.deviceStatus' | translate}}</span></div>
<div class="" ng-repeat="device in fbDevices">
Expand Down
6 changes: 3 additions & 3 deletions js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
FitbitService.profileSummary(function(response){
$scope.fbDailyAverage = response;
});

FitbitService.todaySummary(function(response){
$scope.fbToday = response;
});
Expand Down Expand Up @@ -238,11 +238,11 @@

var getStock = function() {
StockService.getStockQuotes().then(function(result) {
$scope.stock = result.list.resources;
$scope.stock = result.query.results.quote;
}, function(error) {
console.log(error);
});
}
}

if (typeof config.stock !== 'undefined' && config.stock.names.length) {
registerRefreshInterval(getStock, 30);
Expand Down
2 changes: 1 addition & 1 deletion js/services/stock.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
service.getStockQuotes = function() {
var deferred = $q.defer();
if (config.stock.names.length) {
var url = 'http://finance.yahoo.com/webservice/v1/symbols/'+config.stock.names.join(',').toUpperCase()+'/quote?format=json&view=detail';
var url = 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quote%20where%20symbol%20in%20('+"'" + config.stock.names.join("','") + "'"+')&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&format=json';

$http.get(url).then(function(response) {
deferred.resolve(response.data);
Expand Down

0 comments on commit 83dd214

Please sign in to comment.