Shares of Canadian Solar (NASDAQ:CSIQ) are up 50% so far in 2017, a surprising result for a company that's barely making money. But the performance was driven largely by low expectations coming into the year and solar energy's surprisingly strong year. 

What's less clear is if Canadian Solar's performance will continue into 2018. Here's a look at why 2017 was so good and what to expect next year. 

Solar panels on a roof with a sunny sky in the background.

Image source: Getty Images.

2017 was a year of surprises

If you look back to the beginning of 2017, the expectations for solar demand were very low. GTM Research, which has its finger on the pulse of the industry, predicted last year that global 2017 solar installations would fall 10% in 2017 from 2016's record of 73 GW. Weakening policies in the U.S., China, and Japan were seen as big negatives for the industry. 

The reality is that, with just over a month left in the year, there's a possibility 100 GW of new solar systems will be installed in 2017. China alone looks like it will install over 50 GW, which has been a big demand pull for a Chinese solar manufacturer like Canadian Solar.

U.S. demand has been a surprise, too. The threat of solar tariffs has forced solar installers to rush solar-panel purchases, and even stockpile solar panels for installation in 2018. The result was much stronger demand than most solar companies expected. 

There's no windfall for Canadian Solar

What's surprising given the demand is that there hasn't been a windfall of profits for Canadian Solar. The company is barely breaking even, despite shipping more solar panels than ever before. 

CSIQ Revenue (TTM) Chart

CSIQ Revenue (TTM) data by YCharts.

The simple reason for the weak financial performance is that low solar-panel prices are putting tremendous pressure on margins. Solar-panel prices fell from around $0.60 per watt in early 2016 to $0.40 per watt in late 2016 and haven't recovered since. Higher demand can make up some revenue, but cost reductions didn't keep pace, and that's pressuring margins. 

On top of the top-line pressure, solar manufacturers are pointing out that prices for polysilicon, which is a raw material used to make solar cells, have been rising as global demand has jumped. And Chinese tariffs on imports from the U.S. and South Korea have meant higher costs for companies like Canadian Solar. 

A rising stock price doesn't always make sense

2017 has definitely been better than expected when it comes to solar demand, but that hasn't meant strong profitability for Canadian Solar. Pressure on margins continues and is taking hold, just as competitors are investing heavily to make higher-efficiency solar cells based on mono-PERC technology. Canadian Solar won't be left behind in the race for mono-PERC capacity, but some older equipment may become obsolete, and I don't see a big jump in margins on the horizon.

If bottom-line pressure continues in 2018, which I expect it will, the fundamentals may take a bite out of Canadian Solar's stock, making 2017's gain an outlier long term.