WALL STREET loves a good scrap almost as much as the wildcatters who drill for oil do. No wonder that the fight over the finances of America’s shale-oil industry has turned nasty. In one corner are shortsellers, including David Einhorn, a hedge-fund manager whose scalps include Lehman Brothers. They argue that “fracking”—the business of blasting oil out of rocks using water, sand and chemicals—is a bottomless pit into which too much cash has been thrown.

In the other corner are America’s oil pioneers, who say that shale can thrive even though the benchmark American oil price has dropped from over $100 a barrel last year to $57 today. The oilmen are backed by plenty of other investors who are still pumping money into shale firms: some $35 billion of equity and bonds has been raised since December.

Both sides have a point. It makes sense to be cheery about the long-term prospects for shale energy—and to be queasy about today’s bunch of fracking firms (see article).

Shale matters. The industry has become huge—listed firms have invested over half a trillion dollars of capital. Much of that money has been raised through junk bonds: if you include privately held companies, shale firms owe almost as much debt as Greece. After drilling beneath much of Texas and North Dakota, they account for 5% of global oil output. The health of shale firms affects people around the world, from Western drivers and Saudi Arabia’s sheikhs to Asia’s consumers.

The reason to be optimistic about shale energy is that the industry has responded cleverly to the falling oil price. Output surged in 2011-14 because of a spending boom. Bosses borrowed like mad, bid up land rights and drilled indiscriminately. But gone are the days when roughnecks were fed lobster in luxury camps and Texan towns were circled by Learjets. Instead, the new mantra in America’s shale basins is thrift. Since December, costs have been cut by a fifth, mainly by squeezing suppliers. Texas has suffered 20,000 job losses. Shale bosses say their firms are concentrating on the very best prospects and sucking more oil from them. Production has held up even though the number of drilling rigs has fallen by half.

Economies of shale

Lower costs and more selectiveness mean that new investments should make money. Most firms boast potential annual returns of 25% or more on new wells when oil costs $60 a barrel. The industry’s agility to date suggests costs will fall further.

If only shale firms could escape their past and concentrate on this bright tomorrow. Alas, every corporation is the sum of its existing, depleting assets and the promise of its future ones. Many shale firms made rotten decisions in the boom. This legacy means a dose of pessimism about them is in order.

The top 60-odd shale firms are making a return of roughly zero on the swollen stock of capital they employ. Despite this, investors value them at well above book value, which suggests their share prices are frothy. Many firms are juicing up the cash they can crank out of their old wells. In the first quarter of 2015, 31% of the cashflow reported by the top firms came from derivatives bets placed when the oil price was high. These hedges will expire over the next year or so; cashflow will fall.

That puts cracks in the shale barons’ claim that they can ramp up production without further borrowing. With less cash flowing in, shale firms need to slash their investment by over two-thirds if they are to balance their books. If spending falls, production will follow. And the capital markets may not always remain open: about half of shale firms, owing $85 billion of debt between them, have distressed balance-sheets. The pace of capital-raising has slowed in the past few weeks.

The wild card is the oil price. Many shale bosses are betting that they will be bailed out by higher prices. Oilmen are optimists by nature—why else would you drill holes in the ground? But if prices do not rise there will be a reckoning, with more firms defaulting, being bought or selling their assets. That would lead to short-term losses among banks and investors. America’s shale industry needs to drill through its past if it is to emerge leaner and meaner than ever before.