updateAccountInfo = async (logger, balances, lastAccountUpdate) => {
  logger.info({ balances }, 'Updating account balances');
  const accountInfo = await getAccountInfo(logger);

  const mergedBalances = _.merge(
    _.keyBy(accountInfo.balances, 'asset'),
    _.keyBy(balances, 'asset')
  );
  accountInfo.balances = _.reduce(
    _.values(mergedBalances),
    (acc, b) => {
      const balance = b;
      if (+balance.free > 0 || +balance.locked > 0) {
        acc.push(balance);
      }

      return acc;
    },
    []
  );

  // set updateTime manually because we are updating account info from websocket
  accountInfo.updateTime = lastAccountUpdate;

  await cache.hset(
    'trailing-trade-common',
    'account-info',
    JSON.stringify(accountInfo)
  );

  return accountInfo;
}
Update account info with new one

@param {*} logger
@param balances
@param lastAccountUpdate