Bank of America Corp. (BAC)) says signs are growing that the eight-year-old bull market in stocks and risky assets could soon come to an end.

And, as with all late-stage bull markets, the trick for investors is in getting the timing right.

The Standard & Poor's 500 Index, a key benchmark for U.S. stocks, could peak at 2,863 during the first half of 2018, Bank of America analysts predicted in a report. That's 8% above current levels.

But the second half could bring mostly gloom for investors, as the Federal Reserve tightens financial conditions by raising interest rates and shrinking its balance sheet. Volatility -- a measure of the size of daily price swings -- could rise from this year's unusually low levels. Inflation is likely to increase. Yields on corporate bonds could widen relative to those of U.S. Treasuries -- an indicator of fading investor confidence in companies' ability to repay their debt.

"Signs of bubble-like behavior abound," according to the report, which cited examples like record-high art prices, soaring Bitcoin prices and a 100-year-bond sale by Argentina, the South American nation that has defaulted on its debt eight times in the past 200 years. Next year "could represent the move toward euphoria, which typically heralds the end of a bull market."

Wall Street firms are becoming increasingly anxious about frothy conditions in financial markets, with Goldman Sachs Group inc. (GS - Get Report) warning investors last week that stocks and bonds are trading at the highest average valuations since 1900.

Bank of America noted that much of the recent gains have been fueled by central banks like the Fed, which have pumped trillions of dollars into global markets in the past decade to kindle elusive economic growth.

In fact, according to the bank, there may be little driving the stock market at this point except for bullish sentiment.

While there are ample gains are to be had by savvy investors, the risks are growing. By the end of 2018, the bank predicts, the S&P 500 could fall from its mid-year peak to about 2,800.

Signs are growing that the bull market is "nearing the end of its leash, triggering a mid-year pullback alongside potential for some of the best returns in the last gasps of the cycle," the analysts wrote.

Yields on U.S. Treasury 10-year bonds could surge to 2.9% or 3% by the end of 2018, from about 2.37% now, the report said, a move that would lead to falling prices for the assets. According to the analysts, the tax bill could lead to $1 trillion or more of U.S. budget deficits, prompting the Treasury to issue more bonds and increase market supply of the securities even as the Fed proceeds with a plan to liquidate government securities currently held on its balance sheet.

"Balance sheet unwinding could mean a spike in net supply of Treasuries the market would have to absorb," according to the analysts.

A key call in the report is that China's bond and foreign-exchange markets could face a reckoning after officials for more than a decade encouraged heavy borrowing and spending to fuel economic growth. President Xi Jinping's efforts to reduce debt in the country's financial system could become "messy," the Bank of America analysts wrote.

Investor fears of a Chinese currency devaluation sent markets reeling in early 2016, until officials managed to stabilize the exchange rate through strict capital controls.