---
title: "US Bank Failures"
description: "US Bank Failures dataset from Federal Deposit Insurance Corporation."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/federal-deposit-insurance-corporation/us-bank-failures
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/federal-deposit-insurance-corporation/us-bank-failures.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/14%20Datasets/18%20Federal%20Deposit%20Insurance%20Corporation/01%20US%20Bank%20Failures
modified: 2026-11-23
index: https://www.quantconnect.com/llms.txt
---

# US Bank Failures

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Writing Algorithms](https://www.quantconnect.com/docs/v2/writing-algorithms.md) > Datasets > [Federal Deposit Insurance Corporation](https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/federal-deposit-insurance-corporation.md) > US Bank Failures

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

The US Bank Failures dataset by the Federal Deposit Insurance Corporation (FDIC) tracks the failures of FDIC-insured banks, with the assets and deposits of each bank and how the FDIC resolved it. The data covers 4,117 bank failures, starts in April 1934, and is delivered on a daily frequency. This dataset is created by parsing the list of failed banks the FDIC publishes. The data does not include the FDIC's estimated cost of each failure.

For more information about the US Bank Failures dataset, including CLI commands and pricing, see the [dataset listing](https://www.quantconnect.com/datasets/fdic-us-bank-failures).

## About the Provider

The Federal Deposit Insurance Corporation is an independent agency created by Congress in 1933 to maintain stability and public confidence in the nation's financial system. The FDIC insures deposits, examines and supervises financial institutions for safety and soundness and consumer protection, and manages receiverships when banks fail.

## Getting Started

The following snippet demonstrates how to request data from the US Bank Failures dataset:

```python
self._dataset_symbol = self.add_data(FDICBankFailures, FDIC.FAILURES).symbol
```

## Data Summary

The following table describes the dataset properties:

| Property | Value |
| --- | --- |
| Start Date | April 1934 |
| Asset Coverage* | 4,117 Bank Failures |
| Data Density | Sparse |
| Resolution | Daily |
| Timezone | New York |

* The coverage includes all assets since the start date. It increases over time.

## Requesting Data

To add US Bank Failures data to your algorithm, call the `add_data` method. Save a reference to the dataset `Symbol` so you can access the data later in your algorithm.

```python
class FDICBankFailuresDataAlgorithm(QCAlgorithm):

    def initialize(self) -> None:
        self.set_start_date(2019, 1, 1)
        self.set_end_date(2021, 3, 31)
        self.set_cash(100000)
        self._dataset_symbol = self.add_data(FDICBankFailures, FDIC.FAILURES).symbol
```

## Accessing Data

To get the current US Bank Failures data, index the current [Slice](https://www.quantconnect.com/docs/v2/writing-algorithms/key-concepts/time-modeling/timeslices.md) with the dataset `Symbol`. `Slice` objects deliver unique events to your algorithm as they happen, but the `Slice` may not contain data for your dataset at every time step. To avoid issues, check if the `Slice` contains the data you want before you index it.

```python
def on_data(self, slice: Slice) -> None:
    failures = slice.get(FDICBankFailures).get(self._dataset_symbol)
    if failures:
        for failure in failures.data:
            self.log(f"{failure.institution_name} ({failure.state}): assets {failure.total_assets}")
```

## Historical Data

To get historical US Bank Failures data, call the `history` method with the dataset `Symbol`. If there is no data in the period you request, the history result is empty.

```python
history = self.history[FDICBankFailures](self._dataset_symbol, timedelta(days=730), Resolution.DAILY)
```

For more information about historical data, see [History Requests](https://www.quantconnect.com/docs/v2/writing-algorithms/historical-data/history-requests.md).

## Remove Subscriptions

To remove your subscription to US Bank Failures data, call the `remove_security` method.

```python
self.remove_security(self._dataset_symbol)
```

## Example Applications

The US Bank Failures dataset enables you to follow stress in the US banking system as it happens. Examples include the following strategies:

- Reducing exposure to bank stocks when failures cluster
- Comparing the assets of failed banks against the size of the sector
- Following the states and regions where banks fail

### Classic Algorithm Example

The following example algorithm holds SPY and liquidates it for 30 days after an FDIC-insured bank fails.

```python
from AlgorithmImports import *

class FDICBankFailuresDataAlgorithm(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2019, 1, 1)
        self.set_end_date(2021, 3, 31)
        self.set_cash(100000)

        self.equity = self.add_equity("SPY", Resolution.DAILY).symbol
        self.dataset_symbol = self.add_data(FDICBankFailures, FDIC.FAILURES).symbol
        self.last_failure = datetime.min

    def on_data(self, slice):
        failures = slice.get(FDICBankFailures).get(self.dataset_symbol)
        if failures:
            for failure in failures.data:
                self.log(f"{failure.institution_name} ({failure.state}) failed with assets of {failure.total_assets}")
            self.last_failure = self.time

        # Liquidate SPY for 30 days after a bank fails.
        if self.time - self.last_failure < timedelta(days=30):
            self.liquidate(self.equity)
        elif not self.portfolio.invested:
            self.set_holdings(self.equity, 1)
```

### Framework Algorithm Example

The following example algorithm emits a flat insight for SPY when an FDIC-insured bank failed in the last 30 days. Otherwise, it emits an up insight.

```python
from AlgorithmImports import *

class FDICBankFailuresFrameworkAlgorithm(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2019, 1, 1)
        self.set_end_date(2021, 3, 31)
        self.set_cash(100000)

        self.universe_settings.resolution = Resolution.DAILY
        self.set_universe_selection(ManualUniverseSelectionModel(
            [Symbol.create("SPY", SecurityType.EQUITY, Market.USA)]))

        self.add_alpha(BankFailureAlphaModel(self))
        self.set_portfolio_construction(EqualWeightingPortfolioConstructionModel())
        self.set_execution(ImmediateExecutionModel())

class BankFailureAlphaModel(AlphaModel):

    def __init__(self, algorithm):
        self._dataset_symbol = algorithm.add_data(FDICBankFailures, FDIC.FAILURES).symbol
        self._last_failure = datetime.min
        self._symbols = set()

    def update(self, algorithm, data):
        if data.get(FDICBankFailures).get(self._dataset_symbol):
            self._last_failure = algorithm.time

        # Emit a flat insight within 30 days of a bank failure, otherwise an up insight.
        failed_recently = algorithm.time - self._last_failure < timedelta(days=30)
        direction = InsightDirection.FLAT if failed_recently else InsightDirection.UP
        return [Insight.price(symbol, timedelta(days=1), direction) for symbol in self._symbols]

    def on_securities_changed(self, algorithm, changes):
        for security in changes.added_securities:
            self._symbols.add(security.symbol)
        for security in changes.removed_securities:
            self._symbols.discard(security.symbol)
```

## Data Point Attributes

The US Bank Failures dataset provides `FDICBankFailures` and `FDICBankFailure` objects.

### FDICBankFailures

`FDICBankFailures` objects have the following attributes:

*Members of `QuantConnect.DataSource.FDICBankFailures` (JSON): https://www.quantconnect.com/services/inspector?type=T:QuantConnect.DataSource.FDICBankFailures&language=python*

### FDICBankFailure

`FDICBankFailure` objects have the following attributes:

*Members of `QuantConnect.DataSource.FDICBankFailure` (JSON): https://www.quantconnect.com/services/inspector?type=T:QuantConnect.DataSource.FDICBankFailure&language=python*
