Stocks gave up an early gain to finish with modest losses Wednesday as investors continued weighing a steady flow of corporate earnings.

Energy and communications companies took some of the biggest losses as a three day rally in the price of U.S. crude oil ended. Bond prices rose, sending yields lower, as investors shifted money into low-risk assets.

On Wednesday:

The S&P 500 index fell 6.43 points, or 0.2%, to 2,927.25.

The Dow Jones Industrial Average dropped 59.34 points, or 0.2%, to 26,597.05.

The Nasdaq composite lost 18.81 points, or 0.2%, to 8,102.01.

The Russell 2000 index of small company stocks picked up 3.04 points, or 0.2%, to 1,588.13.

For the week:

The S&P 500 is up 22.22 points, or 0.8%.

The Dow is up 37.51 points, or 0.1%.

The Nasdaq is up 103.95 points, or 1.3%.

The Russell 2000 is up 22.38 points, or 1.4%.

For the year:

The S&P 500 is up 420.40 points, or 16.8%.

The Dow is up 3,269.59 points, or 14%.

The Nasdaq is up 1,466.74 points, or 22.1%.

The Russell 2000 is up 239.57 points, or 17.8%.