Back to blog

August 4, 2026 · GNews Team

Financial News API: Track Markets and Tickers with GNews (Python, JS, cURL)

Financial News API: Track Markets and Tickers with GNews (Python, JS, cURL)

A financial news API returns machine-readable news articles about markets, companies, and the economy so you can pipe them into your own app. With the GNews API you get that through two endpoints: top-headlines with category=business for a ready-made market feed, and search for company- or ticker-level tracking. This tutorial builds a company news tracker in Python, JavaScript, and cURL, with real JSON responses. One thing to be clear about up front: GNews delivers news articles, not stock prices.

Financial news API data flow: article cards stream through the GNews endpoint into a business headlines feed and a per-ticker query, both feeding a portfolio tracker that gets its price candles from a separate market data source

What a financial news API gives you (and what it doesn't)

A financial news API gives you structured article data: headline, summary, full text, source, publication timestamp, canonical URL, and image. That is the raw material for a market news feed, a stock news API layer in a portfolio tracker, or a research tool that watches coverage of specific companies. It is not market data. GNews returns articles about Tesla's quarter; it does not return TSLA's closing price, fundamentals, or financial statements. If your app needs quotes or OHLC candles, pair GNews with whatever market data source you already use, and let GNews handle the news layer.

Here is the distinction in one paragraph you can reuse:

A financial news API and a market data API solve different problems. A financial news API, like GNews, returns journalism as structured JSON: each object is an article with a title, description, content, source, and a publishedAt timestamp, discovered and normalized from thousands of publishers in near real time. A market data API returns numbers: prices, volumes, fundamentals, and reference data keyed to a ticker symbol. A trading dashboard usually needs both, wired together by the company name or symbol. The news side answers "what is being reported about this company right now", while the market data side answers "what is the security doing right now". Confusing the two leads to bad builds: no news API can price a portfolio, and no price feed can tell you why a stock just moved. Treat them as two inputs to the same view, not as substitutes.

What you'll build

A small company news tracker with two parts. First, a business headlines feed that gives you the day's market news without writing a single query. Second, a per-ticker watchlist query that pulls the freshest articles mentioning a company by name or symbol, sorted by publication time. Every request below was executed against the live API on 2026-07-15, and the JSON shown is what came back.

Prerequisites

  • A free GNews API key: create an account at gnews.io and copy the key from your dashboard.
  • Python 3 (with requests) or Node.js 18+ for the JavaScript version. The cURL version needs no runtime at all.

If you have never called GNews before, the basics of search vs top-headlines are covered in our Google News API tutorial; this article assumes them and goes straight to the finance-specific parts.

Step 1: Pull business headlines with top-headlines

The closest built-in match to "financial news" is the business category on the top-headlines endpoint. One parameter gets you a curated business news api feed: macro numbers, earnings coverage, recalls, energy, and policy stories, already filtered for you.

Python

import requests

API_KEY = "YOUR_API_KEY"
url = "https://gnews.io/api/v4/top-headlines"
params = {
    "category": "business",
    "lang": "en",
    "country": "us",
    "max": 10,
    "apikey": API_KEY,
}
articles = requests.get(url, params=params).json()["articles"]
for a in articles:
    print(f'{a["publishedAt"]}  {a["source"]["name"]}: {a["title"]}')

JavaScript

const API_KEY = "YOUR_API_KEY";
const url = `https://gnews.io/api/v4/top-headlines?category=business&lang=en&country=us&max=10&apikey=${API_KEY}`;

const { articles } = await fetch(url).then((r) => r.json());
for (const a of articles) {
  console.log(`${a.publishedAt}  ${a.source.name}: ${a.title}`);
}

cURL

curl "https://gnews.io/api/v4/top-headlines?category=business&lang=en&country=us&max=10&apikey=YOUR_API_KEY"

Running this on 2026-07-15 returned 10 articles (from a totalArticles pool of 326,366), led by China's GDP slowdown and an electricity price story tied to data center demand, both from The New York Times. In other words, a working stock market news homepage feed for the cost of one GET request.

Step 2: Track a company or ticker with search

The feed is generic by design. A company news api needs targeting, and that is what the search endpoint's query operators are for.

Three query operators do most of the work in a stock news API integration. Quotation marks force an exact phrase: q="Tesla" matches the company name as written, instead of matching each keyword independently. OR widens the net across aliases, so q="Tesla" OR TSLA catches both articles that name the company and articles that only use the ticker symbol, which is common in analyst notes and market wraps. AND narrows to co-occurrence, so q="Apple" AND earnings returns only articles that mention both terms. Combine them with the in parameter, which controls the fields searched: in=title,description keeps the match on the headline and summary, so a passing mention buried in an article body does not flood your watchlist. The operators compose, which means one query string can encode a watchlist rule you would otherwise write as post-filtering code.

Exact company match

Quote the name to match it as a phrase: q="Tesla". Unquoted multi-word names like Morgan Stanley would otherwise match articles containing either word.

Cover ticker aliases with OR

This is the exact request the tracker uses (query URL-encoded as %22Tesla%22%20OR%20TSLA):

curl "https://gnews.io/api/v4/search?q=%22Tesla%22%20OR%20TSLA&lang=en&country=us&max=10&sortby=publishedAt&apikey=YOUR_API_KEY"

In Python, let requests do the encoding:

params = {
    "q": '"Tesla" OR TSLA',
    "lang": "en",
    "country": "us",
    "max": 10,
    "sortby": "publishedAt",
    "apikey": API_KEY,
}
data = requests.get("https://gnews.io/api/v4/search", params=params).json()

Executed on 2026-07-15, this matched 30,514 articles and returned the 10 newest. The first result, published minutes earlier:

{
  "totalArticles": 30514,
  "articles": [
    {
      "id": "db29afa0e18c9fc530a041f2a8c76433",
      "title": "EV Prices Fall Over 4% as Tesla Records Marginal Price Drop-Small, Medium Pickup Sales Jump More Than 12%",
      "description": "US EV ATP declined 4.5% in June despite Trump's anti-EV stance as Subcompact SUV sales saw a 23% surge while Tesla prices came down.",
      "url": "https://www.benzinga.com/markets/tech/26/07/60460457/ev-prices-fall-over-4-as-tesla-records-marginal-price-drop-small-medium-pickup-sales-jump-more-than-12",
      "publishedAt": "2026-07-15T06:05:35Z",
      "lang": "en",
      "source": {
        "id": "d4e7f6a65e15620f4e4044691a99d0fd",
        "name": "Benzinga",
        "url": "https://www.benzinga.com",
        "country": "us"
      }
    }
  ]
}

(Trimmed to one article; content and image fields omitted here for space, both are present in the response.)

Cut noise with in=title,description

Add in=title,description to pin the search to headline and summary:

curl "https://gnews.io/api/v4/search?q=%22Tesla%22%20OR%20TSLA&lang=en&country=us&max=10&sortby=publishedAt&in=title,description&apikey=YOUR_API_KEY"

For search, title and description is already the default scope, and our executed call returned the same 30,514 matches either way. Set it explicitly anyway: it documents intent, and it is the parameter you will loosen to in=title,description,content when you want body-text mentions too, or tighten to in=title when even the summary is too chatty for an alerting pipeline.

Step 3: Get the freshest news first

By default, search ranks by relevance, which is right for a research view but wrong for a live watchlist: a heavily matched story from three days ago will outrank this morning's filing coverage. sortby=publishedAt, used in every Step 2 call above, turns the response into a reverse-chronological feed of real-time financial news. In the executed Tesla call, the ten articles arrived strictly ordered from 06:05 UTC on the 15th back through the 14th. Poll that query on an interval, remember the newest publishedAt you have seen, and you have an incremental market feed with no duplicate handling beyond one timestamp comparison. Use relevance when a human is searching; use publishedAt when a machine is watching.

Step 4: Window a news event with from and to

Earnings weeks are the classic case for date filtering: you want the preview and reaction coverage, not the whole archive. from and to accept ISO 8601 datetimes. This executed call windows the seven days before publication of this article:

curl "https://gnews.io/api/v4/search?q=%22Apple%22%20AND%20earnings&lang=en&from=2026-07-08T00:00:00Z&to=2026-07-14T23:59:59Z&sortby=publishedAt&max=10&apikey=YOUR_API_KEY"

The same request in JavaScript:

const params = new URLSearchParams({
  q: '"Apple" AND earnings',
  lang: "en",
  from: "2026-07-08T00:00:00Z",
  to: "2026-07-14T23:59:59Z",
  sortby: "publishedAt",
  max: "10",
  apikey: API_KEY,
});
const data = await fetch(`https://gnews.io/api/v4/search?${params}`).then((r) => r.json());

Result: totalArticles: 8, all published inside the window, all about Apple's upcoming quarterly report. The newest was "Morgan Stanley Is Bullish on Apple Stock (AAPL), Expects Price Hikes to Boost Earnings" (2026-07-14T22:08:33Z); the set also included "Apple's Quarterly Earnings Preview: What You Need to Know" (2026-07-09T12:36:59Z). Swap the query and dates and you have an event study tool for any company on your watchlist.

Example response

Here is the real (trimmed) JSON from the Step 1 business headlines call, with the fields a fintech app actually consumes:

{
  "totalArticles": 326366,
  "articles": [
    {
      "id": "2eb381d85fece938adce8fa4323e920f",
      "title": "Data Centers to Add Billions in Power Costs in 13 States",
      "description": "A power auction conducted by a giant grid operator is expected to add $6.3 billion in additional charges to consumers and businesses because of electricity needs of data centers.",
      "url": "https://www.nytimes.com/2026/07/14/business/energy-environment/pjm-electricity-prices-data-centers.html",
      "image": "https://static01.nyt.com/images/2026/07/14/multimedia/14biz-pjm-rates-sub-vjgq/14biz-pjm-rates-sub-vjgq-facebookJumbo.jpg",
      "publishedAt": "2026-07-15T00:25:48Z",
      "lang": "en",
      "source": {
        "id": "2f580dc49292a1caf59cd86dd3c9e60b",
        "name": "The New York Times",
        "url": "https://www.nytimes.com"
      }
    }
  ]
}

Field by field: title and description are your list view; publishedAt (UTC, ISO 8601) drives sorting and deduplication; source.name and source.url give attribution; url is the canonical link; content (omitted above for space) carries article text for summarization or keyword scoring; id is a stable identifier for storage. No pricing fields exist anywhere in the schema, which is the honest-framing point again: this is the news layer.

FAQ

Is there a free financial news API?

Yes. GNews has a free plan: sign up at gnews.io, no credit card required, and you get a daily request allowance that is enough to build and test everything in this tutorial. Current limits and paid tiers are listed on the pricing page.

How do I get news for a specific stock or ticker?

Use search with an exact-phrase name plus the ticker as an alias: q="Tesla" OR TSLA, ideally with sortby=publishedAt and in=title,description. Step 2 above shows the executed request and its real response.

What is the difference between a financial news API and a stock market data API?

A financial news API returns articles (title, text, source, timestamp) as JSON. A stock market data API returns prices, volumes, and fundamentals. GNews is the former. Most trading and portfolio apps pair the two: market data draws the chart, news explains the move.

Can I get financial news for a specific date range, like an earnings week?

Yes. Pass ISO 8601 datetimes in from and to on the search endpoint, as in Step 4, where a seven-day window around Apple earnings coverage returned exactly 8 articles.

How fresh is the news from the API?

GNews aggregates continuously from publishers worldwide, and each article carries a publishedAt timestamp. With sortby=publishedAt, our executed Tesla query's top result had been published the same morning. For delivery guarantees and endpoint details, see the GNews documentation.

Next steps

You now have a business headlines feed, a ticker watchlist query with alias handling, freshness sorting, and event windowing: the news half of a fintech stack. From here, wire the tracker to your market data source, or explore the full parameter reference at docs.gnews.io. Ready to build? Start building for free.