Gains in the technology and financial sectors helped Canada’s main stock index eke out a slight rise Monday, while U.S. markets climbed higher.

The overall market gains came as investors focused more on economic fundamentals and less on geopolitical tensions in the continuing ping pong match between the two, said Craig Fehr, a Canadian markets strategist with Edward Jones in St. Louis.

“This swing between optimism and pessimism has been driven by the balance of those two issues, and I would say today we’re continuing to get a bit more focus on those broader fundamentals.”

Trade tensions climbed last week after U.S. President Donald Trump said he was going ahead with metal tariffs on production from key allies including Canada.

The market reaction has been fairly muted as investors have already largely digested the increased trade uncertainty over recent weeks, while fears of a wider trade war remain contained, said Fehr.

“The prevailing view remains that we’re not going to see an outright, full-blown global trade war, instead we’re going to see some agreements ultimately being made, but that the process of getting there is going to be a little more choppy.”

As the G7 countries meet in Quebec this week there could, however, be more sparks on trade disputes and market reactions, he said.

“Obviously we aren’t seeing it manifest today, but it doesn’t mean it won’t show up as the week progresses, and I expect we would see that.”

The S&P/TSX composite index closed up 8.70 points at 16,052.24, as losses in energy and mining stocks from dropping commodity prices weighed on the index.

In New York, the Dow Jones industrial average closed up 178.48 points at 24,813.69. The S&P 500 index closed up 12.25 points at 2,746.87 and the Nasdaq composite index ended up 52.13 points at 7,606.46, a record high.

The Canadian dollar averaged US77.35¢, up 0.21 of a U.S. cent.

The IMF said Monday it expects the Canadian economy, which grew by 3% last year, to slow to growth of 2.1% in 2018 and 2.% in 2019.

In its report, the IMF noted the housing market continues to remain a key domestic risk for the economy. But, it said that the vulnerability has moderated somewhat, as the housing market has shown signs of cooling down.

Statistics out Monday on the Greater Toronto Area housing market showed home sales in May were down 22.2% compared with the same month last year, while the average selling price for all home types combined fell 6.6% to $805,320.

The July crude contract ended down US$1.06 at US$64.75 per barrel and the July natural gas contract was down US3¢ at US$2.93 per mmBTU.

The August gold contract closed down US$2 at US$1,297.30 an ounce and the July copper contract ended up US4¢ at US$3.14 a pound.

Cenovus Energy Inc. closed down 77¢ or 5.73% to $12.67 after a Reuters report that ConocoPhillips was looking to sell its $2.6 billion stake in the company.