Apple Inc. (NASDAQ:AAPL) stock appears to be going out of style, at least among hedge funds. Data collected by S&P Global Market Intelligence reveals that as hedge funds slashed their positions in stocks to the lowest level ever during the second quarter, they also unloaded billions of dollars’ worth of Apple stock.

AAPL Apple Hedge Fund
Hedge Fund by cafecredit, Flickr

Hedge funds dump $5.3 billion in Apple (AAPL) shares

S&P Global Market Intelligence examined the latest 13F filings from the top hedge funds and learned that they unloaded $5.3 billion worth of Apple stock during the second quarter. According to Barron’s, hedge funds dumped $6.3 billion worth of shares of companies in the Technology sector. It means that sales of Apple Inc. (NASDAQ:AAPL) stock made up 84% of the net selloffs within the sector, the website notes.

This might seem a bit strange since the iPhone maker’s stock has rallied in such a big way, but analysts at S&P suggest that hedge funds unloaded Apple Inc. (NASDAQ:AAPL) shares because they wanted to lock in those gains for their investors. After soaring up until the company’s late April earnings report, Apple stock plunged and since then has had its ups and downs.

Warren Buffett digs in as others pile out

You may recall that legendary value investor Warren Buffett’s Berkshire Hathaway picked up shares of Apple Inc. (NASDAQ:AAPL) stock during the first and second quarters. We learned in May that the firm had grabbed up more than 9.8 million shares of the iPhone maker during the first quarter. Then during the second quarter when the top hedge funds in S&P’s study fled Apple stock, Buffett’s firm dug in even further—in typical value investor style.

Berkshire added $500 million to its stake in the company, raising its position in Apple to 15.2 million shares as of the end of June. Apple Inc. (NASDAQ:AAPL) shares plunged after the company’s earnings report in late April. As the firm follows Buffett’s trademark value investor style—although one of his portfolio managers is probably behind the Apple trades—it may have benefited from the other hedge funds’ departures during the second quarter.

The most recent rally started in late July after the last earnings report, so there were plenty of opportunities during the second quarter for Berkshire to pick up more shares of Apple Inc. (NASDAQ:AAPL) stock. The iPhone maker’s shares slumped by more than 12% during the quarter. The stock has rebounded in the current quarter thus far, climbing more than 14%, but it has had such a difficult year this year that even with that gain, it is up less than 4%.

As of this writing, shares of Apple Inc. (NASDAQ:AAPL) stock are trading at $109.39.

Hedge funds sell nine of ten sectors

S&P’s analysis covers the top ten pure play hedge funds, which managed about $150 billion worth of holdings in the equity market during the quarter. Those funds held 399 positions, which means they exited a few during the quarter as they held 408 positions in the first quarter. It was the fewest positions held by the top ten hedge funds in a quarter since S&P started tracking this data in 2014.

Pavle Savic, head of market development at S&P Global Market Intelligence, said they observed “substantial net selling” in nine of the ten sectors in the S& 500. Technology was the most sold sector during the quarter, the firm reported. In addition to Apple Inc. (NASDAQ:AAPL), other stocks that saw major selling during the second quarter include Netflix, Alphabet, Microsoft and Allergan. Interestingly, Allergan was also among the most-purchased stocks during the quarter, indicating just how mixed viewpoints on the stock are.

Consumer Discretionary was the most purchased sector among the top ten hedge funds during the second quarter. The funds picked up $1.2 billion worth of shares of Charter Communications, making it the leader in the sector during the quarter. Morgan Stanley was also popular as the funds snapped up more than $900 million worth of its shares, reports MarketWatch.