saveNumberOfBuyOpenOrders = async (logger, symbols) => {
  const buyOpenOrders = await mongo.aggregate(
    logger,
    'trailing-trade-grid-trade-orders',
    [
      {
        $match: {
          key: {
            $regex: `(${symbols.join('|')})-grid-trade-last-buy-order`
          }
        }
      },
      {
        $project: {
          _id: 0,
          key: 1
        }
      }
    ]
  );

  const openOrders = _.map(buyOpenOrders, order =>
    order.key.replace('-grid-trade-last-buy-order', '')
  );

  await cache.hset(
    'trailing-trade-common',
    'open-orders-symbols',
    JSON.stringify(openOrders)
  );

  await cache.hset(
    'trailing-trade-common',
    'number-of-buy-open-orders',
    openOrders.length
  );
}
Save number of buy open orders and list of symbols with open orders

@param {*} logger
@param {*} symbols