News
Scored headlines for Loaf’s listed real assets: property, data centres, refineries, fabs, grids, hotels. No API key required.
| News service | Loaf API | |
|---|---|---|
| REST | https://news.loafmarkets.com/v1/headlines | https://api.loafmarkets.com |
| WebSocket | wss://news.loafmarkets.com/v1/ws/headlines | wss://api.loafmarkets.com/ws |
| Auth | None | Order signature on order placement. Login token or Privy JWT on cancels, history, and the portfolio summary and component. See Authentication for the full list. |
Use requests (or axios) plus a WebSocket client. See Showing headlines for the seed-then-listen loop.
Note. Headlines live about 7 days. After that,
GET /v1/headlines/:idis 404 and a WebSocketlast_seen_idreplay returnscursor_expired. Re-seed from REST.
Showing headlines
Seed once, then keep a single socket open.
GET /v1/headlinesto fill your list.- Open
wss://news.loafmarkets.com/v1/ws/headlines, sendsubscribe, prepend eacharticleframe.
To show a headline, read these fields from each row:
| Display | Feed field |
|---|---|
| Id, link, breaking flag | id, url, breaking |
| Headline | title_rewritten |
| Time | published_at |
| Source | source_name |
| Summary | excerpt (fallback summary) |
| Sentiment | sentiment_score (−1…1, always the story’s own reading; it does not decay with age) |
| Impact | impact_score (0–10) |
| Impact reason | impact_rationale |
| Tickers | tickers: symbols the story mentions, mostly external (NVDA, TSM) |
| Type | feed_type: "property" or "market" |
| Loaf assets | assets: the listed Loaf assets the story graded to, when available |
tickers lists the symbols a story mentions, mostly external ones (NVDA, TSM). Use assets, not tickers, to identify a listed Loaf asset. assets is { ticker, tokenName, name, imageUrl }. Here tokenName is the asset’s token on GET /v1/assets, such as yongin, not the Loaf API’s tokenName. General-feed WebSocket rows, live or replayed, carry no assets. Read them from GET /v1/headlines/:id once the story is graded.
feed_type is the story’s primary type (higher of property_score / market_score; category breaks a tie). feed_types is the full list: a story that scores high on both axes has both types. GET /v1/headlines?feed_type= filters on that array, so a dual story is returned for either type, once per response.
Ask once vs listen
Same rule as the rest of the API:
- Ask once.
GET /v1/headlinesandGET /v1/headlines/:idreturn the current page. - Listen. WebSocket
articleframes are new rows, and rows replayed fromlast_seen_id.
Do not poll REST in a loop. Seed, then subscribe. Pass last_seen_id so a dropped socket can catch up.
Article object
Every headline row, REST or WebSocket, is this shape:
type FeedType = 'property' | 'market';
type Category =
| 'market_news'
| 'property_update'
| 'policy'
| 'economic'
| 'geopolitical'
| 'sale_transaction'
| 'energy'
| 'infrastructure'
| 'other';
interface Article {
id: string;
source_id: string;
source_name: string;
url: string;
title_original: string;
title_rewritten: string;
excerpt?: string;
summary?: string;
published_at: string; // ISO-8601
suburbs: { name: string; region?: 'central' | 'eastern' | 'north' | 'western' }[];
foreign_locations: string[];
/** Symbols the story mentions, mostly external market symbols. Use `assets` for Loaf assets. */
tickers: string[];
category: Category;
sentiment: 'positive' | 'negative' | 'neutral';
/** Net direction (−1…1): asset leg mixed with market leg. */
sentiment_score?: number;
/** Asset-specific direction, before the market is mixed in. */
property_sentiment: number;
/** Direction for the asset’s market / class. */
market_sentiment: number;
impact_score: number; // 0–10, derived from the two axes
property_score: number; // 0–10
market_score: number; // 0–10
asset_types: string[];
impact_rationale: string;
tags: string[];
breaking: boolean;
feed_type: FeedType;
feed_types: FeedType[];
last_updated_at?: string;
update_count: number;
also_reported_by: string[];
/** Present only when per-asset grading is available and this story graded to listed assets. */
assets?: { ticker: string; tokenName: string; name: string; imageUrl: string | null }[];
}property_score is how much the story reprices a tagged asset; market_score is how much it moves the class. A leaky roof is high property / low market. An RBA cut is the reverse. sentiment_score can disagree with property_sentiment on one asset, for example good news for the asset in a sold-off market.
Duplicate coverage of the same story collapses onto the first entry (update_count, also_reported_by, last_updated_at). published_at on that entry is when the story broke.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /v1/headlines | Paginated feed |
GET | /v1/headlines/:id | Single article |
GET | /v1/assets | Listed assets the news service tracks (when available) |
GET | /v1/assets/:token/headlines | That asset’s news (when available) |
GET | /v1/articles/:id/assets | Which assets one story graded to (when available) |
GET | /v1/sentiment | Impact-weighted sentiment for a scope + window |
GET | /v1/prices | Live instrument quotes (when available) |
Error body:
{ "error": { "code": "INVALID_QUERY", "message": "...", "details": [] } }Warning. When per-asset grading or the price feed is unavailable,
GET /v1/assets,/v1/assets/:token/headlines,/v1/articles/:id/assets, and/v1/pricesreturn 503 withASSET_GRADING_DISABLEDorPRICE_FEED_DISABLED. An empty feed is a 200 with no rows.
List responses are cached briefly. Price responses are not cached.
List headlines
GET /v1/headlines
Each page holds the highest-impact recent stories, listed newest first. Older stories are weighted down when a page is chosen. The impact_score on each row does not decay with age. A publisher cap keeps one outlet from filling the page.
Request
TypeScript
import axios from 'axios';
const response = await axios.get('https://news.loafmarkets.com/v1/headlines', {
params: { limit: 20, min_impact: 5, feed_type: 'property' },
});
const { headlines, next_cursor } = response.data;Python
import requests
r = requests.get(
"https://news.loafmarkets.com/v1/headlines",
params={"limit": 20, "min_impact": 5, "feed_type": "property"},
)
r.raise_for_status()
payload = r.json()
headlines, next_cursor = payload["headlines"], payload["next_cursor"]curl
curl -s 'https://news.loafmarkets.com/v1/headlines?limit=20&min_impact=5&feed_type=property'Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
feed_type | property | market | No | Matches feed_types, so a dual story is returned for either value. |
category | Category | No | One of the nine category values. |
min_impact | int 0–10 | No | Drop rows below this impact_score. |
since | ISO-8601 | No | Only articles published at or after this timestamp. |
suburb | string | No | Single suburb name. |
suburbs | CSV string | No | Several suburbs, comma-separated. |
region | central | eastern | north | western | No | Sydney region. |
limit | int 1–200 | No | Page size. Default 50. |
cursor | string | No | Opaque cursor from the previous next_cursor. |
Response
interface HeadlinesResponse {
headlines: Article[];
next_cursor: string | null;
server_time: string;
}Walk pages with next_cursor until it is null. Each page is chosen from a larger block of recent stories. next_cursor moves past the whole block, so stories a page leaves out do not appear on a later page. Walking every page does not return every headline. To catch up from a headline you hold, use the WebSocket last_seen_id replay.
Example row:
{
"id": "a-8f3c21",
"title_rewritten": "China halts gallium exports",
"source_name": "DigiTimes",
"url": "https://example.com/gallium",
"published_at": "2026-08-25T04:12:00.000Z",
"excerpt": "Export controls tighten on a key semiconductor input.",
"category": "geopolitical",
"sentiment": "negative",
"sentiment_score": -0.62,
"property_sentiment": -0.7,
"market_sentiment": -0.4,
"impact_score": 8,
"property_score": 4,
"market_score": 8,
"feed_type": "market",
"feed_types": ["market"],
"tickers": ["NVDA"],
"breaking": true,
"assets": [
{ "ticker": "YONG", "tokenName": "yongin", "name": "Yongin", "imageUrl": "https://…/banner.webp" }
]
}assets is omitted when per-asset grading is unavailable, or when the story graded to no listed asset.
Get one article
GET /v1/headlines/:id
Same Article as a list row, including assets when available. 404 NOT_FOUND if the id expired, was removed from the feed, or never existed.
TypeScript
const { data } = await axios.get('https://news.loafmarkets.com/v1/headlines/a-8f3c21');curl
curl -s 'https://news.loafmarkets.com/v1/headlines/a-8f3c21'Per-asset headlines
When per-asset grading is unavailable, GET /v1/assets, GET /v1/assets/:token/headlines, and GET /v1/articles/:id/assets return 503 ASSET_GRADING_DISABLED.
Each article is scored per listed asset. The same story can be negative for a fab and noise for a hotel. Each row in an asset feed carries the grade for that article and that asset in its asset block.
GET /v1/assets returns the listed assets the news service tracks. profiled is false for an asset the news service does not grade. Check it when an asset feed is empty.
| Field |
|---|
token |
ticker |
name |
type |
country |
profiled |
synced_at |
GET /v1/assets/:token/headlines returns that asset’s news. :token accepts the ticker or the asset’s token from GET /v1/assets (for example YONG or yongin).
Request
TypeScript
const { data } = await axios.get(
'https://news.loafmarkets.com/v1/assets/opera/headlines',
{ params: { min_property_score: 7, limit: 20 } },
);Python
r = requests.get(
"https://news.loafmarkets.com/v1/assets/opera/headlines",
params={"min_property_score": 7, "limit": 20},
)
r.raise_for_status()
for row in r.json()["headlines"]:
print(row["asset"]["headline_for_asset"], row["asset"]["property_score"])curl
curl -s 'https://news.loafmarkets.com/v1/assets/opera/headlines?min_property_score=7&limit=20'Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
min_property_score | int 0–10 | No | Floor on this asset’s property_score. Default 6. A value below 6 returns the same rows as 6. |
since | ISO-8601 | No | Inclusive lower bound on published_at. |
before | ISO-8601 | No | Exclusive upper bound. |
limit | int 1–200 | No | Default 50. |
cursor | string | No | From the previous next_cursor. |
404 NOT_FOUND if :token is not a listed asset.
Extra asset block on each row
interface AssetHeadlineRow extends Article {
asset: {
ticker: string;
token: string;
property_score: number;
property_sentiment: number; // this asset’s direction
sentiment_score: number; // netted against the article’s market leg
relation: 'same_asset' | 'operator' | 'commodity' | 'demand' | 'same_city' | 'same_country' | 'sector';
why: string;
headline_for_asset: string;
breaking_for_asset: boolean;
};
}relation is the strongest link between the story and the asset that the article text supports. The values run from strongest (same_asset) to weakest (sector).
GET /v1/articles/:id/assets returns the same grades for one story, highest property_score first. List rows already carry assets when the story graded to a listed asset, so you do not need one request per row.
WebSocket
wss://news.loafmarkets.com/v1/ws/headlines
One connection. Send JSON client messages; handle server frames by type. Heartbeat every 30s. The server also sends protocol pings, which standard WebSocket clients answer automatically. If your client stops answering them, the server closes the socket with 1011.
Subscribe to headlines
{
"type": "subscribe",
"filters": {
"min_impact": 5
},
"last_seen_id": "a-8f3c21"
}filters (all optional):
| Field | Meaning |
|---|---|
suburbs | string[] |
region | central | eastern | north | western |
categories | string[] of category values |
min_impact | int 0–10 |
token | Loaf asset ticker, for example YONG. Articles graded to that asset, delivered after grading. Omit this for the general feed. With token, only min_property_score applies. suburbs, region, categories, and min_impact are ignored. |
min_property_score | int 0–10, used with token. Leaving it out, or a value below 6, gives the same frames as 6. |
Filtering on feed_type is REST-only. On the socket, use categories, min_impact, or token.
When per-asset grading is unavailable, a subscribe with token is still acknowledged with subscribed, but no live article frames arrive for it. Before you subscribe with token, check that GET /v1/assets/:token/headlines returns 200 for the same ticker. The socket token matches the ticker only, not the tokenName.
last_seen_id triggers a replay of what you missed. Replay frames are ordinary article messages (dedupe on id), then replay_complete.
TypeScript
const ws = new WebSocket('wss://news.loafmarkets.com/v1/ws/headlines');
let lastSeenId: string | undefined;
ws.onopen = () => {
ws.send(JSON.stringify({
type: 'subscribe',
filters: { min_impact: 5 },
last_seen_id: lastSeenId,
}));
};
ws.onmessage = (event) => {
const msg = JSON.parse(String(event.data));
if (msg.type === 'article') {
lastSeenId = msg.article.id;
// handle msg.article
} else if (msg.type === 'replay_complete' && (msg.truncated || msg.reason === 'cursor_expired')) {
// replay gap: GET /v1/headlines again
}
};
ws.onclose = () => setTimeout(() => { /* reconnect with lastSeenId */ }, 3000);Python
import json
from websocket import WebSocketApp # pip install websocket-client
NEWS_WS = "wss://news.loafmarkets.com/v1/ws/headlines"
last_seen_id = headlines[0]["id"] if headlines else None
seen = {h["id"] for h in headlines}
def on_open(ws):
ws.send(json.dumps({
"type": "subscribe",
"filters": {"min_impact": 5},
"last_seen_id": last_seen_id,
}))
def on_message(ws, raw):
msg = json.loads(raw)
if msg.get("type") == "article":
article = msg["article"]
if article["id"] in seen:
return
seen.add(article["id"])
print(article["title_rewritten"], article.get("sentiment_score"), article.get("impact_score"))
elif msg.get("type") == "replay_complete" and (
msg.get("truncated") or msg.get("reason") == "cursor_expired"
):
pass # re-seed GET /v1/headlines
ws = WebSocketApp(NEWS_WS, on_open=on_open, on_message=on_message)
ws.run_forever()Server frames
type | When |
|---|---|
heartbeat | Every 30s while subscribed (server_time) |
subscribed | After a valid subscribe |
article | { article: Article }, live or replayed. On the general feed it carries no assets. Per-asset subscribers also get assets and the asset block, without token. |
story_updated | Later coverage collapsed onto a row. story_id (that row’s id), reported_by_count (outlets that ran the story), last_updated_at |
article_updated | A row changed in place. article (the new row, without assets or asset), changed (names of some of the fields that changed). sentiment, feed_type, feed_types, breaking, and tags can change without being named. Copy every field of article onto your row |
article_removed | A row left the feed. Drop it. id, reason (free text), optional merged_into (the id of the row that absorbed it) |
article_restored | A removed row is back in the feed. id. GET /v1/headlines/:id returns it again |
replay_complete | End of backfill. count, optional truncated, optional reason: cursor_expired | error |
error | { code, message } |
sentiment_subscribed / sentiment_update | After subscribe_sentiment |
prices_subscribed / price_update | After subscribe_prices |
story_updated, article_updated, article_removed, and article_restored go to every headline subscriber, whatever its filters. They can name rows you do not hold. A last_seen_id replay also sends article_removed frames, before replay_complete.
If replay_complete.truncated is true, the replay stopped before the newest headlines. Re-seed from REST. reason: "cursor_expired" means last_seen_id aged out of the 7-day window.
Optional: sentiment and prices on the same socket
{ "type": "subscribe_sentiment", "scopes": [{ "type": "global" }] }{ "type": "subscribe_prices", "instrument_ids": ["BRENT", "US10Y", "TSLA"] }instrument_ids are price-feed ids (BRENT, US10Y). They are separate from article.tickers and from Loaf tickers. If the price feed is unavailable, the server replies error / PRICE_FEED_DISABLED and does not ack. After prices_subscribed, the server sends a snapshot price_update for the requested instruments that already have a price (the feed only pushes on change). If none of them has a price yet, no snapshot is sent. Ids the feed does not know get an error frame with code UNKNOWN_INSTRUMENTS, whose message lists them. The known ids are still subscribed.
REST equivalents: GET /v1/sentiment?scope=global&window=24h (window: 1h | 6h | 24h | 7d; suburb/region need name) and GET /v1/prices?ids=BRENT,US10Y. Prices return 503 PRICE_FEED_DISABLED when the price feed is unavailable, or PRICES_UNAVAILABLE when it has no prices yet.
A headlines client uses the REST feed plus subscribe. Sentiment and prices are separate subscriptions.