newsfilter.io - Stock Market News API

newsfilter.io - Stock Market News API

  • Home

›Stream API

Overview

  • Introduction
  • News Sources
  • Companies & Exchanges

Query API

  • Overview
  • API Endpoint
  • Authentication
  • Request & Response Formats
  • Example: Python
  • Example: cURL
  • Example: Node.js
  • Tutorials

Stream API

  • Overview
  • API Endpoint
  • Authentication
  • Message Format
  • Example: Python
  • Example: Node.js
  • Example: Browser + JS

Integrations

  • Discord

Python Example

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 simple example below creates a socket.io client, connects to our server and prints all articles as they are received.

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()

Learn more about socket.io for Python here: https://python-socketio.readthedocs.io/en/latest/client.html

← Message FormatExample: Node.js →
newsfilter.io - Stock Market News API
Documentation
IntroductionNews Query API News Stream APINews Render APIDiscord News Bot
Contact
support@newsfilter.io
Social
Follow @newsfilterio
Follow Us on Stocktwits
Copyright © 2022 newsfilter.io