NEW YORK - The dollar climbed against a basket of currencies for a second straight day on Friday helped by safe-haven demand as Beijing moved to impose a new security law on Hong Kong after last year's pro-democracy unrest, further straining fast-deteriorating U.S.-China ties.

China on Friday unveiled details about its plan to impose a national security law in Hong Kong that could see mainland intelligence agencies set up bases in the global financial hub, raising fears of more pro-democracy protests. 

Reports of the law on Thursday drew fire from President Donald Trump, sapping investors' appetite for riskier assets and drove the euro, offshore yuan and commodity currencies lower on Friday.

Sino-American relations have worsened during the coronavirus pandemic. The United States has ramped up its criticism of China, blaming it for the spread of the virus, which originated in the city of Wuhan in central China.

"It's definitely a risk-off kind of day," said Minh Trang, senior FX trader at Silicon Valley Bank in Santa Clara, California.

"These types of headlines certainly give a little bit of a jolt to the overall market and you are seeing the result of that today," he said.

The U.S. Dollar Currency Index, which measures the greenback’s strength against six other major currencies, was up 0.4% at 99.814. For the week, the index was down about 0.5%.

The offshore Chinese yuan hit a two-month low of 7.1644. The onshore yuan hit eight-month lows. 

The risk-sensitive Australian dollar was 0.7% lower against the greenback while the New Zealand dollar fell 0.6%.

Sterling fell 0.3% against the dollar as fresh data showed UK retail sales dropped by a record 18% as the coronavirus crisis hammered the economy. 

A drop in oil prices on Friday on rising U.S.-China tensions and doubts about the pace of demand recovery from the coronavirus crisis hurt the currencies of oil-producing nations.

The Canadian dollar weakened about 0.5% against its U.S. counterpart as oil prices fell and Canadian data showed a record decline in retail sales, with the loonie giving back some of this week's rally. 

The Norwegian crown fell about 0.8% against the U.S. dollar.

(Reporting by Saqib Iqbal Ahmed; Editing by Steve Orlofsky) ((saqib.ahmed@thomsonreuters.com; @SaqibReports; +1 646 223 6054; Reuters Messaging: saqib.ahmed.thomsonreuters.com@reuters.net))