วิธีติดตามข่าวสารตลาดสินค้าโภคภัณฑ์ด้วย API (น้ำมันดิบ โลหะ ก๊าซ และปุ๋ย)

Tasha Tatum

Tasha Tatum

·

18 นาที อ่านต่อ

How to Track Commodities Market News with an API (Crude Oil, Metals, Gas & Fertilizers)

If you trade or analyze commodities, your problem with news was never supply. It's that a general feed gives you everything at once. Search "oil" and you get an energy-policy explainer, yesterday's pump prices, and the one Brent story that actually matters, all in the same response and in no useful order.

What a desk actually wants is narrower: crude oil on its own, LNG on its own, potash on its own. That's a filtering problem, and it's the one this guide solves. APITube tags every article with a topic ID, so instead of guessing keywords you ask for a category. Commodities sit under two of them, an industry side (mining, refining, freight) and a market side (the traded price of crude, metals, fertilizers). Most of what follows is about telling those two apart and querying them; the full list of IDs is at the end for reference.

It's written for people who watch a commodity or two for a living: trading desks, energy and oil-and-gas analysts, procurement teams hedging input costs, ESG researchers following the transition. (Disclosure: the examples use APITube, which also hosts this blog. The approach works the same with any news API that classifies by topic.)

Key takeaways:

  • There are two commodity taxonomies, not one: industry.commodities.* for the supply side and market_news.commodities.* for prices. Knowing which you want does most of the filtering for you.
  • A query is just a topic.id and a language. "Latest crude oil market news in English" is one request, with no keyword lists to maintain.
  • Adding sentiment.overall.polarity is a cheap way to float supply shocks to the top and let routine coverage settle out.
  • Watching several commodities at once is a ~30-line loop over a list of topic IDs plus a set to drop duplicates.
  • The taxonomy runs to about 50 topics across energy, metals, chemicals and fertilizers, all listed at the bottom.

Why a general news feed isn't enough

Run a commodities watch off a general endpoint and the failure mode is always volume. "Oil" pulls in policy pieces, retail fuel prices, the odd oil-painting auction, and somewhere in there the futures move you needed. Keyword filters don't rescue you: title=oil can't tell crude from heating oil, and it quietly drops any story that ran under a benchmark name you didn't think to type.

There's a subtler problem underneath that. A refinery fire and the crude spike it causes are two different stories for two different readers, one operational and one about the market. A keyword feed hands them to you in the same flat list. A topic taxonomy doesn't, because it has already sorted them.

Industry topics vs market topics

Commodities live under two prefixes in APITube, and the split is worth understanding before you query anything.

industry.commodities.* is the supply side: producing and moving the physical stuff. Mining, oil refining and distribution, petrochemical plants, freight. Outages and capacity changes surface here.

market_news.commodities.* is the price side: the traded market itself. Crude oil, base metals, LNG, fertilizers, carbon. Benchmark moves and supply-demand balances live here.

Back to the refinery. The fire is industry.commodities.oil_refining_and_distribution. The crude move the next morning is market_news.commodities.crude_oil. A trader cares about the second, an operations or credit analyst about the first, and anyone who wants cause and effect subscribes to both.

You want…Topic familyExample topic.id
Price and benchmark movesmarket_news.commodities.*market_news.commodities.crude_oil
Refinery and plant operationsindustry.commodities.*industry.commodities.oil_refining_and_distribution
Mining supply disruptionsindustry.commodities.*industry.commodities.mining
Fertilizer pricingmarket_news.commodities.*market_news.commodities.fertilizers

Filtering commodities news with the API

Every request goes to GET https://api.apitube.io/v1/news/everything with your key in the X-API-Key header. The only commodity-specific part is topic.id.

Latest crude oil market news

import requests

r = requests.get(
    "https://api.apitube.io/v1/news/everything",
    params={
        "topic.id": "market_news.commodities.crude_oil",
        "language.code": "en",
        "sort": "published_at:desc",
        "per_page": 20,
    },
    headers={"X-API-Key": APITUBE_KEY},
    timeout=10,
)
r.raise_for_status()
for a in r.json().get("results", []):
    print(a["published_at"], a["title"])
    print("  source:", a["source"]["domain"], "→", a["href"])

One topic, one language, newest first. Change crude_oil to natural_gas, base_metals, or any ID from the table at the end, and the feed repoints.

Filter by sentiment to surface disruptions

Supply shocks usually read negative; routine coverage reads neutral. So a polarity filter on top of the topic is a quick way to skim off the headlines most likely to move a price:

params = {
    "topic.id": "market_news.commodities.natural_gas",
    "language.code": "en",
    "sentiment.overall.polarity": "negative",
    "sort": "published_at:desc",
    "per_page": 20,
}

Every article also carries its sentiment.overall score in the response, so if you'd rather keep both directions you can pull the lot and apply your own cutoff in code.

Watch several commodities at once

In practice nobody watches a single commodity. Put the topic IDs you care about in a list, mix industry and market freely, loop over them, and drop duplicate URLs as you go:

import requests

WATCHLIST = [
    "market_news.commodities.crude_oil",
    "market_news.commodities.liquefied_natural_gas",
    "market_news.commodities.base_metals",
    "market_news.commodities.fertilizers",
    "industry.commodities.upstream_oil_and_gas",
]

def fetch(topic_id):
    r = requests.get(
        "https://api.apitube.io/v1/news/everything",
        params={"topic.id": topic_id, "language.code": "en",
                "sort": "published_at:desc", "per_page": 25},
        headers={"X-API-Key": APITUBE_KEY}, timeout=10,
    )
    r.raise_for_status()
    return r.json().get("results", [])

seen = set()
for topic in WATCHLIST:
    label = topic.split(".")[-1]
    for a in fetch(topic):
        if a["href"] in seen:
            continue
        seen.add(a["href"])
        s = a.get("sentiment", {}).get("overall", {})
        print(f"[{label}] {a['published_at']} {a['title']}")
        print(f"   {s.get('polarity')} ({s.get('score')}) — {a['href']}")

Put that on a cron, push anything new to Slack or a dashboard, and you have a commodity newswire without paying for a terminal. The seen set earns its keep here: a single wire story shows up under a dozen syndicated domains, and without dedupe you'd alert on each one.

Worked scenarios

Trading desk

A crude-and-products desk pulls market_news.commodities.crude_oil, crude_oil_products, road_fuels and jet_fuel for the price side, then adds industry.commodities.oil_refining_and_distribution so a refinery outage shows up before it lands on the screen as a price move. The polarity filter does the triage for you: "OPEC+ holds quotas" is routine, "pipeline shut after blast" is not.

Procurement and supply-chain risk

A manufacturer exposed to input costs follows market_news.commodities.base_metals, steel and fertilizers on the price side, plus industry.commodities.mining and freight on the supply side. They're not trading on any of it. They just want a few days' warning before a price move turns up on the next purchase order.

ESG and carbon

A sustainability team tracks market_news.commodities.carbon_markets, hydrogen, battery_materials and sustainable_and_specialty_fertilizers to follow the energy transition. The entity and source-bias data attached to each article helps them weight who is saying what.

Reference: commodities topic IDs

Pass any of these as the topic.id parameter. Industry topics cover the supply and operational side; market-news topics cover the price and market side.

Industry news topics

รหัสหัวข้อชื่อหัวข้อ
industry.commodities.biofuels_productionข่าวอุตสาหกรรมการผลิตเชื้อเพลิงชีวภาพ
industry.commodities.freightข่าวอุตสาหกรรมขนส่งสินค้า
industry.commodities.industrial_manufacturingข่าวอุตสาหกรรมอุตสาหกรรมการผลิต
industry.commodities.metallurgy_newsข่าวอุตสาหกรรมโลหะ
industry.commodities.miningข่าวอุตสาหกรรมเหมืองแร่
industry.commodities.natural_gas_and_power_distributionข่าวอุตสาหกรรมจำหน่ายก๊าซธรรมชาติและพลังงาน
industry.commodities.oil_refining_and_distributionการกลั่นน้ำมันและการกระจายข่าวอุตสาหกรรม
industry.commodities.petrochemicalsข่าวอุตสาหกรรมปิโตรเคมี
industry.commodities.upstream_oil_and_gasน้ำมันต้นน้ำและก๊าซข่าวอุตสาหกรรม

Commodities market news topics

รหัสหัวข้อชื่อหัวข้อ
market_news.commodities.ammoniaข่าวตลาดแอมโมเนีย
market_news.commodities.aromatics_marketข่าวตลาดอะโรเมติกส์
market_news.commodities.base_metalsข่าวตลาดโลหะพื้นฐาน
market_news.commodities.base_oils_and_waxesน้ำมันพื้นฐานและแว็กซ์ข่าวการตลาด
market_news.commodities.battery_materialsข่าวการตลาดวัสดุแบตเตอรี่
market_news.commodities.biofuels_and_feedstocksเชื้อเพลิงชีวภาพและวัตถุดิบข่าวตลาด
market_news.commodities.bitumen_and_asphaltข่าวตลาดน้ำมันดินและยางมะตอย
market_news.commodities.carbon_marketsข่าวตลาดคาร์บอน
market_news.commodities.chemicalsข่าวสารตลาดสารเคมี
market_news.commodities.chlor_alkaliข่าวตลาดคลอร์อัลคาไล
market_news.commodities.coalข่าวตลาดถ่านหิน
market_news.commodities.crude_oilข่าวตลาดน้ำมันดิบ
market_news.commodities.crude_oil_productsข่าวตลาดผลิตภัณฑ์น้ำมันดิบ
market_news.commodities.electric_powerข่าวตลาดพลังงานไฟฟ้า
market_news.commodities.fertilizersข่าวตลาดปุ๋ย
market_news.commodities.gas_and_powerข่าวตลาดก๊าซและพลังงาน
market_news.commodities.heavy_olefinsข่าวการตลาดโอเลฟินส์หนัก
market_news.commodities.hydrogenข่าวตลาดไฮโดรเจน
market_news.commodities.jet_fuelข่าวตลาดน้ำมันเชื้อเพลิงเจ็ท
market_news.commodities.light_olefinsข่าวตลาดโอเลฟินแสง
market_news.commodities.liquefied_natural_gasข่าวตลาดก๊าซธรรมชาติเหลว
market_news.commodities.liquefied_petroleum_gasข่าวตลาดก๊าซปิโตรเลียมเหลว
market_news.commodities.marine_fuelsข่าวตลาดเชื้อเพลิงทางทะเล
market_news.commodities.metalsข่าวตลาดโลหะ
market_news.commodities.methanolข่าวตลาดเมทานอล
market_news.commodities.natural_gasข่าวตลาดก๊าซธรรมชาติ
market_news.commodities.nitrogenข่าวตลาดไนโตรเจน
market_news.commodities.npk_fertilizersข่าวตลาดปุ๋ยเอ็นพีเค
market_news.commodities.octane_blendingข่าวตลาดผสมออกเทน
market_news.commodities.oleochemicalsข่าวการตลาด
market_news.commodities.phosphatesข่าวตลาดฟอสเฟต
market_news.commodities.pipe_and_tubeข่าวการตลาดท่อและหลอด
market_news.commodities.polymersข่าวตลาดโพลีเมอร์
market_news.commodities.polyurethanesข่าวตลาดยูรีเทน
market_news.commodities.potashข่าวตลาดโปแตช
market_news.commodities.rare_earthsข่าวตลาดโลกที่หายาก
market_news.commodities.road_fuelsข่าวตลาดเชื้อเพลิงถนน
market_news.commodities.scrapข่าวตลาดเศษ
market_news.commodities.specialty_and_minor_metalsข่าวการตลาดโลหะพิเศษและรอง
market_news.commodities.steelข่าวตลาดเหล็ก
market_news.commodities.steel_raw_materialsข่าวการตลาดวัตถุดิบเหล็ก
market_news.commodities.sulphur_and_sulphuric_acidข่าวสารตลาดกำมะถันและกรดซัลฟิวริก
market_news.commodities.sustainable_and_specialty_fertilizersข่าวการตลาดปุ๋ยที่ยั่งยืนและพิเศษ

Frequently Asked Questions

What is a commodities market news API?

A commodities market news API classifies each article by the commodity it covers and lets you request that category directly, so you can ask for "crude oil news" or "fertilizer news" instead of keyword-searching a general feed. In APITube the categories are topic IDs in two families: industry.commodities.* for supply-side coverage and market_news.commodities.* for prices. You query them with GET /v1/news/everything?topic.id=....

How do I filter news by commodity?

Pass a topic.id to the everything endpoint, for example topic.id=market_news.commodities.crude_oil for crude prices or topic.id=industry.commodities.mining for mining operations. Add language.code to pick a language and sort=published_at:desc for newest first. To follow several commodities, loop over a list of topic IDs and dedupe the results by article URL.

What is the difference between industry and market-news commodity topics?

industry.commodities.* covers the supply side: producing and moving a commodity (mining, refining, freight, petrochemical manufacturing). market_news.commodities.* covers the price side: the traded market for crude oil, metals, LNG, fertilizers, and so on. A refinery outage is an industry topic; the crude price move that follows is a market-news topic. If you want both the cause and the effect, subscribe to both.

Which commodities does the API cover?

Energy (crude oil and products, natural gas, LNG, LPG, coal, jet and marine fuels, power), metals (base metals, steel and steel raw materials, rare earths, scrap, specialty and minor metals), chemicals (ammonia, methanol, polymers, chlor-alkali, olefins, aromatics), and agriculture and fertilizers (nitrogen, phosphates, potash, NPK and specialty blends), plus carbon markets, hydrogen, and battery materials. The full list of IDs is in the table above.

How fresh is the data?

APITube serves news in real time over REST, so a poller on a short interval picks up stories close to when sources publish them. The free tier allows 30 requests every 30 minutes, enough for a small watchlist on a few-minute cron; paid tiers raise the limit for tighter polling or longer lists.


Reference: APITube News API docs. The topic IDs above are passed to the topic.id parameter of the /v1/news/everything endpoint.

APITube - News API

บทความที่เกี่ยวข้อง

Best Financial News API for Trading 2026: 5 Compared
Insights

Best Financial News API for Trading 2026: 5 Compared

Five financial news APIs scored on latency, ticker-tagging, sentiment, backtesting archive, and trading-event feeds. 2026 fintech-focused comparison.

NewsAPI.org Alternative 2026: Why Devs Pick APITube
Insights

NewsAPI.org Alternative 2026: Why Devs Pick APITube

NewsAPI.org alternative for 2026 — TOS quote, real migration code, 12-month TCO, and when NewsAPI is still fine. APITube vs NewsAPI.org, straight.

วิธีปรับขนาดแอปข่าวให้รองรับผู้ใช้หลายล้านคน (คู่มือสถาปัตยกรรมปี 2026)
Insights

วิธีปรับขนาดแอปข่าวให้รองรับผู้ใช้หลายล้านคน (คู่มือสถาปัตยกรรมปี 2026)

Spike-driven traffic, freshness vs cache trade-offs, autoscaling thresholds that actually fit news workloads, a TTL matrix, build-vs-buy cost math from 100K to 100M MAU, and a reference stack. With working ingestion code.

Telegram News Bot ใน Python (2026): aiogram APScheduler
Developer Guides

Telegram News Bot ใน Python (2026): aiogram APScheduler

สร้าง Telegram news bot ด้วย Python โดยใช้ aiogram 3.27, APScheduler และ APITube แบบอะซิงโครนัส กรองตามความรู้สึก โพสต์อัตโนมัติลงช่อง — โค้ดเต็ม Docker

เราใช้คุกกี้

โดยการคลิก"ยอมรับ"คุณตกลงที่จะจัดเก็บคุกกี้บนอุปกรณ์ของคุณสำหรับการทำงานและการวิ