Wall Street extended its rally on Wednesday, with the S&P 500 and the Nasdaq hitting record highs for the fourth straight session as technology companies pushed indexes higher and promising trade negotiations stoked investor sentiment.

Apple led the technology sector’s advance, and the company’s shares hit an all-time closing high at $222.98. The FAANG group of momentum stocks also got a boost from Morgan Stanley’s price target increases for Amazon and Alphabet.

Amazon’s stock gained 3.4 percent, leading the advance of the consumer discretionary sector’s index, as the company edged closer to becoming the second U.S. company, after Apple, to reach $1 trillion in market value.

The remaining FAANG stocks, Facebook and Netflix, closed slightly lower.

Canada appeared to be taking a more conciliatory approach to its ongoing talks with the United States aimed at salvaging the trilateral North American Free Trade Agreement (NAFTA), days after Washington said it had struck a deal with Mexico.

As the summer nears its end, light trading volume that sometimes plagues the market seems to have worked in its favor.

Among the economic fundamentals, the Commerce Department released its second reading of second-quarter GDP, indicating that the economy grew at an upwardly-revised annual rate of 4.2 percent in the quarter, its best performance in nearly four years.

Eight of the 11 major sectors of the S&P 500 ended the session in positive territory, with the largest percentage gains coming from the consumer discretionary and technology sectors.

Restaurant operator Yum China Holdings extended its rally, and was up 5.5 percent after rejecting a $17.6 billion buy-out bid from a Chinese consortium.

Among losers, Dick’s Sporting Goods fell 2.2 percent following an underwhelming earnings report, a drop in same-store sales driven by tighter gun controls and a decline in Under Armour sales.

Shares of American Eagle Outfitters fell 6.5 percent after posting disappointing second quarter results and providing a lackluster forecast.

Approximately 5.63 billion shares changed hands on the major domestic equity exchanges, as compared to a 6.12 billion average over the past 20 trading days.

GDP Revised Upward

Economic growth was a bit stronger than initially thought in the second quarter, with the economy chalking up its best performance in nearly four years, thereby putting it on track to grow at a 3 percent annual rate of growth for the year.

According to Wednesday’s report by the Commerce Department, gross domestic product increased at a 4.2 percent annualized rate in the Department’s second estimate of GDP growth for the April-June quarter. That was slightly up from the 4.1 percent pace of expansion reported in July and was the fastest rate since the third quarter of 2014.

The slight upward revision to growth last quarter reflected more business spending on software than previously estimated and less imports of petroleum. Stronger software spending and a smaller import bill offset a downward revision to consumer spending.

Compared to the second quarter of 2017, the economy grew 2.9 percent instead of the previously reported 2.8 percent. Output expanded 3.2 percent in the first half of 2018, rather than the 3.1 percent estimated last month.

Robust growth in the second quarter was driven by one-off factors such as a $1.5 trillion tax cut package, which provided a jolt to consumer spending after a lackluster first quarter, and a front-loading of soybean exports to China to beat retaliatory trade tariffs.

There are signs some of the momentum was lost early in the third quarter. The government reported on Tuesday that the goods trade deficit jumped 6.3 percent to $72.2 billion in July as a 6.7 percent plunge in food shipments weighed on exports.

While consumer spending has remained strong early in the third quarter, the housing market has weakened further with homebuilding rising less than expected in July and sales of new and previously owned homes declining.

The escalation of a trade war between the United States and China as well as tit-for-tat tariffs with the European Union, Canada and Mexico, pose a risk to the economy.

The consensus was for second-quarter GDP growth to be revised down to a 4.0 percent pace. The economy grew at a 2.2 percent rate in the January-March period.

An alternative measure of economic growth, gross domestic income (GDI), increased at a rate of 1.8 percent in the second quarter, slowing from the first quarter’s brisk 3.9 percent pace.

The average of GDP and GDI, also referred to as gross domestic output and considered a better measure of economic activity, increased at a 3.0 percent rate in the April-June period. That followed a 3.1 percent growth pace in the first quarter.

The income side of the growth ledger was restrained by after-tax corporate profits, which grew at an 2.4 percent rate last quarter, decelerating from the 8.2 percent pace logged in the first quarter.

Growth in consumer spending, which accounts for more than two-thirds of U.S. economic activity, was lowered to a 3.8 percent rate in the second quarter instead of the previously reported 4.0 percent pace. Consumer spending increased at a 0.5 percent pace in the first quarter.

Soybean exports were accelerated in the second quarter to beat Chinese tariffs that took effect in July. Overall exports rose at a 9.1 percent rate in the second quarter instead of the previously estimated 9.3 percent pace.

Imports declined at a 0.4 percent rate, with petroleum accounting for much of the drop. The decrease in imports was the biggest since the fourth quarter of 2015. Imports were previously reported to have grown at a 0.5 percent pace in the second quarter.

The decline in imports sharply narrowed the trade deficit. Trade added 1.17 percentage points to GDP growth in the second quarter rather than the previously reported 1.06 percentage points.

The front-loading of soybean exports, however, depleted farm inventories. Overall, inventories declined at a rate of $26.9 billion instead of the $27.9 billion pace reported last month.

Inventories subtracted 0.97 percentage point from GDP growth in the second quarter instead of the previously estimated 1.0 percent.

Housing Starts Decline

Contracts to buy previously owned homes fell in July, continuing a general trend in recent months that reflects a lack of supply in the market.

The National Association of Realtors reported on Wednesday its Pending Home Sales Index, based on contracts signed last month, decreased 0.7 percent to 106.2 in July.

Pending home contracts become sales after a month or two, and recent declines in the NAR index have reflected generally tight supply.

Contracts for existing homes fell 2.3 percent last month on an annualized basis, the seventh such monthly drop.

Lawrence Yun, the NAR’s chief economist, said the decline reflected both supply constraints and a strong job market that is bidding up prices.

“Multiple years of inadequate supply in markets with strong job growth have finally driven up home prices to a point where an increasing number of prospective buyers are unable to afford it,” Yun said.

Will the Bull Market Continue?

The summer is winding down. Corporate-earnings season is just about through. Federal Reserve policymakers have thoroughly aired their thinking at the annual Fed research conference last week.

And after seven months of retrenchment, repair and recovery, the broad stock indexes have notched a hard-won breakout to a record high.

In other words, the markets have reached a “now what?” moment, on the cusp of a consequential midterm election and an approaching climax of a global-trade reordering.

Looking strictly at the market’s behavior, the setup is fairly encouraging. A breakout to a new high means the bull market remains intact and, by extension, no past buyer of stocks at the index level feels anything but smart for having played the game.

Over the past 90 years, when the S&P 500 makes its first 52-week high in six months or more — as it did on Friday — the index has been higher over the ensuing year 94 percent of the time.

And in prior years when the S&P was up between 5 percent and 10 percent midway through August, the returns for the remainder of the year have typically been positive, with gains better than the average of all years.

Traders might also be feeling the muscle memory of 2017, when the S&P 500 was up a good but unspectacular 8.3 percent into the third week of August before accelerating to surge another 15 percent over the next five months — culminating in the peak at 2,782 on Jan. 26.

The market doesn’t always make it so easy as to play the same late-year melt-up script two straight years, but one can’t ignore the chance that something similar could unfold.

Yet the very good news reflected in stock prices a year ago could be difficult to top — and perhaps explains why the market has been, and could remain, relatively hard to please.

The corporate tax cut was rounding into shape just as Europe and Asia economic data started to pick up and oil prices began to ramp, creating a rare array of positive forces that led to an unheard-of surge in S&P 500 earnings growth nine years into an economic expansion.

The sheer brute force of the good news that it’s taken to squeeze the S&P 500 to its 8.3 percent gain this year — that 20 percent profit eruption, a Fed stressing patience, tame Treasury yields, pliant credit markets and a $1.5 trillion pace of combined cash dividends and stock buybacks handed to shareholders of S&P 500 companies — is notable.

The main threat of an aggressive trade posture toward China is likely a panicky capital flight from emerging markets that would send the U.S. dollar soaring and upend the global capital markets. For the moment, this threat seems diminished, with China stocks stabilizing.

The market’s failure to climb in lockstep with corporate profit gains makes sense if one considers this to be a mature economic expansion and financial-market cycle. How much economic activity has been pulled forward or temporarily goosed by the tax package, repatriated foreign corporate cash and boost in government spending this year? And how much will earnings growth fall off as these forces wane and cost pressures build into 2019?

The surface indicators lean positive. According to FactSet, analysts’ consensus earnings forecasts for the next 12 months continue to climb, and estimates for 2019 are holding up better than usual. Yes, the growth rates will drop dramatically, and the growth will likely become spottier across sectors. But right now the support from corporate profitability doesn’t appear to be wobbling.

But how much room for improvement is there across the array of factors that drive stock prices?

The financial markets often deliver returns in large number and when least expected. It then takes some back but without much notice, as we’ve seen in the past year.

It’s possible that the rush higher in January represented the moment of peak momentum, maximum valuation, cresting optimism and greatest ease for bullish investors, and yet this doesn’t mean it was a decisive high in prices. The market is somewhat more selective and operating, for now, at a more defensive, slower pace of advance. Not necessarily better or worse than the melt-up that culminated seven months ago, just different.