Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
initExchangeInfo: function(next) {
binance.exchangeInfo(function(error, data) {
if(data.symbols) {
for(var obj of data.symbols ) {
var filters = {status: obj.status};
for (var filter of obj.filters) {
if ( filter.filterType == "MIN_NOTIONAL" ) {
filters.minNotional = filter.minNotional;
}
else if ( filter.filterType == "PRICE_FILTER" ) {
filters.minPrice = filter.minPrice;
filters.maxPrice = filter.maxPrice;
filters.tickSize = filter.tickSize;
}
else if ( filter.filterType == "LOT_SIZE" ) {
filters.stepSize = filter.stepSize;
filters.minQty = filter.minQty;
filters.maxQty = filter.maxQty;
return new Promise((resolve, reject) => {
return binance.exchangeInfo((error, data) => {
if (error) return reject(error);
let symbols = [];
let tickers = [];
data.symbols.map(obj => {
if (obj.status !== 'TRADING') return;
symbols.push(obj.baseAsset);
tickers.push(obj.symbol);
});
MarketDataService.tickers = tickers;
MarketDataService.symbols = symbols.filter((sym, index, self) => {
return self.indexOf(sym) === index;
});