THE global economy is sicker than a man with a bellyful of bad oysters. The last thing it needs now is a trade war. Yet on October 11th America's Senate passed the Currency Exchange Rate Oversight Reform Act, which would allow any “fundamentally misaligned” currency to be labelled a subsidy subject to countervailing duties. No prizes for guessing which large Asian nation the senators have in mind. Variants of this bill have been introduced regularly since 2003; all have failed. But this time may be different: anti-China sentiment in both parties has grown. Republican leaders have so far resisted holding a vote on a similar bill in the House of Representatives and look unlikely to change their minds; but if they do, the bill would almost certainly pass. It may seem contradictory that the Senate is threatening to raise barriers to trade with China even as it has just passed bilateral trade pacts with Colombia, South Korea and Panama. But those treaties were first signed four to five years ago. Public support for free trade has been withering for a decade, tracking the decline in middle-class American manufacturing jobs. The main cause of that decline is rising productivity, which lets factories produce more stuff with fewer workers, but cheap Chinese imports have also been a factor (see article). America's resentment of China has grown as its economy sputters while China's has galloped ahead. Barack Obama has pinned his hopes for recovery on a doubling of exports, a goal that China's many barriers to trade, from discriminatory government procurement to the undervalued yuan, impede. America has legitimate beefs with China, but this bill is the wrong way to address them. It is legally flawed, economically dangerous and unnecessary. Were it ever to reach Mr Obama's desk, he should veto it. Start with the legal flaws. The rules of the World Trade Organisation (WTO) generally do not recognise undervalued currencies as an illegal subsidy. Currencies are considered part of a country's monetary sovereignty, to be dealt with, if at all, by the International Monetary Fund. The odds are that if America imposed tariffs on China under the bill's provisions, China could successfully bring a complaint against America at the WTO.

By the time the WTO rules, the American firms lobbying for protection from Chinese imports will doubtless have enjoyed several years of it. But American consumers will have suffered by being denied cheap products, and China will almost certainly have retaliated. Therein lies the greatest danger. This bill would escalate tensions between China and America, and risk sparking a trade war. It is broad enough to be wielded against other countries, which may mimic America's tactics against China or each other. It would wallop global investor and business confidence at a time when both are scarce.

If jittery politicians are looking for another argument to sway sceptical voters, how about this? The problems this bill purports to address are already being resolved. The Economist has long argued that a flexible yuan is in the interests of both China and its trading partners. It would hasten the reorientation of China's economy from exports to consumer spending, give its central bank more freedom to fight inflation, and divert demand to depressed Europe and America, catalysing an essential rebalancing of the global economy.

Belatedly, China recognises this. Since June last year the yuan has appreciated 7% against the dollar. The rise in China's relative costs has been even greater given its higher inflation rate. With stimulative fiscal and monetary policy bolstering domestic demand, China's current-account surplus has shrunk by two-thirds, from 10% of GDP in 2007. Meanwhile America's trade deficit has narrowed, and manufacturing employment has stopped falling. All this means the yuan is far less undervalued than it was a few years ago—if at all.

China, heal thyself

China is hardly blameless. Its tariffs may be low, but it lavishes subsidies on favoured domestic companies and discriminates against foreign ones, especially in sectors such as energy and transport, forcing them to surrender their technology and tolerating brazen intellectual-property theft. The yuan is still not a free-floating currency, and only seems to appreciate when tempers in Washington, DC, reach boiling point. Mr Obama should resist the protectionist impulses of Congress. But his job would be easier if China would offer him proof that gentler forms of persuasion bring results.