Getting Started

Benzinga’s Python client library focuses on financial data methods, that can be used for quantitative analysis, and on news data from Benzinga, that can help give meaningful insights that complement quantitative data.

The installation process varies depending on your python version and system used. The basic installation instructions are as follows:

pip install benzinga

Alternatively, the package can be installed by using:

pip3 install benzinga

Once you have successfully installed the package, you can either import the Financial Data module, for quantitative financial data:

from benzinga import financial_data

or you can import the Benzinga News Data module, if you’re looking into financial news:

from benzinga import news_data

Your Key

Api Key To initiate a class, an API key is used, for authentication purposes. Contact us if you don’t yet have a key, we will take care of you!

Sample API Key (type: str) : “testkey892834789s9s8abshtuy”

Sample Test Financial Data Module

  1. Initiating the class:
from benzinga import financial_data
api_key = "testkey892834789s9s8abshtuy"
fin = financial_data.Benzinga(api_key)
  1. A sample test run to get ratings on a stock. (Returns a JSON object):
stock_ratings = fin.ratings()
  1. Since fin.ratings() returns a JSON dict, for a better view of the dict, you can call the fin.output() method on the result. Example:
fin.output(stock_ratings)

Sample Test News Data Module

  1. Initiating the class:
from benzinga import news_data
api_key = "testkey892834789s9s8abshtuy"
paper = news_data.News(api_key)
  1. A sample test run to get general news. (Returns a JSON Object)
stories = paper.news()
  1. Since fin.news() returns a JSON dict, for a better view of the dict, you can call the fin.output() method on the result. Example:
paper.output(stories)

It is important to note that for both the Financial Data Module and the News Data Module, there are many optional parameters for the methods. Below is a detailed listing of possible methods for the Financial Data Module and the news Data Module, their method call names, arguments, and what they return.

Best Practices

When possible, we highly recommend using updated parameters, particularly for ingestion of live data (as opposed to historical data). It shrinks the query universe much more efficiently than the other parameters, mitigating latency.

Financial Data methods

Bars

fin.bars()

Public Method: Benzinga Bars looks at detailed price values over a period of time.

Delayed Quote

fin.delayed_quote()

Public Method: Benzinga Quote looks at many different attributes of the ticker like high, low, close etc

Dividends

fin.dividends()

Public Method: Benzinga Dividends looks at the relevant dividend information for a company.

Ratings

fin.ratings()

Public Method: Benzinga Ratings looks at ratings from different firms

Earnings

fin.earnings()

Public Method: Benzinga Earnings looks at the quarterly earnings reports for different companies.

Splits

fin.splits()

Public Method: Benzinga Splits looks at the stock splits calendar data

Economics

fin.economics()

Public Method: Benzinga Economics looks at different economic events in a country.

Guidance

fin.guidance()

Public Method: Benzinga Guidance looks at different attributes like revenue guidance etc.

IPO

fin.ipo()

Public Method: Benzing IPO looks at initial public offering data for companies.

Conference Calls

fin.conference_calls()

Public Method: Benzinga Conference calls looks at conference calls.

Fundamentals

fin.fundamentals()

Public Method: Benzinga Fundamentals looks at overall financial data for a company.

Financials

fin.financials()

Public Method: Benzinga Financials looks at overall financial data like for a company.

Valuation Ratios

fin.valuation_ratios()

Public Method: Benzinga Valuation Ratios looks at overall financial data like for a company.

Earning Ratios

fin.earning_ratios()

Public Method: Benzinga Earning Ratios

Operation Ratios

fin.operation_ratios()

Public Method: Benzinga Operation Ratios

Share Class

fin.share_class()

Public Method: Benzinga Share Class

Earning Reports

fin.earning_reports()

Public Method: Benzinga Earning Reports looks at overall earning reports for a company.

Alpha Beta

fin.alpha_beta()

Public Method: Benzinga Alpha Beta

Company Profile

fin.company_profile()

Public Method: Benzinga Company Profile

Company

fin.company()

Public Method: Benzinga Company

Asset Classification

fin.asset_classification()

Public Method: Benzinga Asset Classification

Summary

fin.summary()

Public Method: Summary

Logos

fin.logos()

Public Method: Benzinga Logos

Options Activity

fin.options_activity()

Public Method: Benzinga Options Activity

News Data

News

fin.news()

Public Method: Benzinga News


Benzinga News

Benzinga Pro