Live Markets & World Data
Beyond news and economic releases, xnews reads current prices, prediction markets, world datasets, and live alert feeds. Each uses the shape that fits it:
| Shape | API | Used for |
|---|---|---|
| Current state | Plain fetch… functions | Quotes, bars, prediction markets, camera directories, territory geometry |
| Data | DataSource + fetchDataRelease / createDataReleaseWatcher | Dated datasets: macro, climate, power, cyber, attention, health, humanitarian, federal money |
| Events | EventSource + fetchEventSnapshot / fetchEventsAcross / createEventWatcher | Sets of things in force right now: warnings, storms, outages, observations |
| News | Feed providers ofac and who-outbreaks | Sanctions actions and outbreak notices, filtered by subject (Topic Feeds) |
Prices and prediction markets
import {
YAHOO_FUTURES_SYMBOLS,
fetchKalshiMarkets,
fetchManifoldMarkets,
fetchPolymarketMarkets,
fetchYahooBars,
fetchYahooQuote,
} from "@xbbg/xnews";
const oil = await fetchYahooQuote("CL=F");
console.log(oil?.price, oil?.changePercent, oil?.marketTime);
const vix = await fetchYahooBars("^VIX", { interval: "1d", range: "1mo" });
console.log(vix.at(-1)?.close);
console.log(Object.keys(YAHOO_FUTURES_SYMBOLS)); // CL=F, BZ=F, NG=F, GC=F, ..., ^VIX, DX-Y.NYB, ^TNX
const [kalshi, polymarket, manifold] = await Promise.all([
fetchKalshiMarkets({ limit: 25 }),
fetchPolymarketMarkets({ limit: 25 }),
fetchManifoldMarkets({ limit: 25 }),
]);
for (const market of [...kalshi, ...polymarket, ...manifold].slice(0, 10)) {
console.log(market.venue, (market.probability * 100).toFixed(1), market.question);
}fetchYahooQuoteandfetchYahooBarsuse Yahoo's keyless chart API and fail over fromquery1toquery2.intervalandrangetake Yahoo's values ("1m"through"3mo", and"1d"through"max").YAHOO_FUTURES_SYMBOLSmaps common futures, volatility, dollar-index, and Treasury-yield symbols to descriptions.- Kalshi, Polymarket, and Manifold normalize to one
PredictionMarketQuoteshape with the YESprobabilityin0–1, plusvenue,question,url, and optionalvolume,liquidity,closesAt, andcategory. Kalshi prices are decimal dollar strings divided by contract notional, not the obsolete integer-cent scale.
World datasets on the data lane
These sources plug into the same data lane as FRED and COT (Economic Data Releases). Each factory has a standalone fetch… counterpart that returns the rows directly.
| Domain | Factory | provider | Data |
|---|---|---|---|
| Federal money | usaSpendingDataSource() | usaspending | Federal contract awards |
| Federal money | grantsGovDataSource() | grants-gov | Open grant opportunities (keyword filter) |
| Macro | worldBankIndicatorDataSource({ indicator }) | world-bank-indicators | inflation, unemployment, gdp-growth, extreme-poverty, or any raw indicator code |
| Climate | noaaOniDataSource() | noaa-oni | ENSO Oceanic Niño Index |
| Climate | droughtMonitorDataSource() | us-drought-monitor | US drought coverage by area |
| Climate | noaaCo2DataSource() | noaa-co2 | Global atmospheric CO₂ trend |
| Climate | nasaGistempDataSource() | nasa-gistemp | Global temperature anomaly |
| Power | carbonIntensityDataSource() | uk-carbon-intensity | GB carbon intensity and generation mix |
| Power | caisoFuelMixDataSource() | caiso-fuel-mix | CAISO five-minute fuel mix |
| Cyber | cisaKevDataSource() | cisa-kev | CISA known-exploited vulnerabilities |
| Cyber | iodaDataSource() | ioda-outages | Country-level internet outages |
| Cyber | ooniDataSource() | ooni-censorship | Censorship measurement anomalies |
| Attention | wikipediaPageviewsDataSource() | wikipedia-pageviews | Daily most-viewed articles |
| Attention | wikipediaCongressEditsDataSource() | wikipedia-congress-edits | Historical edits from House and Senate networks |
| Public health | cdcWastewaterDataSource() | cdc-wastewater | CDC wastewater viral activity |
| Humanitarian | unhcrDataSource() | unhcr-displacement | Forced displacement statistics |
| Humanitarian | hungerMapDataSource({ apiKey }) | wfp-hungermap | WFP food-security estimates (key required) |
import { fetchDataRelease, hungerMapDataSource, worldBankIndicatorDataSource } from "@xbbg/xnews";
const inflation = await fetchDataRelease(worldBankIndicatorDataSource({ indicator: "inflation" }));
const sovereigns = inflation.release?.rows.filter((row) => !row.isAggregate) ?? [];
console.log(inflation.release?.asOf, sovereigns.length);
// WFP withdrew anonymous access: without a key the source is disabled before any request.
const food = await fetchDataRelease(hungerMapDataSource({ apiKey: process.env.WFP_HUNGERMAP_API_KEY ?? "" }));
console.log(food.status); // "disabled" when the key is blankNotes from the implementation:
- World Bank
country/allresults flag regional and income aggregates withisAggregate, so they are never silently mixed into country-level analysis. - Wikimedia pageviews default to the most recent published day, because the previous day's ranking is often unavailable for the first hours of a UTC day.
wikipediaCongressEditsDataSourcereads a historical archive: 13,269 English Wikipedia edits from 2003-11-10 through 2014-07-07, classified as House or Senate from the archive's own address ranges.- CDC wastewater (and CFTC COT) use Socrata. Pass
appTokenfor sustained polling.
Active events
DataRelease keys on a date, which cannot model a warning set that changes continuously. An EventSource returns an EventSnapshot (the full set of events in force), and the event watcher yields when new event ids appear.
import {
createEventWatcher,
fetchEventsAcross,
gdacsSource,
nwsAlertsSource,
usgsVolcanoesSource,
} from "@xbbg/xnews";
const { events, results } = await fetchEventsAcross(
[nwsAlertsSource(), gdacsSource(), usgsVolcanoesSource()],
{ minSeverity: "severe" },
);
console.log(events.length, results.map((result) => `${result.provider}:${result.status}`));
for await (const result of createEventWatcher(nwsAlertsSource(), {
minSeverity: "severe",
intervalMs: 5 * 60_000,
})) {
if (result.status === "error" || result.status === "disabled") {
console.warn(result.warnings);
continue;
}
for (const event of result.addedEvents) console.log(event.severity, event.title, event.areaName);
}| Factory | provider | dataset | In force |
|---|---|---|---|
nwsAlertsSource() | nws-alerts | active-alerts | US weather, flood, and civil alerts |
nhcStormsSource() | nhc-storms | current-storms | Active tropical cyclones and advisories |
gdacsSource() | gdacs | event-list | Global earthquakes, floods, storms, droughts, fires, volcanoes |
usgsVolcanoesSource() | usgs-volcanoes | elevated-volcanoes | Elevated USGS volcanoes with Smithsonian coordinates |
noaaTsunamiSource() | noaa-tsunami | warning-center-messages | National/Alaska and Pacific tsunami-center messages |
glofasFloodSource() | glofas-flood | major-basin-outlook | 31-day discharge outlook for 22 major river basins |
gdeltEventsSource() | gdelt-events | gdelt-v2-events | Latest geocoded GDELT v2 event slice |
faaStatusSource() | faa-status | airport-status | Ground stops, closures, and airport delays |
safecastSource() | safecast-radiation | measurements | Recent geolocated radiation measurements |
sondeHubSource() | sondehub-balloons | telemetry | Latest telemetry per active radiosonde |
wikipediaCongressRecentChangesSource() | wikipedia-congress-edits | recent-public-changes | New Wikipedia edits with Congress attribution or relevance signals |
How the events lane behaves:
- Records. Each
EventRecordhas a provider-stableid,category(hazard,weather,seismic,flood,conflict,outage,aviation,radiation,atmospheric, orunknown),title,severity, and optionalsummary,url,observedAt,startsAt/endsAt,magnitudewithmagnitudeUnit,countryCode,areaName, and the publisher's owneventType. Coordinates are both-or-neither:latitudeandlongitudeare present together or not at all. - Severity.
extreme,severe,moderate,minor, orunknown, mapped from each publisher's own scale.unknownmeans the publisher stated nothing recognized; it is never downgraded tominor, and aminSeverityfilter excludes it. GloFAS severity is an xnews-derived forecast-to-baseline ratio, and Safecast readings stayunknownbecause counts per minute depend on the device. - Filters.
minSeverityandcountryCodes(ISO 3166-1 alpha-2) apply to every source identically. GDELT's FIPS country codes are converted to ISO codes or omitted. - Watcher.
createEventWatcherpolls everyintervalMs(default 5 minutes). Each result keeps the full current state inevents/snapshotand puts only newly seen ids inaddedEvents. Remembered ids are bounded bymaxSeenIds(default 10,000, oldest evicted first), andseenIdsrestores them after a restart. Like the data watcher, failures are yielded (once per distinct failure), not thrown. - Merging.
fetchEventsAcrossreturns every source's envelope plus the merged events sorted most urgent first, then most recently observed.sortEvents,filterEvents, andmeetsSeverityare exported for your own snapshots.
Congress-related Wikipedia edits
wikipediaCongressRecentChangesSource() and fetchWikipediaCongressRecentChanges() read Wikipedia's public RecentChanges API. Each row keeps two claims apart: attribution.kind === "congress-network" only when the editor's publicly shown IP falls in a House or Senate range, and relevanceSignals only when the page title or edit comment is Congress-related. Edits by registered or temporary accounts can be relevant but stay unattributed. The source does not use privileged IP-reveal tools, so content or timing analysis never becomes an origin claim.
Geospatial directories
import { fetchDeepStateMapFrontline, fetchTrafficCameras } from "@xbbg/xnews";
const cameras = await fetchTrafficCameras(["nyc", "tfl"]);
console.log(cameras.cameras.length, cameras.errors);
const frontline = await fetchDeepStateMapFrontline();
console.log(frontline.createdAt, frontline.features.length);fetchTrafficCameras fans out over the NYC, London TfL, Delaware, and New Zealand camera directories (all four by default); one network failing lands in errors without discarding the others. fetchDeepStateMapFrontline keeps territorial-control polygons as geometry instead of collapsing them to centroids.
Related
- Economic Data Releases: the data lane in depth and custom sources.
- Source Catalog: every data and event source in one table.
- Data Model:
EventRecord,EventSnapshot, and result envelopes.
