Last active
December 23, 2015 18:33
-
-
Save Anderson-Juhasc/c3b1df4318daf1206220 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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