Skip to content

Commit

Permalink
Finexbox api support
Browse files Browse the repository at this point in the history
  • Loading branch information
campurro committed May 9, 2019
1 parent bc4dda9 commit 7acdad4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/market.js
Expand Up @@ -126,6 +126,32 @@ function getExchangeMarkets(exchange, callback) {
callback(null, data);
}, '/v1/ticker');
}

// Finexbox
else if (exchange == "finexbox") {
apiInterfaces.jsonHttpRequest('xapi.finexbox.com', 443, '', function(error, response) {
if (error) log('error', logSystem, 'API request to %s has failed: %s', [exchange, error]);

if (error) callback(error, {});
if (!response || !response.success) callback('No market informations', {});

var data = {};
for (var i in response.result) {
var ticker = response.result[i];
tickerParts = ticker.market.split('_');
var symbol = tickerParts[0];
var target = tickerParts[1];

var price = +parseFloat(ticker.price);
if (price === 0) continue;

if (!data[symbol]) data[symbol] = {};
data[symbol][target] = price;
}
if (!error) marketRequestsCache[cacheKey] = { ts: currentTimestamp, data: data };
callback(null, data);
}, '/v1/market');
}

// Crex24
else if (exchange == "crex24") {
Expand Down

0 comments on commit 7acdad4

Please sign in to comment.