NEW YORK (AP) — The first half of the year was full of surprises on Wall Street.

Even experts and investors who expected more volatility after a historically calm 2017 were caught off guard by many of the developments inside and outside the markets this year, including the rapid gains stocks made in January, their abrupt descent into a "correction," and the ongoing trade tensions that threatened to undo the benefits of the GOP tax overhaul and strong corporate profits. Still, consumer-focused companies like retailers had a strong start to the year and technology companies continued to rally, while high-dividend stocks, especially phone companies and household goods makers, lagged behind.

The Federal Reserve continued to push up short-term interest rates and the dollar rallied, contributing to a sell-off in emerging markets. Long-term rates didn't rise as much as short-term rates, squeezing the amount of money banks could make from lending, and the financial sector posted a modest loss for the first half.

A recap of the key developments in the markets in the first six months of 2018:

— January joy, February fears

At the beginning of 2018 investors were in a great mood thanks to the newly-passed corporate tax cut and continuing global economic growth. Stocks were already at record highs and they kept climbing: the S&P 500 index rose 7.5 percent from the start of the year through Jan. 26.

A few days later, investors looked at the government's monthly jobs report and worried that inflation was about to start surging after being dormant for years. On Feb. 5 the S&P fell 4.1 percent, its biggest loss in six and a half years, and then fell almost that much on Feb. 8. The Dow Jones Industrial Average fell 1,175 points and 1,032 points those two days, its biggest losses ever in terms of points. The market fell 10 percent in just nine days, and five months later it hasn't fully recovered.

— Volatility skyrockets

February's swoon marked the return of volatility in stocks.

The market pressed cruise control last year and sailed to record highs without a lot of fuss. But this year has been a rude awakening — even if things have really only returned to normal. In 2017, the stock market only had eight big moves, defined as days the S&P 500 rose or fell 1 percent or more, out of more than 200 trading days. This year it's already made 36 such moves. If that pace continues, the market would match the number of big swings it had in 2015.

— Profit power

Earnings for S&P 500 companies surged 19.5 percent in the first quarter of 2018 compared with the first quarter of 2017. The gains were even more dramatic compared to the last quarter of 2017.

Much of the gain stemmed from the corporate tax cut, but continued growth in the U.S. economy and the global economy also played a role. Experts are projecting strong earnings growth in the second quarter as well, but they're worried that growth will slow down compared to the first quarter because of the rising price of oil and other raw materials, as well as growing trade tensions.

— The market's wild trade ride

Rising hostility between the U.S. and some of its major trading partners has rocked the market over the last four months.

The U.S. placed tariffs on steel and aluminum imported from the European Union, Canada and Mexico in June, and each responded with its own taxes on goods from the U.S. The U.S. and China announced tariffs on billions of dollars' worth of imports as well, and those are set to take effect July 6.

While investors don't expect a full-blown trade war and major damage to the world economy, they are shying away from industrial companies and tariff targets, and have bought more stock in technology companies and smaller, U.S.-focused companies.

— Recession warning sign?

One warning signal for recessions that economists use is flashing a bit brighter.

The "yield curve" measures how much more in interest long-term Treasurys are paying than their short-term counterparts. The gap between two- and 10-year Treasury yields is now at its lowest level since the summer of 2007, a few months before the Great Recession struck. Short-term yields are rising because the Federal Reserve is getting more aggressive in raising overnight interest rates, but long-term yields are rising more slowly because inflation remains modest.

For economists, the yield curve starts flashing a red warning signal when short-term Treasurys are yielding less than their long- term counterparts. That's a scenario called an "inverted yield curve," and it has preceded each of the last seven recessions. A flatter yield curve also crimps profits for banks, which essentially borrow money at short-term rates, lend it out at longer-term rates and pocket the difference.

— A resurgent dollar

The dollar is on the rise again as the Federal Reserve raises interest rates and the U.S. economy grows at a quicker pace while other regions, including Europe and Japan, have slowed somewhat. The recent talk of tariffs has also sent the U.S. currency higher. A stronger dollar also pushes the price of commodities like oil and gold lower.

That's all bad news for emerging markets. Higher U.S. interest rates have historically meant pain for emerging-market stocks, in part because they can draw away investment dollars. A stronger dollar also makes it more difficult for emerging-market companies to repay debt they've taken out in dollars.

Some countries have their own troubles as well: Turkey's central bank is boosting interest rates to fight rapid inflation, and Argentina suffered a sharp devaluation of its currency and successfully sought a $50 billion loan from the International Monetary Fund.

— WHAT'S NEXT

Experts are still mostly optimistic about stocks for the rest of the year since the U.S. economy is expected to grow at a faster pace and corporate taxes are substantially lower than they were a year ago. But many of the factors that kept stocks bouncing around during the second quarter are likely to persist over the coming months.

Trade will be front and center: The U.S. and China are set to impose reciprocal tariffs on billions of dollars of each other's good on July 6, and allies such as Canada and the European Union have recently retaliated against U.S. tariffs on steel and aluminum. Inflation is likely to creep higher and interest rates are rising as well. Analysts say it's likely that volatile, uneven trading will continue.