If investors ever needed a clear signal that this is the top of the market, they now have one.

Walgreens Boots Alliance shares surged Wednesday amid speculation that the U.S.-listed drugstore group has been considering a $70 billion take-private deal.

If private equity can pull it off, it would be the biggest leveraged buyout ever, dwarfing the $45 billion transaction in which energy group TXU was taken private in 2007, just a year before the financial crisis rocked global markets and prompted unprecedented intervention by global central banks.

Financing a buyout deal on the scale of a Walgreens deal today could be a big challenge.

For one, Walgreens WBA, +1.14% already has $15 billion in debt on its balance sheet. A potential bidder would need to add more leverage to fund the purchase. That would leave the drugstore chain particularly vulnerable when the credit cycle turns — which is looking increasingly likely.

Factor in a premium on the current stock-market valuation and the total cash needed becomes quite dizzying. All this at a time when risky corporate loans are rapidly piling up on Wall Street’s books.

The volume of leveraged loans has reached $3.4 trillion worldwide, according to estimates from the Bank of England. Credit quality has deteriorated, with most new leveraged loans being issued by companies that have high levels of debt as compared with their earnings.

Worse, the share of new leveraged loans with no maintenance covenants — requiring the borrower to maintain certain financial buffers such as a debt-to-Ebitda ratio, or earnings before interest, tax, depreciation and amortization, of less than five times — has tripled since 2007, the U.K. central bank said.

Banks are already struggling as investors steer clear of hefty private-equity debt packages.

Take Bain Capital’s $4 billion buyout of market-research firm Kantar in July. The U.S. private-equity firm lined up 11 banks to assemble a $3 billion debt package.

But after an underwhelming reaction from the market, the banks had to restructure the debt package to make it more palatable to investors. This included raising the pricing on the loans and tightening the covenants.

Secondly, Walgreens finances aren’t looking so good. The company’s profit in the fourth quarter plunged 55% to $677 million, compared with the same quarter in 2018. And margins are under increasing pressure as the price Walgreens pays for generic drugs continues to fall, but not as fast as the amount customers pay.

Walgreens is even more exposed than its competitors to pricing demands because it doesn’t own pharmacy-benefit managers who play an outsize role in drug pricing.

On top of all that, the timing for such a behemoth transaction couldn’t be worse, with political resistance almost a certainty. Private-equity groups are under intense scrutiny from Democratic presidential candidates, with Sen. Elizabeth Warren calling for greater federal regulation of the industry.

She has compared buyout firms to vampires, saying they are “bleeding the company dry and walking away enriched even as the company succumbs.”

The debt-fueled buyout of TXU also took place in an overheated private-equity market.

When KKR and TPG bought the Texas utility, they were betting that natural-gas prices would rise. But the two buyout firms failed to anticipate the economic crisis that would reduce power demand and the technological revolution around shale that depressed the prices paid for electricity.

As the price of natural gas fall sharply, the buyout groups struggled to service the huge debt load taken on to finance the acquisition, and the utility eventually filed for bankruptcy.

Timing matters.

Read now: ‘This will end poorly’, says J.P. Morgan strategist about a boom in arcane debt on Wall Street