Fix currency endpoint
This commit is contained in:
parent
5fc20a59a1
commit
a51ed583fa
@ -17,12 +17,12 @@ CurrencyController.prototype.index = function(req, res) {
|
|||||||
var currentTime = Date.now();
|
var currentTime = Date.now();
|
||||||
if (self.bitstampRate === 0 || currentTime >= (self.timestamp + self.currencyDelay)) {
|
if (self.bitstampRate === 0 || currentTime >= (self.timestamp + self.currencyDelay)) {
|
||||||
self.timestamp = currentTime;
|
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) {
|
if (err) {
|
||||||
self.node.log.error(err);
|
self.node.log.error(err);
|
||||||
}
|
}
|
||||||
if (!err && response.statusCode === 200) {
|
if (!err && response.statusCode === 200) {
|
||||||
self.bitstampRate = parseFloat(JSON.parse(body).last);
|
self.bitstampRate = parseFloat(JSON.parse(body)[0].price_usd);
|
||||||
}
|
}
|
||||||
res.jsonp({
|
res.jsonp({
|
||||||
status: 200,
|
status: 200,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user