Investors might capture upside and limit risk by focusing on companies reporting earnings next week with a history of beating Wall Street expectations. The first full week of August is another busy one for second-quarter earnings, with 122 companies in the S & P 500 — or nearly a quarter of the benchmark — slated to share results. Disney and McDonald’s are among the headliners, with restaurant, travel, pharmaceutical and energy stocks dominating. Second-quarter earnings have been coming in strong so far. Of the 298 companies in the S & P 500 that have already reported, about 82% have exceeded Wall Street analysts’ earnings expectations. Nearly 80% have also posted an upside revenue surprise. Stocks can rally if earnings impress analysts. With this in mind, CNBC Pro screened data from Bespoke Investment Group, looking for stocks that are due to report next week that have a history of beating earnings expectations and then rising on the back of those results. To be included in the table below, stocks had to meet the following criteria: Beat earnings expectations at least 75% of the time On average, rise at least 2% on the first trading day after earnings Shopify is one company that could see gains next week, if the past is any guide. The cloud-based e-commerce platform has an 85% earnings beat rate and an average post-earnings gain of 3.3%. Shares of Shopify have gained 11% this year. In July, Needham analyst Scott Berg initiated research coverage of the stock with a buy rating and a $135 price target, implying upside of about 10% from Shopify’s Thursday close. “While Shopify is widely considered a generational software company, we believe the company remains in only the mid-cycle of a durable growth opportunity,” Berg wrote. The Trade Desk has a history of rising 7.2%, on average, in the next session after it reports, and of beating analysts’ earnings expectations 94% of the time. Although the digital advertising stock has slumped 30% this year, it ended July with a 21% gain, helped by its entry into the benchmark S & P 500 index in mid-July. “We view the inclusion as additional confirmation of TTD’s very impressive fundamentals and as additional confirmation of the centrality of the Internet Sector, as TTD becomes the 13th ‘Net company added to the index,” wrote Evercore ISI, which upgraded Trade Desk to an outperform rating in late June. The researcher’s target price of $90 implies that shares could add almost 4% from Thursday’s close. If past is prologue, building products manufacturer Trex , down 8% this year, could also see a post-earnings lift next week. The company has beaten earnings estimates 79% of the time and has, on average, risen 2.1% after reporting earnings. In July, Baird upgraded shares to an outperform rating from neutral. “We think relatively stable sell-out trends should be positive for sentiment, particularly with relative valuation near multi-year lows,” wrote analyst Timothy Wojs. “Material conversion, new products and railing attachment initiatives provide company-specific levers for underlying market outgrowth.” In the same note, Wojs raised his price target to $75 per share from $65, implying potential upside of 17% over the next 12 months.