---
title: "Benzinga News Feed"
description: "Benzinga News Feed dataset from Benzinga."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/benzinga/benzinga-news-feed
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/benzinga/benzinga-news-feed.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/14%20Datasets/06%20Benzinga/01%20Benzinga%20News%20Feed
modified: 2026-10-31
index: https://www.quantconnect.com/llms.txt
---

# Benzinga News Feed

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Writing Algorithms](https://www.quantconnect.com/docs/v2/writing-algorithms.md) > Datasets > [Benzinga](https://www.quantconnect.com/docs/v2/writing-algorithms/datasets/benzinga.md) > Benzinga News Feed

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

## Introduction

The Benzinga News Feed dataset by Benzinga tracks US Equity news releases. The data covers about 1,250 articles per day across 8,000 Equities, starts in January 2016, and is delivered on a second frequency. This dataset is created by structuring the content produced by Benzinga's editorial team.

This dataset depends on the [US Equity Security Master](https://www.quantconnect.com/datasets/quantconnect-us-equity-security-master) dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Benzinga News Feed dataset, including CLI commands and pricing, see the [dataset listing](https://www.quantconnect.com/datasets/benzinga-news-feed).

## About the Provider

Benzinga was founded by Jason Raznick in 2010 with goal of connecting the world with news, data, and education that makes the path to financial prosperity easier for everyone, everyday. Benzinga provides access to real-time news for individual investors.

## Getting Started

The following snippet demonstrates how to request data from the Benzinga News Feed dataset:

```python
self.aapl = self.add_equity("AAPL", Resolution.DAILY).symbol
self.dataset_symbol = self.add_data(BenzingaNews, self.symbol).symbol
```

## Data Summary

The following table describes the dataset properties:

| Property | Value |
| --- | --- |
| Start Date | September 2017 |
| Asset Coverage | 8,000 Equities |
| Data Density | Sparse |
| Resolution | Second (1,250 Articles/Day) |
| Timezone | New York |

## Requesting Data

To add Benzinga News Feed 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 BenzingaNewsDataAlgorithm(QCAlgorithm):
    def initialize(self) -> None:
        self.set_start_date(2021, 1, 1)
        self.set_end_date(2021, 6, 1)
        self.set_cash(100000)

        self.aapl = self.add_equity("AAPL", Resolution.MINUTE).symbol
        self.dataset_symbol = self.add_data(BenzingaNews, self.aapl).symbol
```

## Accessing Data

To get the current Benzinga News Feed 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.dataset_symbol):
        article = slice[self.dataset_symbol]
        self.log(f"{self.dataset_symbol} title at {slice.time}: {article.title}")
```

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, article in slice.get(BenzingaNews).items():
        self.log(f"{dataset_symbol} title at {slice.time}: {article.title}")
```

## Historical Data

To get historical Benzinga News Feed 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.dataset_symbol, 100, Resolution.DAILY)

# Dataset objects
history_bars = self.history[BenzingaNews](self.dataset_symbol, 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 a subscription, call the `remove_security` method.

```python
self.remove_security(self.dataset_symbol)
```

If you subscribe to Benzinga News Feed data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see [Track Security Changes](https://www.quantconnect.com/docs/v2/writing-algorithms/algorithm-framework/alpha/key-concepts.md#05-Track-Security-Changes).

## Example Applications

The Benzinga News Feed enables you to accurately design strategies harnessing real-time news releases. Examples include the following strategies:

- Creating a dictionary of sentiment scores for various words and assigning a sentiment score to the content of each news release
- Calculating the sentiment of news releases with Natural Language Processing (NLP)
- Trading securities when their news releases that Benzinga tags with current buzzwords

### Classic Algorithm Example

The following example algorithm parses the Benzinga news articles related to Apple. If the sentiment is positive, the algorithm buys Apple. Otherwise, it holds cash.

```python
from AlgorithmImports import *

class BenzingaNewsDataAlgorithm(QCAlgorithm):

    current_holdings = 0
    target_holdings = 0
    # A custom word-score map for calculating the total sentiment score
    word_scores = {
        'good': 1, 'great': 1, 'best': 1, 'growth': 1,
        'bad': -1, 'terrible': -1, 'worst': -1, 'loss': -1}

    def initialize(self) -> None:
        self.set_start_date(2024, 9, 1)
        self.set_end_date(2024, 12, 31)
        self.set_cash(100000)

        # Requesting data to obtain the updated news for sentiment score calculation
        self.aapl = self.add_equity("AAPL", Resolution.MINUTE).symbol
        self.benzinga_symbol = self.add_data(BenzingaNews, self.aapl).symbol

        # Historical data
        history = self.history(self.benzinga_symbol, 14, Resolution.DAILY)
        self.debug(f"We got {len(history)} items from our history request")

    def on_data(self, slice: Slice) -> None:
        if slice.contains_key(self.benzinga_symbol):
            # Assign a sentiment score to the news article by specific word appearance scoring
            content_words = slice[self.benzinga_symbol].contents.lower()
            score = 0
            for word, word_score in self.word_scores.items():
                score += (content_words.count(word) * word_score)
            self.target_holdings = int(score > 0)

        # Ensure we have AAPL data in the current Slice to avoid stale filling
        if not (slice.contains_key(self.aapl) and slice[self.aapl] is not None and not slice[self.aapl].is_fill_forward):
            return

        # Buy or sell if the sentiment has changed from our current holdings
        if self.current_holdings != self.target_holdings:
            self.set_holdings(self.aapl, self.target_holdings)
            self.current_holdings = self.target_holdings
```

### Framework Algorithm Example

The following example algorithm parses the Benzinga news articles related to Apple. If the sentiment is positive, the algorithm buys Apple. Otherwise, it holds cash.

```python
from AlgorithmImports import *

class BenzingaNewsDataAlgorithm(QCAlgorithm):

    def initialize(self) ->  None:
        self.set_start_date(2024, 9, 1)
        self.set_end_date(2024, 12, 31)
        self.set_cash(100000)

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

        self.add_alpha(BenzingaNewsAlphaModel())

        self.set_portfolio_construction(EqualWeightingPortfolioConstructionModel())

        self.add_risk_management(NullRiskManagementModel())

        self.set_execution(ImmediateExecutionModel())

class BenzingaNewsAlphaModel(AlphaModel):

    _securities = []
    # A custom word-score map for calculating the total sentiment score
    word_scores = {'good': 1, 'great': 1, 'best': 1, 'growth': 1,
                   'bad': -1, 'terrible': -1, 'worst': -1, 'loss': -1}

    def update(self, algorithm: QCAlgorithm, slice: Slice) ->  List[Insight]:
        insights = []

        for security in self._securities:
            if slice.contains_key(security.benzinga_data):
                # Assign a sentiment score to the news article by specific word appearance scoring
                content_words = slice[security.benzinga_data].contents.lower()
                score = 0
                for word, word_score in self.word_scores.items():
                    score += (content_words.count(word) * word_score)
                security.target_direction = InsightDirection.UP if score >  0 else InsightDirection.FLAT

            # Ensure we have security data in the current Slice to avoid stale filling
            if not (slice.contains_key(security) and slice[security] is not None and not slice[security].is_fill_forward):
                continue

            # Buy or sell if the sentiment has changed from our current holdings
            if security.current_direction != security.target_direction:
                security.current_direction = security.target_direction
                insights.append(Insight.price(security.symbol, timedelta(14), security.target_direction))

        return insights

    def on_securities_changed(self, algorithm: QCAlgorithm, changes: SecurityChanges) ->  None:
        for security in changes.added_securities:

            # Requesting data to obtain the updated news for sentiment score calculation
            security.benzinga_data = algorithm.add_data(BenzingaNews, security)
            security.current_direction = InsightDirection.FLAT
            security.target_direction = InsightDirection.FLAT

            # Historical data
            history = algorithm.history(security.benzinga_data, 14, Resolution.DAILY)
            algorithm.debug(f"We got {len(history)} items from our history request")

            self._securities.append(security)

        for security in changes.removed_securities:
            if security in self._securities:
                # Unsubscribe from Benzinga news feed for this security to release computational resources
                algorithm.remove_security(security.benzinga_data)
                self._securities.remove(security)
```

## Data Point Attributes

The Benzinga News Feed dataset provides `BenzingaNews` objects, which have the following attributes:

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