How often do banks borrow from the Federal Reserve? Though I've seen plenty of articles talk about in what circumstances banks borrow from the Fed, I haven't seen any quantification on that note. On average, what percent of the money that banks lend out is money from the Fed? Alternatively, how much money is borrowed from the Fed every year and how quickly is that money generally paid back?
When banks borrow from the Federal Reserve they can do so through the discount windows:


  The discount window helps to relieve liquidity strains for individual
  depository institutions and for the banking system as a whole by
  providing a reliable backup source of funding. Much of the statutory
  framework that governs lending to depository institutions is contained
  in section 10B of the Federal Reserve Act. The general policies that
  govern discount window lending are set forth in the Federal Reserve's
  Regulation A. As described in more detail below, depository
  institutions have access to three types of discount window
  credit--primary credit, secondary credit, and seasonal credit. All
  discount window loans must be collateralized to the satisfaction of
  the lending Reserve Bank.
  Discount Window Lending


The FRB has published discount window lending activity since 2010. Though this data is published with a two year lag, it may be of use. You can download that data at from their website at the link above. 

There is price discrimination at the window:


  In the United States, there are actually several different rates
  charged to institutions borrowing at the Discount Window. In 2006,
  these were: the primary credit rate (the most common), the secondary
  credit rate (for banks that are less financially sound), and the
  seasonal credit rate. The Federal Reserve does not publish information
  regarding institutions' eligibility for primary or secondary credit
  Wikipedia: Discount window 


It is somewhat rare to use the window. There are about 8,000 banks in the United States and about four to five hundred banks use the window in a typical quarter (according to that data). 


The amounts borrowed are very small. The largest amount borrowed was about 47 million in the latest report. It was borrowed by First National Bank and Trust of Rochelle, a bank with 270 million in assets, so those window loans amount to 18 percent of assets. 

But that is not representative of most banks. The second heaviest borrowing bank on the list is Xenith Bank which borrowed less than two percent of assets. More generally, there is stigma for discount window lending. The overall stigma is that since only those frozen out of capital markets use the window, users of the window must be in serious trouble. As shown above, 90 percent or more of banks don't use it in a given quarter.