What happened

Shares of the John Hancock Financial Opportunities Fund (BTO -0.58%) were up by 6.7% this week as of 11 a.m. ET Friday, according to S&P Global Market Intelligence, trading at about $28 per share. The fund had been up by as much as 7.5% earlier during the week. However, it is still down by about 15% year to date.

The broader market was up slightly for the week at that point in the session, with the S&P 500 up 0.6%, the Dow Jones Industrial Average higher by 0.5%, and the Nasdaq Composite up 0.4%.

So what

The John Hancock Financial Opportunities Fund is a closed-end fund that invests primarily in U.S. and foreign financial services companies. It holds about 163 stocks -- and 86% of its portfolio value is in bank stocks. Its five largest holdings are KKR & Co., Ares Management, JPMorgan Chase, Regions Financial, and Bank of America.

Because its portfolio is filled with banks, mostly regional banks, the fund has struggled this year. However, it was a good week for banks -- the KBW Regional Banking Index was up 7.6% as of the close of trading on Thursday. That largely tracked with the gains of the Financial Opportunities Fund.

What spurred the recovery in bank stocks? Analysts at Deutsche Bank came out with a research note saying they don't expect further intensification of regional banking stresses.  Also, Treasury Secretary Janet Yellen stated that the banking system's liquidity is strong, and said it's capable of handling the stresses caused by weakening conditions in the commercial real estate market.

Now what

Regional banks still face some potential headwinds. An economic downturn could impact lending activity and interest income, as well as credit quality.

There are also regulatory concerns, as The Wall Street Journal reported this week that big banks could have higher capital requirements imposed on them, and smaller banks could also face additional regulations.

The John Hancock Financial Opportunities Fund is a good choice for those wanting to invest in the banking sector, but given its heavy focus on regional banks, it might make sense to wait until there's more visibility on their health before jumping in.