The Canadian dollar strengthened on Friday to a three-and-a-half-week high against its broadly weaker U.S. counterpart, supported in part by higher oil prices and by investors who had sold the Canadian dollar buying it back to reduce their exposure to the currency.

Speculators ramped up bearish bets on the Canadian dollar to a record high, data from the Commodity Futures Trading Commission and Reuters calculations showed. Canadian dollar net short positions surged to 98,000 contracts as of May 16 from 86,215 a week earlier.

The loonie had hit a 14-month low at $1.3793 earlier in May, pressured in part by a more uncertain trade outlook with the United States as well as worries over the Canadian housing market.

"Both of those really led to an excessive amount of short positioning," said Bipan Rai, executive director and senior macro strategist at CIBC Capital Markets, noting that the futures market, a barometer of market sentiment toward the Canadian dollar, was at an all-time low.

"That's somewhat surprising given we're expecting four per cent annualized growth for the GDP this quarter. So one of those things had to give," said Rai, adding that the market saw some of the short positions clear out on Friday.

The loonie traded at 73.98 cents US as of Friday's market close, up 0.48 cents US from Thursday at 4:00 p.m. ET.

The currency's weakest level of the session was $1.3611, while it touched its strongest since April 25 at $1.3511.

Prices of oil, one of Canada's major exports, touched a one month high on expectations of a supply-cut extension. U.S. crude prices were up 2.03 per cent to US$50.35 a barrel.

The U.S. dollar notched its biggest weekly drop in more than a year against a basket of major currencies, having given up gains made since Donald Trump, now surrounded by political worries, was elected U.S. president last year.

In domestic data, Canada's annual inflation rate held steady at 1.6 per cent in April, short of economists' forecasts for 1.7 per cent, as higher energy prices offset a decline in food costs for the seventh month in a row. Retail sales rose a stronger-than-expected 0.7 per cent in March.

Canadian government bond prices were mostly lower across the yield curve in sympathy with U.S. Treasuries. The two-year price was down half a cent to yield 0.675 per cent, while the benchmark 10-year fell 24 cents to yield 1.471 per cent.