What happened

Shares of Valero Energy (VLO 0.86%) declined 11.7% in August, according to data provided by S&P Global Market Intelligence. Weighing on the refining stock was its second-quarter results and the impact that the U.S.-China trade war could have on its business.

So what

Valero earned $612 million, or $1.47 per share, during the second quarter. While that matched analysts' expectations, it was about 23% below the year-ago period. The company experienced weakness in both its refining and ethanol segments. Refining earnings tumbled 29% due to weaker margins, while profitability in its ethanol segment plunged 84% due to higher corn prices. Those weak spots offset a more than 150% surge in renewable-diesel earnings.

An ariel shot of a refinery by the water.

Image source: Getty Images.

Another issue last month was the growing trade dispute between the U.S. and China, which will likely put more pressure on earnings in the coming quarters. Uncertainty stemming from the conflict is already weighing on demand for commodities, which are piling up in storage and pushing down prices. Ethanol storage levels, for example, are up 4% this year and 16% from 2016, which has caused the price of the corn-based fuel to tumble more than 25% since June. That will keep the pressure on Valero's ethanol business.

Adding to the issues in the ethanol market is the Trump Administration's biofuel policy. The administration granted waivers exempting several refineries from requirements to blend ethanol into the country's fuel supply, which has angered the corn industry. This tug of war between refiners and farmers is adding more volatility to the refining market.

Now what

Valero's margins were pressured in the second quarter by the trade war's impact on the company's refining and ethanol businesses. Its struggles will likely continue in the near term since the issues plaguing the industry don't appear as if they'll go away anytime soon.

But the refining sector could get a boost next year, when a new global fuel standard goes into effect, which should drive demand for low-sulfur fuel from the shipping industry. Increased demand for that higher-valued product could boost the margins of refiners like Valero, which could help lift its stock price in the next year.