Quickstart

The Finlight.me WebSocket API allows you to receive real-time financial news articles as they are published. Unlike the REST API, which requires periodic polling to fetch new data, the WebSocket API pushes newly published articles to you in real-time, ensuring you stay updated without making repeated requests.

  • Real-time Updates: Once connected, you first receive the latest matching article for your query. After that, any newly published articles that match your query are sent to you automatically.
  • Continuous Streaming: Stay connected as long as needed. Each pricing tier includes a fixed number of parallel WebSocket connections that can remain open throughout the month. There is no usage-based pricing — you’re only limited by the number of concurrent connections allowed in your tier.
  • Sentiment Analysis: Articles come with sentiment data to help you quickly assess market mood.

Sign Up and Get Your Free API Key

If you haven’t already, sign up at the Finlight Dashboard to obtain your free API key. This key will be used to authenticate your WebSocket connection, just like with the REST API.

Choose Your Client

To connect to the Finlight.me WebSocket API, you can use our Node.js or Python client libraries. These libraries simplify handling the connection, authentication, and keep-alive mechanisms (ping/pong).

# Install the Node.js client library via npm
npm install finlight-client

Connect and Receive Real-Time Articles

With your API key and chosen client, you can now establish a WebSocket connection. Upon connecting, you’ll immediately receive the most recent article matching your query, followed by any new articles as they come in. The client libraries handle authentication and the ping/pong keep-alive mechanism for you.

WebSocket
wss://wss.finlight.me
import { FinlightApi } from 'finlight-client'

const client = new WebSocketClient({
  apiKey: 'YOUR_API_KEY',
})

client.websocket.connect(
  { query: 'nvidia', language: 'en', extended: false },
  (article) => {
    console.log('New article received:', article)
  },
)

This connection remains open as long as you need it, continually delivering new articles that match your query. Remember that your billing is based on connection duration, so be mindful to disconnect when you no longer need updates.

What's Next?

Now that you’ve successfully connected to the WebSocket API and received real-time articles, here are a few next steps you may find helpful:

  • Explore filtering by source or extended queries to refine the articles you receive.
  • Adjust your query parameters as needed to track different companies, indices, or financial topics.
  • Review your usage and connection minutes in the Finlight Dashboard to stay within the free tier limits.

Was this page helpful?