The S&P 500 has rebounded after falling in the first half of the year. The US stock index was up from its June low.

Things are looking better elsewhere. The New York Stock Exchange's FANG+ stock index, which tracks 10 leading Big Tech players, is back in a bull market, with the likes of Amazon andTesla having soared more than 20%.

Many people around the world are pessimistic about the economy. Inflation in advanced economies is running at its hottest in decades, and central banks are determined to bring it under control.

Why are investors so happy? There are two charts explaining why. Any rally could be brought to an end by an economic crunch.

The recent investor optimism is due to the fact that inflation appears to be cooling as the US and global economies slow.

US gasoline prices are below $4 a gallon, oil prices have dropped 20% from their recent highs, and commodity prices are down sharply. In July, the US inflation rate fell for the first time in a year.

With inflation falling and worries about a recession rising, the Federal Reserve will no longer need to raise interest rates as high. The story goes that it's an optimistic one.

The path of Fed interest rate increases has been changed by investors. The US central bank was expected to hike in June. Fed funds futures are derivatives that track rates.

In July, there were signs of weakness in the economy. By the end of that month, they were expecting the rate to peak at 3.3% in December and then fall to 2.5% by the year's end.

As shown in the chart above, Fed officials have pushed back against the narrative since then. Rates are still expected to be cut.

The long-term bond yields have fallen from their June highs. Tech stocks tend to do well when borrowing costs are low.

Almost all analysts warn that investors should be careful. There's no reason for the market to think that the Fed will cut rates again.

The team at Wells Fargo believes a recession is imminent. The analysts' favorite indicator is red right now.

Wells Fargo said that the yield on the 10-year US Treasury note is much lower than the yield on the 1-year Treasury bill.

It suggests that economic growth is going to be lower in the future, which would require the Fed to cut rates hard.

The last time the 10-year yield was this low was a long time ago. The financial crisis happened in 2007.

Companies' earnings are likely to be badly affected by a recession. Any rally in the stock market would be over.