Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function buildAcceptableSymbolsList() {
bittrex.getmarketsummaries(function(marketData, err) {
marketData.result.forEach(function(market) {
if (
market.MarketName &&
market.MarketName.indexOf("BTC-") === 0
) {
var symbol = market.MarketName.split("BTC-")[1];
if (symbol && symbol.toLowerCase) {
acceptableSymbolsList.push(symbol.toLowerCase());
}
}
});
});
}
router.get('/tickers', function(req, res, next) {
bittrex.getmarketsummaries(function(data, err) {
if (err) {
return console.error(err);
}
var tickers = []
for (var i in data.result) {
bittrex.getticker({ market: data.result[i].MarketName }, function(ticker) {
tickers.push(ticker)
if (tickers.length === Object.keys(data.result).length) {
res.json(tickers)
}
});
}
});
});
return new Promise(function(resolve, reject){
bittrex.getmarketsummaries(function(data){
if(data.error){
reject(data.error);
} else {
resolve(data.result);
}
});
});
}