Wall street sign in New York with American flags and New York Stock Exchange background.

Investment bank Goldman Sachs posted a massive 41% rise in revenues in the second quarter, the bank said Wednesday, helped by a blowout performance by the bank’s trading desks.

The New York–based bank had second-quarter revenues of $13.3 billion, which is up from $9.46 billion in the same period a year ago. That helped keep the bank’s second-quarter profits flat at $2.42 billion, making up for the money the bank set aside to cover legal expenses and potentially bad loans caused by the coronavirus pandemic.

The highlight of Goldman’s performance was its trading desks, which benefited from the heightened market volatility that impacted the markets in April, May and June as anxious investors tried to determine the economic impact of the pandemic. The stock market plunged sharply in March, as many economies were starting to shut down, only to rebound just as sharply starting in April and running through the entire quarter.

The bank’s global markets division had net revenues of $7.18 billion in the quarter, up 93% from a year earlier. Most of that gain was in Goldman’s trading specialty of bonds, commodities and currencies, but the bank also had a big jump in revenue from its stock-trading operations.

Goldman has a small, but growing, consumer banking business through its Marcus personal loans and savings accounts as well as acting as the bank for Apple’s credit card. So the bank was not immune to the virus-driven economic slowdown, which has caused millions of Americans to lose jobs and businesses to close and ultimately stop paying their debts.

Goldman had to set aside $1.59 billion to cover potentially bad loans in the quarter, up sharply from the $214 million it set aside a year earlier. However, that figure is significantly smaller than the amounts JPMorgan Chase, Citigroup and Wells Fargo had to set aside, mostly reflecting the small size of Goldman’s consumer banking business compared to its competition.

The bank’s return on equity, which measures how well an investment bank is performing with the assets that it holds, was 11.1% in the quarter. Typically, banks like Goldman want to keep that figure above 10%.