Benzinga

Benzinga News Feed

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 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.

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:

from QuantConnect.DataSource import *

self.aapl = self.add_equity("AAPL", Resolution.DAILY).symbol
self.dataset_symbol = self.add_data(BenzingaNews, self.symbol).symbol
using QuantConnect.DataSource;

_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<BenzingaNews>(_symbol).Symbol;

Data Summary

The following table describes the dataset properties:

PropertyValue
Start DateSeptember 2017
Asset Coverage8,000 Equities
Data DensitySparse
ResolutionSecond (1,250 Articles/Day)
TimezoneNew York

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

For more example algorithms, see Examples.

Data Point Attributes

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

Requesting Data

To add Benzinga News Feed data to your algorithm, call the AddDataadd_data method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

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.symbol).symbol
namespace QuantConnect.Algorithm.CSharp.AltData
{
    public class BenzingaNewsDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;
        
        public override void Initialize()
        {
            SetStartDate(2021, 1, 1);
            SetEndDate(2021, 6, 1);
            SetCash(100000);
            
            _symbol = AddEquity("AAPL", Resolution.Minute).Symbol;
            _datasetSymbol = AddData<BenzingaNews>(_symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Benzinga News Feed data, index the current Slice 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.

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}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var article = slice[_datasetSymbol];
        Log($"{_datasetSymbol} title at {slice.Time}: {article.Mentions}");
    }
}

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

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}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<BenzingaNews>())
    {
        var datasetSymbol = kvp.Key;
        var article = kvp.Value;
        Log($"{datasetSymbol} title at {slice.Time}: {article.Title}");
    }
}

Historical Data

To get historical Benzinga News Feed data, call the Historyhistory method with the dataset Symbol. If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.history(self.dataset_symbol, 100, Resolution.DAILY)

# Dataset objects
history_bars = self.history[BenzingaNews](self.dataset_symbol, 100, Resolution.DAILY)
var history = History<BenzingaNews>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests.

Remove Subscriptions

To remove a subscription, call the RemoveSecurityremove_security method.

self.remove_security(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

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.

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

For more example algorithms, see Examples.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: