The world's riskiest bank is in trouble

What is going on with Deutsche Bank?

Germany's biggest lender was dubbed the world's riskiest bank by the International Monetary Fund last month, just as one of its U.S. businesses failed a Federal Reserve stress test.

Its shares are down 45% this year, and on Wednesday it said second quarter profits were wiped out by a 98% slump in earnings. The stock fell 2.5% in Frankfurt.

Deutsche Bank(DB) blamed the slump on restructuring costs and a weak performance in trading and investment banking.

The bank is not only Germany's biggest, it is a big international player. In a report in June, the IMF said that "Deutsche Bank appears to be the most important net contributor to systemic risks in the global banking system," followed by HSBC(HSBC) and Credit Suisse(CSGKF).

Deutsche has a big presence in London and Britain's vote to leave the European Union last month has piled on the pain for shareholders. Its stock has slumped 18% since the vote.

The bank is now trying to beef up its capital to be better prepared for future crises. John Cryan, who took over as CEO a year ago, has begun shedding risky assets and frozen dividend payments.

One of Deutsche's problems is that it doesn't have a big retail bank or wealth management operation to make up for lower returns on investment banking.

Stricter regulations imposed since the global financial crisis have made its core business safer, but also much less profitable. And it is still carrying too much risk, say some experts.

"The biggest problem is that Deutsche Bank has too much leverage," noted analysts from Berenberg bank.

They said the bank has two options -- it can cut assets or increase capital. Both are tricky. Market conditions won't allow the bank to sell assets, while raising capital from investors would also be difficult because the bank can't offer the prospect of decent returns.

So it's being forced to become a smaller business. It is already planning to shed as many as 35,000 jobs by 2020. Cryan said Wednesday more cuts could come if the "current weak economic environment persists."

Deutsche also said it is talking to the U.S. Department of Justice in a bid to settle an investigation into the bank's mortgage-backed securities business. This could end up being costly -- other banks have paid billions of dollars in fines.