Dow Jones Utility Average (DJU) Price Change API
To chart the Dow Jones Utility Average or alert on a move, you need a DJU quote and a reliable way to compare it with an earlier observation. This guide shows how to fetch the latest quote, read the USD-denominated index value, and calculate a change without mistaking the inverse rate for the price.
Request the latest DJU value
Indices-API identifies the Dow Jones Utility Average as DJU in the supplied response. Check Symbols for the current symbol listing before configuring your integration.
The latest endpoint returns a JSON response authenticated with the access_key query parameter. Replace YOUR_API_KEY with your key and run:
curl "https://indices-api.com/api/latest?access_key=YOUR_API_KEY"
The request retrieves the latest response; the application selects DJU from its rates object. For the current endpoint details and account-specific availability, see Documentation.
Read the response and quote direction
The following is the supplied API response. A live request will return the values available at the time of that request.
{"data":{"success":true,"timestamp":1795999260,"date":"2026-11-30","base":"USD","rates":{"DJU":0.00089653935807782,"USD":1,"USDDJU":1115.3999999999994}}}
The response has an outer data object, so code should read data.rates.USDDJU rather than looking for rates at the top level. The fields relevant to a DJU integration are:
successindicates whether the request succeeded. Check it before processing rates.baseisUSDin this response. Keep the base with stored observations so rates from different bases are not compared inadvertently.rates.USDDJUis the USD-denominated DJU value in this response. Use it when your chart or alert is intended to follow the index value.rates.DJUis the reciprocal-direction rate relative to the USD base. It is approximately the reciprocal ofrates.USDDJU, not the same quote.dateis the response’s date label.timestampis a Unix timestamp in seconds; retain it to identify and order observations.
The distinction between the two DJU fields matters for price changes. When a positive index value rises, its reciprocal falls. A percentage change calculated from rates.DJU therefore describes a move in the inverse quote, not the percentage move of rates.USDDJU.
Treat the returned value as an index quote, not an executable trade price. If you display it alongside a tradable instrument, label the source and the quote clearly rather than assuming the two prices are interchangeable.
Calculate a change from successive observations
The Python example below calls the same latest endpoint and saves the last accepted observation locally. On a subsequent run, it calculates the absolute and percentage change in USDDJU. Set the INDICES_API_KEY environment variable before running it.
import json
import os
from datetime import datetime, timezone
from decimal import Decimal
from pathlib import Path
from urllib.parse import urlencode
from urllib.request import urlopen
api_key = os.environ["INDICES_API_KEY"]
url = "https://indices-api.com/api/latest?" + urlencode({
"access_key": api_key
})
state_path = Path("dju_last.json")
with urlopen(url, timeout=10) as response:
payload = json.load(response, parse_float=Decimal)
data = payload["data"]
if not data["success"]:
raise RuntimeError("Indices-API did not return a successful result")
if data["base"] != "USD":
raise ValueError("Expected a USD base")
rates = data["rates"]
price = Decimal(str(rates["USDDJU"]))
timestamp = int(data["timestamp"])
date = data["date"]
if price <= 0:
raise ValueError("Expected a positive DJU value")
observed_utc = datetime.fromtimestamp(timestamp, timezone.utc)
print("Source date:", date)
print("Timestamp (UTC):", observed_utc.isoformat())
print("USD/DJU value:", price)
if state_path.exists():
previous = json.loads(state_path.read_text())
previous_timestamp = int(previous["timestamp"])
previous_price = Decimal(previous["price"])
if previous_price <= 0:
raise ValueError("Saved DJU value must be positive")
if timestamp <= previous_timestamp:
print("No newer observation; leaving saved state unchanged.")
raise SystemExit(0)
change = price - previous_price
change_pct = (change / previous_price) * Decimal("100")
print("Change:", change)
print("Change (%):", change_pct)
else:
print("First observation saved; no previous value to compare.")
state_path.write_text(json.dumps({
"timestamp": timestamp,
"date": date,
"price": str(price),
}))
The calculation is current value − previous value for the absolute change, and that difference divided by the previous value, multiplied by 100, for the percentage change. The example uses decimal arithmetic to avoid introducing additional binary floating-point rounding into the calculation.
The saved observation is the previous successful run with a newer timestamp. It is not necessarily the previous trading day’s close: it could be an earlier intraday observation, or an older observation if the job was stopped. Name your dashboard metric accordingly.
For an alert, compare the calculated percentage with a threshold chosen by your product or trading team. Decide whether to alert on upward moves, downward moves, or absolute moves, and record the observation that triggered the alert so repeated reads of the same tick do not produce repeated notifications.
This local-file example is intended for a single process. In a deployed service, store observations and alert state in durable shared storage, handle request and parsing failures, and coordinate concurrent workers. Do not log the full request URL: it contains the API key.
Backfill, trading days, and freshness
For a chart, latest data alone is not a historical series. The time-series endpoint is intended for daily historical rates over a date range; use it to backfill observations, then append or refresh latest data separately. Check the documentation for the request format, available history, date limits, response shape, and any pagination behavior applicable to your plan.
For a change over a specified period, the fluctuation endpoint is the other relevant option. Its documented response format includes start and end rates, an absolute change, and a percentage change. Verify which DJU quote direction those fields represent before labeling the result as an index-price move; if the result uses the reciprocal rate, calculate the index-value change from the corresponding direct values instead.
For date-range requests that use end_date, the end date cannot be today. Use an eligible earlier end date for the historical request and fetch the latest observation separately. Keep the two sources distinguishable until you have checked their dates, quote direction, and overlap.
Markets do not trade continuously. Weekends and market holidays may have no new trading observation, so a calendar-day chart can contain gaps or repeated values depending on the data returned. Do not manufacture a new DJU value for a missing day; decide explicitly whether your chart leaves a gap or visually carries forward the last known value, and label that behavior.
The API’s latest update frequency depends on the subscription plan; the supplied plan information includes 60-minute and 10-minute intervals. Polling more often does not necessarily produce a newer observation. Cache the latest response for an interval appropriate to your plan and display its timestamp so users can judge freshness.
Convert the Unix timestamp to UTC for consistent storage and display, then convert it to a user’s chosen timezone if needed. Keep the API’s date as a separate source field: do not assume its timezone or market-session meaning without checking the documentation. A newer timestamp also should not be assumed to mean a new market close.
For teams connecting tools to their data workflow, the MCP page provides a starting point for that integration. The REST response and quote-direction checks remain important regardless of how the data reaches your application.
FAQ
Which field should I use for a DJU price-change alert?
In the supplied latest response, use data.rates.USDDJU for the USD-denominated index value. Compare it with a previous observation of the same field and base.
Why does the DJU rate move in the opposite direction?
rates.DJU is approximately the reciprocal of rates.USDDJU. A change in that inverse quote is not the same metric as a change in the index value.
Can I use today as the end of a historical range?
No. An end_date cannot be today. Use an earlier eligible date for the range and request the latest value separately.
Does a latest response always represent a new trading-day close?
No. Update frequency depends on the plan, and weekends or holidays may not bring a new trading observation. Check the returned timestamp and date, and verify the session semantics before calling a value a close.
Ready to build the DJU chart or alert? Get a free API key through Register, then run the latest request and save your first observation.