Wednesday was a downbeat day for the stock market, as major market benchmarks fell sharply in yet another disappointing failure for the Dow Jones Industrials to hit the 20,000 mark. The Dow was off more than 100 points, and the S&P 500 and Nasdaq Composite posted even steeper percentage declines as the end of the year approached. The decline in the market was broad-based, with every major sector giving up at least some ground, and tech stocks were among the biggest losers on the day. Still, some stocks managed to post solid gains, and Sandstorm Gold (NYSEMKT:SAND), Weis Markets (NYSE:WMK), and Intercept Pharmaceuticals (NASDAQ:ICPT) performed quite well even in a down market. Below, we'll look more closely at these stocks to tell you why they did so well.

Image source: Getty Images.

Sandstorm keeps buying as projects progress

Sandstorm Gold climbed 7% after the Canadian mining company provided its latest update on various projects in which it holds royalty interests and also discussed its ongoing stock buyback program. Sandstorm said that over the past couple of weeks, it has bought back more than 545,000 shares of its stock, spending an average of C$4.56 per share on its buybacks. That level of activity is close to the maximum that the company can buy under the rules governing what are known in Canada as normal course issuer bids. In addition, progress at the Coringa mine in Brazil, the Hot Maden and Ergama projects in Turkey, and the Bayan Khundii project in Mongolia continue to go well, with Sandstorm owning royalties of 2% to 2.5%. If those projects keep going well, then Sandstorm should share in their success.

Weis looks appetizing

Weis Markets climbed 13%, hitting a new all-time record high as interest in the regional supermarket chain reached a fevered pitch. The Pennsylvania-based grocery chain didn't report anything particularly noteworthy today, but Weis has been working to try to boost the pace of its growth through initiatives like strategic pricing investments, targeted promotional activity, and loyalty program incentives that have driven traffic higher. Given the size of the gains today, it's likely that at least some investors think that Weis could be a target for a possible acquisition, perhaps from a larger national player seeking a greater presence in the northeastern part of the country. Nevertheless, it'll be interesting to see if any confirmation of those beliefs surfaces in the coming weeks.

Intercept regains lost ground

Finally, Intercept Pharmaceuticals picked up 9%. Investors are apparently looking at the biopharmaceutical company as a potential bargain-shopping opportunity, especially because the stock has been under considerable pressure throughout 2016. Even after today's gains, Intercept remains down by about a quarter from where it started the year. Yet investors seem to be acknowledging the considerable progress that the company has made in its work toward serving the market for non-alcoholic steatohepatitis with its Ocaliva drug, which is currently approved for treating the liver disease primary biliary cholangitis. Intercept shares will likely remain volatile as the fate of the biotech industry remains unclear, but if things go well for this particular indication, Intercept could buck a downward trend even if its peers continue to suffer.