Skip to content

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:

ShapeAPIUsed for
Current statePlain fetch… functionsQuotes, bars, prediction markets, camera directories, territory geometry
DataDataSource + fetchDataRelease / createDataReleaseWatcherDated datasets: macro, climate, power, cyber, attention, health, humanitarian, federal money
EventsEventSource + fetchEventSnapshot / fetchEventsAcross / createEventWatcherSets of things in force right now: warnings, storms, outages, observations
NewsFeed providers ofac and who-outbreaksSanctions actions and outbreak notices, filtered by subject (Topic Feeds)

Prices and prediction markets ​

ts
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);
}
  • fetchYahooQuote and fetchYahooBars use Yahoo's keyless chart API and fail over from query1 to query2. interval and range take Yahoo's values ("1m" through "3mo", and "1d" through "max"). YAHOO_FUTURES_SYMBOLS maps common futures, volatility, dollar-index, and Treasury-yield symbols to descriptions.
  • Kalshi, Polymarket, and Manifold normalize to one PredictionMarketQuote shape with the YES probability in 0–1, plus venue, question, url, and optional volume, liquidity, closesAt, and category. 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.

DomainFactoryproviderData
Federal moneyusaSpendingDataSource()usaspendingFederal contract awards
Federal moneygrantsGovDataSource()grants-govOpen grant opportunities (keyword filter)
MacroworldBankIndicatorDataSource({ indicator })world-bank-indicatorsinflation, unemployment, gdp-growth, extreme-poverty, or any raw indicator code
ClimatenoaaOniDataSource()noaa-oniENSO Oceanic Niño Index
ClimatedroughtMonitorDataSource()us-drought-monitorUS drought coverage by area
ClimatenoaaCo2DataSource()noaa-co2Global atmospheric CO₂ trend
ClimatenasaGistempDataSource()nasa-gistempGlobal temperature anomaly
PowercarbonIntensityDataSource()uk-carbon-intensityGB carbon intensity and generation mix
PowercaisoFuelMixDataSource()caiso-fuel-mixCAISO five-minute fuel mix
CybercisaKevDataSource()cisa-kevCISA known-exploited vulnerabilities
CyberiodaDataSource()ioda-outagesCountry-level internet outages
CyberooniDataSource()ooni-censorshipCensorship measurement anomalies
AttentionwikipediaPageviewsDataSource()wikipedia-pageviewsDaily most-viewed articles
AttentionwikipediaCongressEditsDataSource()wikipedia-congress-editsHistorical edits from House and Senate networks
Public healthcdcWastewaterDataSource()cdc-wastewaterCDC wastewater viral activity
HumanitarianunhcrDataSource()unhcr-displacementForced displacement statistics
HumanitarianhungerMapDataSource({ apiKey })wfp-hungermapWFP food-security estimates (key required)
ts
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 blank

Notes from the implementation:

  • World Bank country/all results flag regional and income aggregates with isAggregate, 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.
  • wikipediaCongressEditsDataSource reads 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 appToken for 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.

ts
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);
}
FactoryproviderdatasetIn force
nwsAlertsSource()nws-alertsactive-alertsUS weather, flood, and civil alerts
nhcStormsSource()nhc-stormscurrent-stormsActive tropical cyclones and advisories
gdacsSource()gdacsevent-listGlobal earthquakes, floods, storms, droughts, fires, volcanoes
usgsVolcanoesSource()usgs-volcanoeselevated-volcanoesElevated USGS volcanoes with Smithsonian coordinates
noaaTsunamiSource()noaa-tsunamiwarning-center-messagesNational/Alaska and Pacific tsunami-center messages
glofasFloodSource()glofas-floodmajor-basin-outlook31-day discharge outlook for 22 major river basins
gdeltEventsSource()gdelt-eventsgdelt-v2-eventsLatest geocoded GDELT v2 event slice
faaStatusSource()faa-statusairport-statusGround stops, closures, and airport delays
safecastSource()safecast-radiationmeasurementsRecent geolocated radiation measurements
sondeHubSource()sondehub-balloonstelemetryLatest telemetry per active radiosonde
wikipediaCongressRecentChangesSource()wikipedia-congress-editsrecent-public-changesNew Wikipedia edits with Congress attribution or relevance signals

How the events lane behaves:

  • Records. Each EventRecord has a provider-stable id, category (hazard, weather, seismic, flood, conflict, outage, aviation, radiation, atmospheric, or unknown), title, severity, and optional summary, url, observedAt, startsAt/endsAt, magnitude with magnitudeUnit, countryCode, areaName, and the publisher's own eventType. Coordinates are both-or-neither: latitude and longitude are present together or not at all.
  • Severity. extreme, severe, moderate, minor, or unknown, mapped from each publisher's own scale. unknown means the publisher stated nothing recognized; it is never downgraded to minor, and a minSeverity filter excludes it. GloFAS severity is an xnews-derived forecast-to-baseline ratio, and Safecast readings stay unknown because counts per minute depend on the device.
  • Filters. minSeverity and countryCodes (ISO 3166-1 alpha-2) apply to every source identically. GDELT's FIPS country codes are converted to ISO codes or omitted.
  • Watcher. createEventWatcher polls every intervalMs (default 5 minutes). Each result keeps the full current state in events/snapshot and puts only newly seen ids in addedEvents. Remembered ids are bounded by maxSeenIds (default 10,000, oldest evicted first), and seenIds restores them after a restart. Like the data watcher, failures are yielded (once per distinct failure), not thrown.
  • Merging. fetchEventsAcross returns every source's envelope plus the merged events sorted most urgent first, then most recently observed. sortEvents, filterEvents, and meetsSeverity are exported for your own snapshots.

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 ​

ts
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.

xbbg is independent open-source software and is not affiliated with, endorsed by, sponsored by, or approved by Bloomberg Finance L.P.