syncATHCandles = async (logger, symbols) => {
  await Promise.all(
    symbols.map(async symbol => {
      await mongo.deleteAll(logger, 'trailing-trade-ath-candles', {
        key: symbol
      });
      const symbolConfiguration = await getConfiguration(logger, symbol);

      const {
        buy: {
          athRestriction: {
            enabled: buyATHRestrictionEnabled,
            candles: {
              interval: buyATHRestrictionCandlesInterval,
              limit: buyATHRestrictionCandlesLimit
            }
          }
        }
      } = symbolConfiguration;

      const getCandles = async () => {
        if (buyATHRestrictionEnabled) {
          // Retrieve ath candles
          logger.info(
            {
              debug: true,
              function: 'candles',
              interval: buyATHRestrictionCandlesInterval,
              limit: buyATHRestrictionCandlesLimit
            },
            `Retrieving ATH candles from API for ${symbol}`
          );

          const athCandles = await binance.client.candles({
            symbol,
            interval: buyATHRestrictionCandlesInterval,
            limit: buyATHRestrictionCandlesLimit
          });

          const operations = athCandles.map(athCandle => ({
            updateOne: {
              filter: {
                key: symbol,
                time: +athCandle.openTime,
                interval: buyATHRestrictionCandlesInterval
              },
              update: {
                $set: {
                  open: +athCandle.open,
                  high: +athCandle.high,
                  low: +athCandle.low,
                  close: +athCandle.close,
                  volume: +athCandle.volume
                }
              },
              upsert: true
            }
          }));

          // Save ath candles for the symbol
          await mongo.bulkWrite(
            logger,
            'trailing-trade-ath-candles',
            operations
          );
        }
      };

      return getCandles();
    })
  );
}
Retrieve ATH candles for symbols from Binance API

@param {*} logger
@param {string[]} symbols