Skip to content

Instantly share code, notes, and snippets.

@Anderson-Juhasc
Last active December 23, 2015 18:33
Show Gist options
  • Save Anderson-Juhasc/c3b1df4318daf1206220 to your computer and use it in GitHub Desktop.
Save Anderson-Juhasc/c3b1df4318daf1206220 to your computer and use it in GitHub Desktop.
var symbol = "R$"
, timer = 10000;
getTicker();
setInterval(function(){
getTicker();
}, timer);
function getTicker() {
$.ajax({
type: "GET",
url: "http://query.yahooapis.com/v1/public/yql",
jsonp: "callback",
dataType: "jsonp",
data: {
q: 'select * from html where url = "https://api.blinktrade.com/api/v1/BRL/ticker"',
format: 'json'
},
success: function(response) {
console.log(response);
var data = $.parseJSON(response.query.results.body),
last = data.last.toFixed(2),
bid = data.buy.toFixed(2),
ask = data.sell.toFixed(2)
vol = data.vol.toFixed(8);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment