How do I fix this code?
getCandles = (ticker, time, amount) => {
return new Promise((resolve, reject) => {
let candles = [];
try {
binance.candlesticks(ticker, time, (error, ticks, symbol) => {
if (error) {
reject(error)
}
if (ticks.length != null || ticks.length != 0) {
ticks.forEach(tick => {
candles.push({
open: tick[1],
high: tick[2],
close: tick[4],
low: tick[3],
volume: tick[5],
time: tick[0]
})
})
resolve(candles);
} else {
reject(null)
}
}, { limit: amount });
} catch (e) {
reject(e)
}
})
}