Skip to main content

Stock Market and Financial News API

Project description

Stock Market & Financial News API

Access stock market and financial news of all publicly traded companies listed on US stock exchanges.

  • More than 50 million articles accessible
  • All major newswires included
  • Real-time news stream API and historical news search API

Get your free API key: https://newsfilter.io/api-plans

Installation

pip install financial-news-api

Search API

The Search API allows you to access and search the news database with over 50 million articles. Newly published articles are added in real-time to the database.

import requests

API_KEY = "YOUR_API_KEY"
API_ENDPOINT = "https://api.newsfilter.io/search?token={}".format(API_KEY)

# Define the news search parameters
queryString = "symbols:NFLX AND publishedAt:[2020-02-01 TO 2020-05-20]"

payload = {
    "queryString": queryString,
    "from": 0,
    "size": 10
}

# Send the search query to the Search API
response = requests.post(API_ENDPOINT, json=payload)

# Read the response
articles = response.json()

print(articles)

Example Response

{
  "articles": [
    {
      "title": "FAANG emerges as the latest group to lead the market, Jim Cramer says", 
      "description": "\"This market's been going through leadership groups like there's no tomorrow,\" the \"Mad Money\" host said.",
      "publishedAt": "2020-05-20T22:32:22+0000",
      "sourceUrl": "https://www.cnbc.com/2020/05/20/faang-emerges-as-the-latest-group-to-lead-the-market-jim-cramer-says.html",
      "source": {
        "name": "CNBC",
        "id": "cnbc"
      },
      "symbols": [
        "FB",
        "AAPL",
        "AMZN",
        "NFLX",
        "GOOGL",
        "TGT",
        "WMT",
        "HD",
        "LOW"
      ],
      "sectors": [
        "Technology",
        "Consumer Cyclical",
        "Consumer Defensive"
      ],
      "industries": [
        "Internet Content & Information",
        "Consumer Electronics",
        "Specialty Retail",
        "Media - Diversified",
        "Discount Stores",
        "Home Improvement Stores"
      ],
      "imageUrl": "https://image.cnbcfm.com/api/v1/image/103267851-IMG_0161.jpg?v=1545882603",
      "id": "01a030ca440ba8732461703e9a906eb7"
    },
    {
      "title": "S&P 500 Clawing Toward 3,000 Milestone Finds Road Getting Harder",
      "description": "A rally this week has pushed the S&P 500 Index to 2,972. The 28-point road to 3,000 could be a slog.",
      "publishedAt": "2020-05-20T20:18:32.731Z",
      "sourceUrl": "https://www.bloomberg.com/news/articles/2020-05-20/s-p-500-s-next-even-number-milestone-will-be-tough-to-reach",
      "source": {
        "name": "Bloomberg",
        "id": "bloomberg"
      },
      "symbols": [
        "FB",
        "AMZN",
        "NFLX"
      ],
      "sectors": [
        "Technology",
        "Consumer Cyclical"
      ],
       "industries": [
        "Internet Content & Information",
        "Specialty Retail",
        "Media - Diversified"
      ],
      "imageUrl": "https://assets.bwbx.io/images/users/iqjWHBFdfxIU/iiT4fbpCD7v8/v2/-1x-1.png",
      "id": "a63b37b42f4c2a856535a3b7e8bb3190"
    }
  ]
}

Stream API

Setting up a news streaming API to receive newly published articles in real-time can be done in less than 10 lines of code.

First, install socket.io for Python:

pip install python-engineio==3.14.2 python-socketio[client]==4.6.0

Please use the exact python-engineio and python-socketio versions above.

The example below creates a socket.io client, connects to the Stream API server and prints new articles as they are published.

import socketio

sio = socketio.Client()

@sio.on('connect')
def on_connect():
    print("Connected to Newsfilter Stream API")

@sio.on('articles')
def on_articles(articles):
    print(articles)

sio.connect('http://stream.newsfilter.io?apiKey=YOUR_API_KEY')
sio.wait()

Topics

The news API supports a large range of topics, for example:

  • Quarterly and annual earnings reports
  • Insider trading reports filed with the SEC
  • Merger & acquisition news
  • IPOs and offerings
  • Legal proceedings and federal investigations
  • Changes to management

News Sources

News Provider Source ID
Analyst Ratings analystUpgrades
Bloomberg bloomberg
Reuters reuters
CNBC cnbc
Wall Street Journal wall-street-journal
Barrons barrons
PR Newswire prNewswire
Globe Newswire globenewswire
BusinessWire businesswire
AccessWire accesswire
SeekingAlpha seekingAlpha
Zacks Equity Research zacks
Benzinga benzinga
S&P Global sandpGlobal
Earnings Call Transcripts earningsCallTranscripts
US:
ClinicalTrials.gov clinicaltrials
Gov. Contract Awards (SAM.gov) usSam
SEC Filings sec-api
SEC Press Releases secPressReleases
FCC Filings fccFilings
CFTC Press Releases cftc
Patent Database (USPTO) uspto
Patent Trial & Appeal Board usptoTrialAndAppeal
Department of Defense usDod
FDA Drug Approvals usFda (usFdaType = drugApproval)
FDA Press Releases usFda (usFdaType = pressAnnouncement)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

financial_news_api-0.0.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

financial_news_api-0.0.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file financial_news_api-0.0.1.tar.gz.

File metadata

  • Download URL: financial_news_api-0.0.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.5

File hashes

Hashes for financial_news_api-0.0.1.tar.gz
Algorithm Hash digest
SHA256 61ce198100aedf053c6aa94911abd6011ce95de9738dd12b144f6b3222a2eaf8
MD5 b579a9a8de5c8d8324700cec756e2508
BLAKE2b-256 7848485d42fc218bd26d97e3e2815096e8fddbf0101e81bf141f5242ddd7e47b

See more details on using hashes here.

File details

Details for the file financial_news_api-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for financial_news_api-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 25b02ebdff40ff63088f520ab90c46ff0d8abeba7d2304ec87fbc2a392fc762f
MD5 749fb981214408dcd25866202d28d1cf
BLAKE2b-256 b0675e20df8021ef163015492d71e2cab57ae2524430a163c4ed00184d2135ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page