Skip to main content

AI Agent Skill

Copy the SKILL.md below into your project to teach AI coding agents how to use the TradingNews API. Works with Claude Code, Cursor, GitHub Copilot, and other AI tools.
---
name: tradingnews-api
description: |
  Use the TradingNews API to fetch real-time financial news for trading bots,
  market analysis, or portfolio monitoring. Trigger when the user wants to
  integrate financial news, build a news-driven trading bot, or connect to
  TradingNews.
---

Full Skill Content

TradingNews provides a unified, real-time financial news API. It aggregates breaking news from multiple curated sources into a single structured stream.

Base URL

https://api.tradingnews.press

Authentication

All requests require an API key via the X-API-Key header:
curl -H "X-API-Key: YOUR_KEY" https://api.tradingnews.press/v1/news
API keys are created in the TradingNews Dashboard after subscribing.

Plans

PlanPriceREST Rate LimitWebSocket
Starter$20/mo1 req/minNo
Pro$50/mo30 req/minYes (1 connection)

REST API

GET /v1/news — List articles

curl -H "X-API-Key: YOUR_KEY" \
  "https://api.tradingnews.press/v1/news?limit=5&urgency=breaking"
Query parameters:
  • limit (int, 1-100, default 50) — number of articles
  • urgency (string, optional) — filter: breaking, flash, or regular
  • since (ISO datetime, optional) — articles after this time (Starter: 24h max, Pro: 7 days max)
Response:
{
  "count": 2,
  "articles": [
    {
      "id": "01KNKV33C9DDADR1HRRWGCSA8V",
      "content": "Fed holds rates steady at 4.25-4.50%, signals patience on cuts",
      "urgency": "breaking",
      "sentiment": null,
      "published_at": "2026-04-07T14:30:00+00:00",
      "received_at": "2026-04-07T14:30:02+00:00"
    }
  ]
}
Article fields:
FieldTypeDescription
idstringUnique ULID, sortable by time
contentstringArticle text
urgencystringbreaking, flash, or regular
sentimentstring?Sentiment label (when available)
published_atstringISO 8601 publication time
received_atstringISO 8601 time API received it

GET /v1/news/ — Single article

curl -H "X-API-Key: YOUR_KEY" \
  "https://api.tradingnews.press/v1/news/01KNKV33C9DDADR1HRRWGCSA8V"
Returns 404 if not found (no charge for 404s).

GET /v1/account/usage — Check your plan

curl -H "X-API-Key: YOUR_KEY" \
  "https://api.tradingnews.press/v1/account/usage"
Response:
{
  "tier": "pro",
  "rate_limit": 30,
  "period_end": "2026-05-07T00:00:00+00:00"
}
This endpoint is free (does not count toward rate limit).

WebSocket Streaming (Pro only)

Connect for real-time push delivery of all articles as they arrive:
wss://api.tradingnews.press/v1/stream?api_key=YOUR_KEY
  • No subscription message needed — connect and receive (firehose)
  • Pro plan required — Starter keys get rejected (code 1008)
  • 1 connection per user — second connection is rejected
  • Articles arrive as JSON, same format as REST

Python example

import asyncio
import json
import websockets

async def stream():
    uri = "wss://api.tradingnews.press/v1/stream?api_key=YOUR_KEY"
    async with websockets.connect(uri) as ws:
        async for message in ws:
            article = json.loads(message)
            if article["urgency"] == "breaking":
                print(f"BREAKING: {article['content']}")

asyncio.run(stream())

Reconnection pattern

async def stream_with_reconnect():
    backoff = 1
    while True:
        try:
            async with websockets.connect(uri) as ws:
                backoff = 1
                async for msg in ws:
                    process(json.loads(msg))
        except websockets.ConnectionClosed:
            await asyncio.sleep(backoff)
            backoff = min(backoff * 2, 60)

Error Handling

StatusMeaningAction
401Invalid or missing API keyCheck X-API-Key header
403Subscription expired or inactive keyRenew subscription
404Article not foundNormal — no charge
429Rate limit exceededWait and retry

Python Integration Example

import httpx

client = httpx.Client(
    base_url="https://api.tradingnews.press",
    headers={"X-API-Key": "YOUR_KEY"},
)

# Get latest breaking news
response = client.get("/v1/news", params={"urgency": "breaking", "limit": 10})
articles = response.json()["articles"]

for article in articles:
    print(f"[{article['urgency']}] {article['content']}")

Node.js Integration Example

const response = await fetch("https://api.tradingnews.press/v1/news?limit=10", {
  headers: { "X-API-Key": "YOUR_KEY" },
});
const { articles } = await response.json();

articles.forEach((a) => {
  console.log(`[${a.urgency}] ${a.content}`);
});

Common Patterns

Poll for new articles (Starter)

import time
last_seen = None

while True:
    params = {"limit": 10}
    if last_seen:
        params["since"] = last_seen
    
    resp = client.get("/v1/news", params=params)
    articles = resp.json()["articles"]
    
    for article in articles:
        process(article)
        last_seen = article["received_at"]
    
    time.sleep(60)  # 1 req/min for Starter

News-driven trading signal

async for msg in ws:
    article = json.loads(msg)
    if article["urgency"] == "breaking":
        # Execute trade logic based on content
        execute_order(signal_from_content(article["content"]))

Docs & Support