Investments In Securities | INVESTMENTS IN SECURITIES The available-for-sale investments portfolio consisted of the following as of December 31, 2017 and December 31, 2016 (in thousands): December 31, 2017 Asset Type Amortized Cost Gross Unrealized Loss Gross Unrealized Gain Fair Value Fannie Mae Certificates Fixed Rate $ 7,117,481 $ (20,470 ) $ 23,067 $ 7,120,078 ARMs 273,660 (2,647 ) 1,101 272,114 Total Fannie Mae 7,391,141 (23,117 ) 24,168 7,392,192 Freddie Mac Certificates Fixed Rate 3,968,358 (11,045 ) 10,142 3,967,455 ARMs 200,405 (1,028 ) 329 199,706 Total Freddie Mac 4,168,763 (12,073 ) 10,471 4,167,161 Ginnie Mae Certificates Fixed Rate 1,602 (45 ) — 1,557 ARMs 26,460 — 350 26,810 Total Ginnie Mae 28,062 (45 ) 350 28,367 Total Agency RMBS 11,587,966 (35,235 ) 34,989 11,587,720 U.S. Treasuries 1,047,965 (1,031 ) — 1,046,934 Total $ 12,635,931 $ (36,266 ) $ 34,989 $ 12,634,654 December 31, 2016 Fannie Mae Certificates Fixed Rate $ 9,505,262 $ (81,783 ) $ 36,622 $ 9,460,101 ARMs 301,029 (2,668 ) 1,571 299,932 Total Fannie Mae 9,806,291 (84,451 ) 38,193 9,760,033 Freddie Mac Certificates Fixed Rate 2,799,604 (55,624 ) 7,659 2,751,639 ARMs 50,641 (514 ) 606 50,733 Total Freddie Mac 2,850,245 (56,138 ) 8,265 2,802,372 Ginnie Mae Certificates Fixed Rate 1,856 (54 ) — 1,802 ARMs 34,390 — 448 34,838 Total Ginnie Mae 36,246 (54 ) 448 36,640 Total Agency RMBS 12,692,782 (140,643 ) 46,906 12,599,045 U.S. Treasuries 49,952 (266 ) — 49,686 Total $ 12,742,734 $ (140,909 ) $ 46,906 $ 12,648,731 The following table presents the gross unrealized loss and fair values of the Company's available-for-sale investments by length of time that such securities have been in a continuous unrealized loss position as of December 31, 2017 and December 31, 2016 (in thousands): Unrealized loss positions Less than 12 Months Greater than 12 months Total As of Fair value Unrealized loss Fair value Unrealized loss Fair value Unrealized loss December 31, 2017 $ 7,925,876 $ (36,170 ) $ 24,896 $ (96 ) $ 7,950,772 $ (36,266 ) December 31, 2016 $ 9,264,265 (140,909 ) — — 9,264,265 (140,909 ) The following table summarizes the Company’s available-for-sale investments as of December 31, 2017 and December 31, 2016 , according to their estimated remaining weighted-average maturity classifications: December 31, 2017 December 31, 2016 Fair Value Amortized Cost Fair Value Amortized Cost Less than one year $ 24,896 $ 24,992 $ — $ — Greater than one year through five years 5,137,370 5,143,680 3,765,037 3,744,614 Greater than five years through ten years 7,472,388 7,467,259 8,864,309 8,978,537 Greater than ten years — — 19,385 19,583 Total $ 12,634,654 $ 12,635,931 12,648,731 12,742,734 The following table is a summary of the net gain (loss) from the sale of available-for-sale investments for the year ended December 31, 2017 and 2016 (in thousands): For the year ended December 31, 2017 2016 Available-for-sale investments, at cost $ 13,238,876 $ 14,455,602 Proceeds from sale of available-for-sale investments 13,124,139 14,475,065 Net realized gain (loss) on sale of available-for-sale investments (114,737 ) 19,463 Gross gain on sale of available-for-sale investments 17,986 77,142 Gross (loss) on sale of available-for-sale investments (132,723 ) (57,679 ) Net realized gain (loss) on sale of available-for-sale investments $ (114,737 ) $ 19,463 The components of the carrying value of available-for-sale investments at December 31, 2017 and December 31, 2016 are presented below. The premium purchase price is generally due to the average coupon interest rates on these investments being higher than prevailing market rates and, conversely, the discount purchase price is generally due to the average coupon interest rates on these investments being lower than prevailing market rates. (in thousands) December 31, 2017 December 31, 2016 Principal balance $ 12,275,352 $ 12,285,204 Unamortized premium 362,676 458,709 Unamortized discount (2,097 ) (1,179 ) Gross unrealized gains 34,989 46,906 Gross unrealized losses (36,266 ) (140,909 ) Fair value $ 12,634,654 $ 12,648,731 As of December 31, 2017 , the weighted-average coupon interest rate on the Company's Agency RMBS and U.S. Treasuries was 3.52% and 1.85% , respectively. As of December 31, 2016 , the weighted-average coupon interest rate on the Company's Agency RMBS and U.S. Treasuries was 3.37% and 0.63% , respectively. Actual maturities of Agency RMBS are generally shorter than their stated contractual maturities (which range up to 30 years), as they are affected by the contractual lives of the underlying mortgages, periodic payments and prepayments of principal. As of December 31, 2017 , the range of final contractual maturities of the Company's Agency RMBS portfolio was between 2024 and 2048 . As of December 31, 2016 , the range of final contractual maturities of the Company's Agency RMBS portfolio was between 2024 and 2047 . As of December 31, 2017 , the weighted-average contractual maturities of the Company's Agency RMBS portfolio and U.S. Treasuries was 2042 and 2020 , respectively. As of December 31, 2016 , the weighted-average contractual maturities of our Agency RMBS portfolio and U.S. Treasuries was 2040 and 2018 , respectively. Credit Risk The Company believes it has minimal exposure to credit losses on its Debt Securities at December 31, 2017 and December 31, 2016 . Principal and interest payments on Agency RMBS are guaranteed by Freddie Mac and Fannie Mae, while principal and interest payments on Ginnie Mae RMBS and U.S. Treasuries are backed by the full faith and credit of the U.S. government. Since September 2008, both Freddie Mac and Fannie Mae have operated in the conservatorship of the U.S. government. As of December 31, 2017 , S&P maintained its AA+ rating for the U.S. government, while Fitch and Moody's rated the U.S. government AAA and Aaa, respectively. Since Fannie Mae and Freddie Mac are in U.S. government conservatorship, the implied credit ratings of Agency RMBS are similarly rated. |