Fix currency endpoint

This commit is contained in:
Sky Young 2018-05-18 15:22:16 -07:00
parent 5fc20a59a1
commit a51ed583fa

View File

@ -17,12 +17,12 @@ CurrencyController.prototype.index = function(req, res) {
var currentTime = Date.now();
if (self.bitstampRate === 0 || currentTime >= (self.timestamp + self.currencyDelay)) {
self.timestamp = currentTime;
request('https://www.bitstamp.net/api/ticker/', function(err, response, body) {
request('https://api.coinmarketcap.com/v1/ticker/florincoin/', function(err, response, body) {
if (err) {
self.node.log.error(err);
}
if (!err && response.statusCode === 200) {
self.bitstampRate = parseFloat(JSON.parse(body).last);
self.bitstampRate = parseFloat(JSON.parse(body)[0].price_usd);
}
res.jsonp({
status: 200,