---
title: "Systemic Stress"
description: "Systemic Stress dataset from European Central Bank."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/european-central-bank/systemic-stress
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/european-central-bank/systemic-stress.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/14%20Datasets/14%20European%20Central%20Bank/03%20Systemic%20Stress
modified: 2026-11-25
index: https://www.quantconnect.com/llms.txt
---

# Systemic Stress

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Writing Algorithms](https://www.quantconnect.com/docs/v2/writing-algorithms.md) > Datasets > [European Central Bank](https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/european-central-bank.md) > Systemic Stress

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

## Introduction

The Systemic Stress dataset by the European Central Bank (ECB) tracks the Composite Indicator of Systemic Stress (CISS), a measure of stress in the financial system. The data covers 14 economies, starts in January 1980, and is delivered on a weekly frequency. This dataset is created by processing the indicator the ECB publishes on its Data Portal. Only the euro area carries the breakdown by market segment.

For more information about the Systemic Stress dataset, including CLI commands and pricing, see the [dataset listing](https://www.quantconnect.com/datasets/ecb-systemic-stress).

## About the Provider

The European Central Bank is the central bank of the euro area, established in 1998 and based in Frankfurt. Its main task is to keep prices stable in the countries that use the euro, and it sets the interest rates for the euro area. It also publishes statistics on the euro area economy and its financial markets.

## Getting Started

The following snippet demonstrates how to request data from the Systemic Stress dataset:

```python
self.euro_area = self.add_data(ECBSystemicStress, ECB.StressAreas.EURO_AREA, Resolution.DAILY).symbol
```

## Data Summary

The following table describes the dataset properties:

| Property | Value |
| --- | --- |
| Start Date | January 1980 |
| Asset Coverage | 14 Economies |
| Data Density | Sparse |
| Resolution | Daily* |
| Timezone | Berlin |

* Weekly data we fetch daily.

## Requesting Data

To add Systemic Stress 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 ECBSystemicStressExampleAlgorithm(QCAlgorithm):
    def initialize(self) -> None:
        self.set_start_date(2020, 1, 1)
        self.set_end_date(2021, 1, 1)
        self._euro_area = self.add_data(ECBSystemicStress, ECB.StressAreas.EURO_AREA).symbol
```

## Accessing Data

To get the current Systemic Stress 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:
    if slice.contains_key(self._euro_area):
        data_point = slice[self._euro_area]
        self.log(f"{self._euro_area} composite stress at {slice.time}: {data_point.composite}")
```

To iterate through all of the dataset objects in the current `Slice`, call the `get` method.

```python
def on_data(self, slice: Slice) -> None:
    for dataset_symbol, data_point in slice.get(ECBSystemicStress).items():
        self.log(f"{dataset_symbol} composite stress at {slice.time}: {data_point.composite}")
```

## Historical Data

To get historical Systemic Stress 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
# DataFrame
history_df = self.history(self._euro_area, 100, Resolution.DAILY)

# Dataset objects
history_bars = self.history[ECBSystemicStress](self._euro_area, 100, 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 Systemic Stress data, call the `remove_security` method.

```python
self.remove_security(self._euro_area)
```

## Supported Economies

The following table shows the accessor code you need to add each economy to your algorithm:

| Economy | Constant | Decomposition |
| --- | --- | --- |
| Euro area | `ECB.StressAreas.EURO_AREA` | Full |
| Austria | `ECB.StressAreas.AUSTRIA` | Headline and sovereign |
| Belgium | `ECB.StressAreas.BELGIUM` | Headline and sovereign |
| Finland | `ECB.StressAreas.FINLAND` | Headline and sovereign |
| France | `ECB.StressAreas.FRANCE` | Headline and sovereign |
| Germany | `ECB.StressAreas.GERMANY` | Headline and sovereign |
| Ireland | `ECB.StressAreas.IRELAND` | Headline and sovereign |
| Italy | `ECB.StressAreas.ITALY` | Headline and sovereign |
| Netherlands | `ECB.StressAreas.NETHERLANDS` | Headline and sovereign |
| Portugal | `ECB.StressAreas.PORTUGAL` | Headline and sovereign |
| Spain | `ECB.StressAreas.SPAIN` | Headline and sovereign |
| China | `ECB.StressAreas.CHINA` | Headline |
| United Kingdom | `ECB.StressAreas.UNITED_KINGDOM` | Headline |
| United States | `ECB.StressAreas.UNITED_STATES` | Headline |

## Example Applications

The Systemic Stress dataset enables you to measure financial stress in Europe and other major economies. Examples include the following strategies:

- Reducing risk exposure as the stress indicator rises
- Comparing euro area and US stress to tell a regional shock from a global one
- Using sovereign stress to time peripheral versus core European exposure

### Classic Algorithm Example

The following example algorithm liquidates SPY when the composite stress indicator is above 0.1 in both the euro area and the United States. Otherwise, it holds SPY.

```python
from AlgorithmImports import *

class ECBSystemicStressAlgorithm(QCAlgorithm):

    def initialize(self) -> None:
        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.euro_area = self.add_data(ECBSystemicStress, ECB.StressAreas.EURO_AREA, Resolution.DAILY).symbol
        self.united_states = self.add_data(ECBSystemicStress, ECB.StressAreas.UNITED_STATES, Resolution.DAILY).symbol

        self.euro_area_stress = None
        self.united_states_stress = None

    def on_data(self, slice: Slice) -> None:
        readings = slice.get(ECBSystemicStress)

        # Keep the latest composite reading of each economy.
        if self.euro_area in readings and readings[self.euro_area].composite is not None:
            self.euro_area_stress = readings[self.euro_area].composite

            self.log(f"{readings[self.euro_area].end_time} euro area stress {self.euro_area_stress}, "
                     f"of which intermediaries {readings[self.euro_area].financial_intermediaries_contribution}")

        if self.united_states in readings and readings[self.united_states].composite is not None:
            self.united_states_stress = readings[self.united_states].composite

        if self.euro_area_stress is None or self.united_states_stress is None:
            return

        # Wait for the SPY bar before trading.
        if self.equity not in slice.bars:
            return

        # Exit SPY when stress is elevated in both economies.
        stressed = self.euro_area_stress > 0.1 and self.united_states_stress > 0.1

        if stressed:
            if self.portfolio[self.equity].invested:
                self.liquidate(self.equity)
        elif not self.portfolio[self.equity].invested:
            self.set_holdings(self.equity, 1)
```

### Framework Algorithm Example

The following example algorithm emits flat insights for SPY when the composite stress indicator exceeds 0.1 in both the euro area and the United States. Otherwise, it emits up insights.

```python
from AlgorithmImports import *

class ECBSystemicStressFrameworkAlgorithm(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

        symbols = [Symbol.create("SPY", SecurityType.EQUITY, Market.USA)]
        self.set_universe_selection(ManualUniverseSelectionModel(symbols))

        self.add_alpha(ECBSystemicStressAlphaModel(self))

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

class ECBSystemicStressAlphaModel(AlphaModel):
    """Emits insights from systemic stress on both sides of the Atlantic."""

    def __init__(self, algorithm):
        self._euro_area = algorithm.add_data(ECBSystemicStress, ECB.StressAreas.EURO_AREA, Resolution.DAILY).symbol
        self._united_states = algorithm.add_data(ECBSystemicStress, ECB.StressAreas.UNITED_STATES, Resolution.DAILY).symbol

        history = algorithm.history[ECBSystemicStress](self._euro_area, timedelta(days=365), Resolution.DAILY)
        algorithm.debug(f"Got {len(list(history))} historical stress readings")

        self._euro_area_stress = None
        self._united_states_stress = None
        self._symbols = []

    def update(self, algorithm, data):
        readings = data.get(ECBSystemicStress)

        # Keep the latest composite reading of each economy.
        if self._euro_area in readings and readings[self._euro_area].composite is not None:
            self._euro_area_stress = readings[self._euro_area].composite

        if self._united_states in readings and readings[self._united_states].composite is not None:
            self._united_states_stress = readings[self._united_states].composite

        if self._euro_area_stress is None or self._united_states_stress is None:
            return []

        # Emit flat insights when stress is elevated in both economies.
        stressed = self._euro_area_stress > 0.1 and self._united_states_stress > 0.1
        direction = InsightDirection.FLAT if stressed else InsightDirection.UP

        # Emit insights only for the securities that have a bar in this slice.
        return [Insight.price(symbol, timedelta(days=14), direction)
                for symbol in self._symbols if symbol in data.bars]

    def on_securities_changed(self, algorithm, changes):
        for security in changes.added_securities:
            self._symbols.append(security.symbol)

        for security in changes.removed_securities:
            if security.symbol in self._symbols:
                self._symbols.remove(security.symbol)
```

## Data Point Attributes

The Systemic Stress dataset provides `ECBSystemicStress` objects, which have the following attributes:

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