Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
bittrexMarketFilter.filter(function(o,i){
bittrex.getticker( {market :o},function( response ) {
if(typeof response != 'undefined' && typeof response.Last != 'undefined'){
if(typeof bittrexMarketFilterRelation[i] != "undefined"){
// for the record :
var relation = bittrexMarketFilterRelation[i]
if(typeof Exchanges.bittrex[relation] == "undefined"){
Exchanges.bittrex[relation] = true
}
if(typeof response.Last == "undefined"){
return false
}
if (Exchanges.bittrex[relation] != response.Last) {
Exchanges.bittrex[relation] = response['Last'];
}
}else{
const getBidOrAsk = (coinStruct, tradeNum) => {
bittrex.getticker({market: coinStruct.markets[tradeNum]}, function(data, err) {
if (err) {
return console.error(err);
}
if (data.success === true) {
if (tradeNum === 0) {
let ask = data.result.Ask;
coinStruct.prices.push(ask);
getBidOrAsk(coinStruct, 1);
} else if (tradeNum === 1) {
let bid = data.result.Bid;
coinStruct.prices.push(bid);
getBidOrAsk(coinStruct, 2);
} else {
let bid = data.result.Bid;
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.getticker({market: currencyPair},function(response){
if(response.error){
reject(response.error);
} else {
resolve(response.result);
}
});
});
}