The stock market had a mixed day on Wednesday, with gains for the Dow Jones Industrial Average coming largely at the expense of the tech-heavy Nasdaq Composite, as well as smaller-company stocks. Investors were encouraged by solid economic data showing strength in the housing market, and strength in the financial sector was especially helpful for the Dow. Nervousness about potential regulation of high-flying tech stocks dampened market sentiment to some extent, but a few individual stocks posted sizable gains. GW Pharmaceuticals (GWPH), Baidu (BIDU 0.70%), and W&T Offshore (WTI -1.66%) were among the best performers on the day. Here's why they did so well.

GW rises on pot boom

Shares of GW Pharmaceuticals finished higher by 3% on a good day for just about every stock that has any connection to the cannabis industry. GW was far from the best performer on the day, with some pot producers seeing their shares soar by more than 90% at certain points on Wednesday. With the Canadian recreational marijuana market set to open near the middle of October, companies that produce and distribute cannabis have taken center stage. But GW's cannabidiol-based Epidiolex gained approval from the U.S. Food and Drug Administration in June as a treatment for childhood-onset epilepsy, and in the long run, cannabis-derived drugs could be a much bigger growth play than the recreational pot market.

Laboratory with person in white lab coat looking at an amber-colored sphere with other equipment nearby.

Image source: GW Pharmaceuticals.

Baidu bounces back

Baidu climbed 4% as the Chinese search engine giant earned a welcome reprieve from what has been a tough period for stocks in the Middle Kingdom. The combination of a strong U.S. dollar and threats of tariffs and other trade barriers against China and other countries has cooled enthusiasm about investing in emerging-market stocks more broadly, and even high-profile, well-established companies like Baidu have seen their shares give up ground. Yet with the company moving into other areas like artificial intelligence, Baidu is looking to take its search prowess and expand its scope to grab a larger addressable market. That's potentially good news for Baidu investors in the long run.

W&T watches oil rise

Finally, shares of W&T Offshore picked up 8%. Wednesday was a good session for the oil sector generally, with crude prices picking up more than $1 per barrel to finish above the $71 level. That's welcome news for W&T, which has had to deal with some internal issues, including the recent departure of its long-tenured chief financial officer last month. Particularly in the offshore area, where costs are typically higher than with land-based drilling operations, price levels play a key role. If crude can climb from here, it could help W&T make more profit on the wells it works in the Gulf of Mexico.