saveSymbolConfiguration = async (
  logger,
  symbol = null,
  configuration = {}
) => {
  if (symbol === null) {
    // If symbol is not provided, then return empty.
    return {};
  }

  const oldConfiguration = await getSymbolConfiguration(logger, symbol);

  const result = await mongo.upsertOne(
    logger,
    'trailing-trade-symbols',
    {
      key: `${symbol}-configuration`
    },
    {
      key: `${symbol}-configuration`,
      ...configuration
    }
  );

  await cache.hdel('trailing-trade-configurations', symbol);

  // reset symbol websockets only when candles or ath candles are changed
  if (
    _.isEqual(
      _.get(oldConfiguration, 'candles', {}),
      _.get(configuration, 'candles', {})
    ) === false ||
    _.isEqual(
      _.get(oldConfiguration, ['buy', 'athRestriction', 'candles'], {}),
      _.get(configuration, ['buy', 'athRestriction', 'candles'], {})
    ) === false
  ) {
    PubSub.publish('reset-symbol-websockets', symbol);
  }

  return result;
}
Save symbol configuration to mongodb

@param {*} logger
@param {*} symbol
@param {*} configuration