American Capital Agency (AGNC -1.23%) ended the year on a high note as it released strong fourth-quarter earnings after the market closed yesterday. For the three months ended December 2014, the company reported comprehensive income of $0.86 per share, compared to negative$0.99 per share for the same time last year. 

The positive result was driven in part by a $599 million unrealized gain on the company's chief asset class, agency mortgage-backed securities.

US 30 Year Mortgage Rate Chart

Agency mortgage-backed securities -- packaged residential housing debt -- appreciates in market value when interest rates fall, and as you can see from the chart above, both 30-year and 15-year mortgage rates took a nose dive during the final quarter of 2014. The strong performance of American Capital Agency's assets allowed the company to finish the year with a 7.6% gain in book value per share. 

Big losses on hedges
But the quarter wasn't all roses. To manage some of its risk, American Capital Agency uses hedges to lock in borrowing costs and protect itself against rising interest rates. But, since long-term term hedges lose more value than shorter-term ones if rates fall, they also protect against falling rates -- a very beneficial change considering that 30-year mortgage rates did in fact fall by another 2.7% in January 2015.

However, when interest rates fall, these assets lose market value. To make matters worse, the company cancelled $4.8 billion worth of hedges, and since these assets are agreements between two companies to trade interest rate payments, terminating the deal early comes with fees. All told, American Capital Agency ended up with a $766 million loss on its hedges.

On the bright side, the cancelled hedges were replaced with shorter-term agreements. This helped to ensure that the company is protected from rising rates, but the changes also -- since long-term term hedges lose more value if rates fall than shorter-term hedges -- helped protect against continued falling rates. A very beneficial change considering 30-year mortgage rates did in fact fall by another 2.7% in January 2015.

Betting on faster prepayment speeds 
While falling mortgage rates gave American Capital Agency a boost last quarter, they also come with some headaches -- namely, faster prepayment speeds.

Unlike other types of loans, homeowners can pay off their mortgages as quickly as they like. When mortgage rates are lower, borrowers are more likely to refinance their mortgages, which shortens the lengths of their loans. For investors like American Capital Agency, when its loans mature faster than expected it means the company receives fewer total payments and, ultimately, earns less money. 

But this isn't chief investment officer Gary Kain's first rodeo. During the fourth quarter, American Capital Agency sold off more generic mortgage assets and replaced them with lower coupon securities, lower loan balance securities, and HARP (home affordable refinance program) specified pools. While each type of bond is unique, they provide protection from prepayments and generate more predictable cash flows.

After the portfolio adjustment, these specialized assets account for 91% of the company's mortgage assets, which is compared to 80% as of September 2014. 

Looking forward 
In December of last year, the U.S. Federal Reserve suggested that it would increase interest rates in 2015. Since this could have an negative impact on both American Capital Agency's asset values and borrowing costs, it is something the company has been paying close attention to.

While a strengthening U.S. economy and unemployment rate signal that now is the time to increase rates, a strengthening dollar and low inflation seem to indicate the opposite.

Either way, with assets that can perform if rates stay low and prepayments increase, and a large hedge portfolio to protect the company from rising rates, the story for the fourth quarter seems to be that American Capital Agency is preparing for anything.