Add Exbitron API to price feeds. Other minor changes
This commit is contained in:
@@ -137,6 +137,33 @@ function getExchangeMarkets (exchange, callback) {
|
||||
callback(null, data);
|
||||
}, '/v1/ticker');
|
||||
}
|
||||
// Exbitron
|
||||
else if (exchange == "exbitron") {
|
||||
apiInterfaces.jsonHttpRequest('api.exbitron.digital', 443, '', function (error, response) {
|
||||
if (error) log('error', logSystem, 'API request to %s has failed: %s', [exchange, error]);
|
||||
|
||||
let data = {};
|
||||
if (!error && response && response.status === "OK" && response.data) {
|
||||
let market = response.data.market;
|
||||
let pairParts = market.id.split('-');
|
||||
let symbol = pairParts[0];
|
||||
let target = pairParts[1];
|
||||
|
||||
let price = +market.marketDynamics.lastPrice;
|
||||
if (price !== 0) {
|
||||
if (!data[symbol]) data[symbol] = {};
|
||||
data[symbol][target] = price;
|
||||
}
|
||||
}
|
||||
|
||||
if (!error) marketRequestsCache[cacheKey] = {
|
||||
ts: currentTimestamp,
|
||||
data: data
|
||||
};
|
||||
callback(null, data);
|
||||
}, '/api/v1/trading/info/' + config.symbol + '-USDT');
|
||||
}
|
||||
|
||||
|
||||
// Crex24
|
||||
else if (exchange == "crex24") {
|
||||
|
||||
Reference in New Issue
Block a user