According to some analysts, the gains in the stock market reflect growing confidence that the economy will avoid the recession that many had feared earlier in the year and instead come in for a "soft landing," followed by a gradual increase in business activity.
Happy to help :) The past perfect is used to describe something that is over and finished by the time another past even happens. In this sentence, the completed action is people fearing a possible recession: people feared the possible recession earlier in the year. As fear subsided, gains in the stock were observed. These gains mark another event in the past that occurred after the fear subsided and confidence that the recession would be avoided grew.
1 Explanation