<prompt> Human: For the last two years Ive been studying in an online university while living and working full time in China. During this time Ive been able to accumulate around 25,000 in assets, but also managed to rack up around 19,000 in student loans. This coming fall Im going to be moving back to the States, and spending the next couple of years finishing up my degree in Finance. Right now Ive got about 20,000 invested in the stock market, which until the past week had been giving me around an 8 return. My idea right now is to pay off my unsubsidized loans, keeping the rest of my money in stocks, hoping that my return will be greater than the 5 plus capital gains tax of unaccrued interest I will pay towards the loan. Am I looking at this situation the right way, or is there something I should be doing differently?  <response>: Right now Ive got about 20,000 invested in the stock market, which until the past week had been giving me around an 8 return.Not the right way to think about it. Stock returns are not consistent. You can hope for an 8 average return over long periods think: decades but not short ones like years. My idea right now is to pay off my unsubsidized loans, keeping the rest of my money in stocks, hoping that my return will be greater than the 5 plus capital gains tax of unaccrued interest I will pay towards the loan.Depends on your time period, other assets, liabilities, etc... if you have 5-interest loans your odds of beating that in the market over short periods arent very high - there was a time when stocks bonds or even bonds alone would have done the trick, but not now. 