---
title: "9fin 1.3 News: keeping a feed current"
description: "Keep a news feed or watchlist current: pick up new articles, and the ones 9fin has amended since you last looked."
url: "https://console.9fin.com/guides/news-keeping-a-feed-current"
image: "https://console.9fin.com/_og/d/c_Ocean.takumi,title_~OWZpbiAxLjMgTmV3czoga2VlcGluZyBhIGZlZWQgY3VycmVudA,description_~S2VlcCBhIG5ld3MgZmVlZCBvciB3YXRjaGxpc3QgY3VycmVudDogcGljayB1cCBuZXcgYXJ0aWNsZXMsIGFuZCB0aGUgb25lcyA5ZmluIGhhcyBhbWVuZGVkIHNpbmNlIHlvdSBsYXN0IGxvb2tlZC4,props_eyJ0aGVtZSI6eyJtb2RlIjoibGlnaHQiLCJjb2xvcnMiOnsicHJpbWFyeSI6IiMwOTVDRUYifX19,p_Ii9ndWlkZXMvbmV3cy1rZWVwaW5nLWEtZmVlZC1jdXJyZW50Ig,s_Lo5_yHwA4eT71Fj8.png"
---

# 9fin 1.3 News: keeping a feed current

**APIs used in this notebook**

| API               | Version | Endpoints              |
| :---------------- | :------ | :--------------------- |
| News & Content v2 | 0.3.41  | GET /v2/news/headlines |

Before you start

Run [notebook 0.1](https://console.9fin.com/guides/authentication) first; it provides the access token and the `api_get` helper that every call below uses.

Sample output

**Every output on this page is a static sample.** The results below were captured from a live run in October 2026 and are reproduced here so the page reads without credentials. Figures, article titles, identifiers and API versions were current that day and will have moved on since. Run the notebook yourself for live data.

You have a feed from [notebook 1.2](https://console.9fin.com/guides/news-choosing-what-arrives), or a list of companies from [notebook 0.2](https://console.9fin.com/guides/data-model). This notebook keeps it up to date: new articles, and articles you already hold that we have since amended.

## [Why the feed order decides the design](#why-the-feed-order-decides-the-design)

**Headlines come back ordered by `updated_at`, newest first.** Not by publication date.

That ordering decides the whole design. When we amend a story, the amended version returns to the top of the feed. So a newly published article and a two year old one corrected this morning arrive in the same place, and a single read from the top catches both.

`since` and `until`, by contrast, filter on the **publication** date. They are right for backfilling a period and wrong for staying current, because a correction to an old article falls outside any recent window.

So the pattern is: remember the highest `updated_at` you have processed, read from the top of the feed until you reach it, stop.

```python
%run "9fin 0.1 Authentication - getting a token.ipynb"

import json, pathlib, datetime
import pandas as pd
pd.set_option("display.max_colwidth", 120)
```

First, see the ordering for yourself:

```python
recent = api_get("/v2/news/headlines", source_type="9fin", limit=200)["items"]

all(a["updated_at"] >= b["updated_at"] for a, b in zip(recent, recent[1:]))
```

_Sample output, captured October 2026. Static snapshot, not live data._

```text
True
```

And how often the two dates differ, which is how much a publication-date window would miss:

```python
amended = [i for i in recent if i["published_at"][:10] != i["updated_at"][:10]]

len(amended), amended[0]["published_at"][:10], amended[0]["updated_at"][:10]
```

_Sample output, captured October 2026. Static snapshot, not live data._

```text
(20, '2026-10-28', '2026-10-29')
```

A good share of the most recent feed was published on an earlier day. Some of those gaps are years wide.

## [Defining the universe](#defining-the-universe)

Anything the headlines endpoint filters on will do. This is the distressed desk from [notebook 1.2](https://console.9fin.com/guides/news-choosing-what-arrives).

```python
UNIVERSE = {"source_type": "9fin", "region": "Europe",
            "content_tags__in": "9fin-Distressed,9fin-Liability Management (LME)"}
```

## [The state you keep](#the-state-you-keep)

Two things, and they fit in a small JSON file.

**`mark`** is the highest `updated_at` you have processed. The poll stops when it reaches it.

**`seen`** maps an article id to the `updated_at` you last held for it. That is what distinguishes a genuinely new article from one you already have that has changed.

```python
STATE = pathlib.Path("cache/universe_state.json")
STATE.parent.mkdir(exist_ok=True)

state = json.loads(STATE.read_text()) if STATE.exists() else {"mark": "", "seen": {}}
len(state["seen"]), state["mark"] or "not set"
```

_Sample output, captured October 2026. Static snapshot, not live data._

```text
(174, '2026-10-21T10:03:55.929615')
```

## [Seeding it the first time](#seeding-it-the-first-time)

On a first run there is nothing to compare against, so fill the state from some history. This is the one place `since` and `until` are the right tool, because you are selecting a period of publication rather than of change.

In a running job you seed once. Here the cells below **rebuild the state as it stood three days ago** on every run, so the poll always has three days of real movement to classify and the delta below is never empty.

```python
def walk_headlines(**filters):
    """Every headline matching a filter, following the cursor."""
    out, cursor = [], None
    while True:
        page = api_get("/v2/news/headlines", **filters, limit=200,
                       **({"cursor": cursor} if cursor else {}))
        out += page["items"]
        cursor = page.get("next_cursor")
        if not cursor:
            return out
```

```python
ago = lambda days: (datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None)
                    - datetime.timedelta(days=days)).isoformat()

MARK = ago(3)
```

Each backfilled article is recorded at `min(updated_at, MARK)`, not at its current `updated_at`. Three days ago you held the article, but you did not hold any amendment we have made to it since. Capping the stored timestamp at the mark says exactly that, and it is what lets the poll below tell a genuine amendment from an article you already have unchanged.

```python
history = walk_headlines(**UNIVERSE, since=ago(45)[:10], until=MARK[:10])
state = {"mark": MARK, "seen": {i["uuid"]: min(i["updated_at"], MARK) for i in history}}

len(state["seen"]), state["mark"][:19]
```

_Sample output, captured October 2026. Static snapshot, not live data._

```text
(167, '2026-10-26T10:06:33')
```

## [The poll](#the-poll)

Read from the top, stop at the mark. Everything above it is unprocessed; nothing below it can have changed, because the feed is ordered by exactly that field.

In steady use this is a single call.

```python
def poll(mark, max_pages=20):
    """Headlines updated since `mark`, newest first."""
    fresh, cursor = [], None
    for _ in range(max_pages):
        page = api_get("/v2/news/headlines", **UNIVERSE, limit=200,
                       **({"cursor": cursor} if cursor else {}))
        for item in page["items"]:
            if item["updated_at"] <= mark:
                return fresh
            fresh.append(item)
        cursor = page.get("next_cursor")
        if not cursor:
            return fresh
    return fresh
```

```python
fresh = poll(state["mark"])

len(fresh)
```

_Sample output, captured October 2026. Static snapshot, not live data._

```text
26
```

## [New, amended, or already held](#new-amended-or-already-held)

Compare each result against `seen`:

-   **new**, an id you have never met
-   **amended**, an id you hold, coming back with a newer timestamp. This is the one to surface separately, because the story you filed yesterday may now say something different
-   **already held**, an id at the same timestamp

The third case cannot appear in this run. The poll returns only what changed after the mark, and the rebuilt state caps every held timestamp at the mark, so each result is necessarily new or amended. In a running job, where the mark and `seen` both carry real timestamps from the last poll, the same comparison does throw up the occasional unchanged duplicate, which is why the branch is there.

```python
def status(item):
    previous = state["seen"].get(item["uuid"])
    return "new" if previous is None else "amended" if item["updated_at"] > previous else "already held"

delta = pd.DataFrame([{"status": status(i), "published": i["published_at"][:10],
                       "updated": i["updated_at"][:16], "title": i["title"][:58]} for i in fresh])

delta["status"].value_counts().to_dict()
```

_Sample output, captured October 2026. Static snapshot, not live data._

```text
{'new': 25, 'amended': 1}
```

The amended rows are the ones to look at: articles published days or years ago that we have since revised, which a publication-date window would never have returned.

```python
delta[delta["status"] == "amended"]
```

_Sample output, captured October 2026. Static snapshot, not live data._

| status  | published  | updated          | title                                                    |
| :------ | :--------- | :--------------- | :------------------------------------------------------- |
| amended | 2026-10-20 | 2026-10-26T11:13 | Term time — The financial woes of UK universities (9fin) |

Then record what you processed and move the mark forward:

```python
state["seen"].update({i["uuid"]: i["updated_at"] for i in fresh})
state["mark"] = max([state["mark"], *(i["updated_at"] for i in fresh)])
STATE.write_text(json.dumps(state))

len(state["seen"]), state["mark"][:19]
```

_Sample output, captured October 2026. Static snapshot, not live data._

```text
(192, '2026-10-29T09:42:24')
```

## [Following companies instead of tags](#following-companies-instead-of-tags)

A universe can equally be a list of companies from [notebook 0.2](https://console.9fin.com/guides/data-model), and the endpoint filters on them directly: `nf_ids__in` takes up to ten entity ids and returns anything referencing any of them. The match is on identifiers, never on the name appearing in the text, so it does not drift the way a keyword search would.

```python
WATCHLIST = {"nf_ent_e276f5f7d33f45a0a6fb67212c52c2c5": "First Brands",
             "nf_ent_df4aa6984c5e4d69bac1b8809cb8b6b2": "Iceland",
             "nf_ent_8241128f33154e4cb95848c6d4f80cc8": "Ardagh"}
```

```python
watched = walk_headlines(nf_ids__in=",".join(WATCHLIST), since=ago(30)[:10])

len(watched)
```

_Sample output, captured October 2026. Static snapshot, not live data._

```text
18
```

The server does the selecting, so you pay for the articles you want rather than filtering a month of everything on your own machine. Which company each one names still has to be read off the entities block, because an article can reference several.

```python
def named_in(article):
    """Which watchlist companies this headline names."""
    ids = {(article["entities"].get("main") or {}).get("nf_id")} \
          | {e["nf_id"] for e in article["entities"].get("additional", [])}
    return sorted(WATCHLIST[i] for i in ids & WATCHLIST.keys())
```

```python
pd.DataFrame([{"updated": a["updated_at"][:16], "companies": ", ".join(named_in(a)),
               "title": a["title"][:58]} for a in watched])
```

Sample output, captured October 2026 (20 lines)

| updated          | companies    | title                                                      |
| :--------------- | :----------- | :--------------------------------------------------------- |
| 2026-10-26T17:50 | First Brands | Onset raises First Brands trustee election prospect over p |
| 2026-10-23T17:53 | First Brands | Fibra Prologis bad-debt reserves rise due to two strained  |
| 2026-10-22T11:23 | Ardagh       | Q3 2026 Financial Report                                   |
| 2026-10-22T11:16 | Ardagh       | Ardagh Q3 Earnings Flash: Sales +11.2% YoY, EBITDA -0.5% Y |
| 2026-10-22T11:06 | Ardagh       | Q3 2026 Results Presentation                               |
| 2026-10-22T11:05 | Ardagh       | Ardagh Group S.A. - Third Quarter 2026 Results (pr-newswir |
| 2026-10-22T11:01 | Ardagh       | Ardagh Group S.A. - Third Quarter 2026 Results             |
| 2026-10-21T21:08 | First Brands | First Brands former co-CRO says he was ‘not aware’ Evoluti |
| 2026-10-21T12:02 | First Brands | First Brands and creditor Evolution set for dispute over $ |
| 2026-10-20T18:32 | First Brands | First Brands court leaves insurance dispute unresolved as  |
| 2026-10-19T16:37 | Ardagh       | Ardagh kickstarts carve-up with Trivium sale (9fin)        |
| 2026-10-19T11:08 | Ardagh       | Ardagh Group Announces Sale of Trivium Packaging           |
| 2026-10-15T15:09 | Ardagh       | Luxembourg court unblocks Ardagh Metal Packaging sale (9fi |
| 2026-10-15T13:11 | Ardagh       | Further Update on Ardagh Metal Packaging S.A. Sales Proces |
| 2026-10-12T06:02 | Iceland      | Iceland Bondco Plc -- Cancellation of Listing              |
| 2026-10-09T17:00 | Iceland      | Iceland Bondco Plc -- Admission to Official List           |
| 2026-10-06T10:51 | Ardagh       | Ardagh weighs selling African glass unit (Irish Times)     |
| 2026-10-01T10:22 | Ardagh       | Top of the Flops — European Distressed Watchlist September |

Over ten companies, run a poll per batch of ten and merge the results. A watchlist universe then slots into exactly the same `mark` and `seen` machinery as a tag universe: put `nf_ids__in` in `UNIVERSE` and everything above this section works unchanged.

## [How often to poll](#how-often-to-poll)

A poll is one call whenever fewer than 200 articles in your universe have changed, which for a desk feed is nearly always. So choose the interval from how quickly you need to react, not from cost.

For scale: we published an average of 44 articles a day across all our own coverage in a representative month, with a busiest day of 71. A desk sees a fraction of that. Five or fifteen minutes keeps you close to real time and sits well inside the 100 calls a minute the News API allows.

## [Running it unattended](#running-it-unattended)

The loop is three lines, and it is idempotent. If a run fails or the machine restarts, the next one picks up from the mark and nothing is missed or handled twice.

```python
fresh = poll(state["mark"])
# hand `fresh` to your own destination here
state["seen"].update({i["uuid"]: i["updated_at"] for i in fresh})
state["mark"] = max([state["mark"], *(i["updated_at"] for i in fresh)])
```

Two refinements for production. Move the mark forward only after the batch has been handled successfully, so a failure downstream retries rather than skips. And trim `seen` to the period you care about, because it grows.

## [The polling contract](#the-polling-contract)

|                                       |                                                     |
| :------------------------------------ | :-------------------------------------------------- |
| the feed is ordered by updated_at     | one read from the top catches new and amended alike |
| since and until filter on publication | right for backfill, wrong for staying current       |
| mark plus seen                        | the whole state a poller needs                      |

Any `uuid` here goes to **[notebook 1.1](https://console.9fin.com/guides/news-reading-an-article)** to read in full, or to **[notebook 2.2](https://console.9fin.com/guides/instruments-from-story-to-bond)** to reach the bond a story is about.

---

← Previous guide

1.2 News: choosing what arrives

<https://console.9fin.com/guides/news-choosing-what-arrives>

Next guide →

2.1 Instruments: bonds and loans

<https://console.9fin.com/guides/instruments-bonds-and-loans>