Hang Seng (HSI) Price History API
To chart Hang Seng (HSI) history, you need a series of dated observations that you can interpret consistently and refresh without treating weekends as trading sessions. This guide shows how to retrieve and read the latest HSI quote, then use the time-series endpoint to backfill a chart while preserving the quote direction, dates, and data freshness.
Start with a current HSI observation
The latest endpoint is a useful first integration check: it confirms that your key works and shows the fields your application will need to interpret. The response below uses HSI and USDHSI; check the Symbols page for the current HSI listing and specifications before building a production mapping.
Replace YOUR_API_KEY with your key and run this request:
curl "https://indices-api.com/api/latest?access_key=YOUR_API_KEY"
A response for HSI has the following shape:
{"data":{"success":true,"timestamp":1795567260,"date":"2026-11-25","base":"USD","rates":{"HSI":0.00035291427482731,"USD":1,"USDHSI":2833.549310209471}}}
The outer data object contains the result. Check success before using the values, and handle an unsuccessful response or an unexpected structure as an integration error rather than displaying an empty chart as if it were valid data.
This Python example calls the same endpoint and reads the fields needed for an HSI display. Set the INDICES_API_KEY environment variable before running it; the key remains outside the source file.
import json
import os
from datetime import datetime, timezone
from decimal import Decimal
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}
)
with urlopen(url, timeout=10) as response:
payload = json.loads(response.read(), parse_float=Decimal)
data = payload.get("data")
if not isinstance(data, dict) or data.get("success") is not True:
raise RuntimeError("The latest HSI request did not succeed")
rates = data.get("rates")
if not isinstance(rates, dict) or "HSI" not in rates or "USDHSI" not in rates:
raise RuntimeError("The response is missing an expected HSI rate")
timestamp = data["timestamp"]
observed_at = datetime.fromtimestamp(timestamp, tz=timezone.utc)
print("Base:", data["base"])
print("Date:", data["date"])
print("Timestamp UTC:", observed_at.isoformat())
print("HSI rate:", rates["HSI"])
print("USDHSI rate:", rates["USDHSI"])
The sample retains decimal values rather than immediately converting them to binary floating-point numbers. In an application, also catch network, timeout, and JSON parsing errors at the boundary where you call the API. Avoid logging the complete request URL: it contains the access key.
Interpret the fields before charting
base is USD in the response. The API describes rates as relative to USD by default, so a value in rates needs to be interpreted with that base and the relevant symbol specification—not simply labeled “Hang Seng index points.”
The example exposes both rates.HSI and rates.USDHSI. They are reciprocal in this response, but the response itself does not provide a separate unit field or establish that either value is the conventional published HSI level. Confirm the symbol definitions and quote convention in the documentation before selecting a field for a chart labeled as an index price.
That distinction matters when calculating changes. A rise in a rate and a rise in its reciprocal have opposite directions. If your dashboard switches between the two without recording the transformation, an alert or return calculation can report a move in the wrong direction.
date is the date supplied for the observation. timestamp is a Unix timestamp; the Python example renders it in UTC so that users in different time zones see an unambiguous time. Keep both fields: a date is useful for grouping a daily series, while the timestamp helps you assess freshness. Do not assume the timestamp alone establishes the exchange session or that the daily value is an official closing level.
For a durable record, store the selected rate together with its symbol, base, date, timestamp, and any transformation your application applies. Retaining the original value makes it possible to audit a chart or recompute a return later without guessing which quote direction was used.
Backfill a daily series
The time-series endpoint is designed for daily historical rates over a date range. Use it for a chart or research backfill rather than repeatedly calling the latest endpoint and pretending those snapshots are historical observations. The Documentation provides the current request syntax, supported range limits, and response details for your plan.
Choose a start_date and end_date for the historical interval. end_date cannot be today; use an earlier end date for a time-series request. If you also need the current observation, fetch it separately from the latest endpoint and present it as a live or latest snapshot rather than assuming it is a completed daily historical value.
The documented time-series response organizes rates by date, with rate values under each date. When implementing the backfill, inspect the returned structure and select the confirmed HSI quote consistently across all dates. Preserve the response’s base and range metadata alongside the observations, and validate that the field you intend to chart is present before saving a row.
Do not assume that every calendar date in the requested range will contain a new market observation. Weekends and Hong Kong market holidays are not ordinary trading sessions. A provider may omit a date or return a carried value, so inspect actual results and the documented behavior before deciding how to render gaps.
For a line chart, a missing day can remain a gap, or the display can carry the previous value forward if the product clearly marks that choice. For research and return calculations, retain the original observations separately from any filled display series. Filling a weekend is a visualization decision, not evidence that the index traded or that a new close was published.
Historical coverage and the maximum interval per request can vary. Check the documentation and your available plan before promising users a particular start date or designing a fixed-size backfill. If the requested history must be split into ranges, keep the range boundaries and deduplicate observations by date, symbol, base, and selected quote field.
Make the integration reliable
Latest-data update frequency depends on the subscription. The available information describes plans with updates every 60 minutes or every 10 minutes; check the current plan details for the cadence available to your key. Polling more frequently than the source updates does not necessarily produce a newer HSI observation.
Cache the latest response for an interval appropriate to that cadence, and show its response timestamp in the interface. A cached value can remain visible during a temporary failure, but label it with its actual observation time instead of presenting it as newly updated. If a newly fetched response has the same timestamp as the cached one, treat it as the same observation for freshness purposes.
Historical observations are also good candidates for caching, but a cache should not prevent corrections from being picked up indefinitely. Store when your application fetched each range, and define a refresh policy appropriate to the chart or research workflow. Keep raw API observations separate from derived values so a later refresh can be reconciled.
For alerts, compare like with like: use the same HSI field, base, and transformation for both observations. Reject a comparison when either value is missing or the starting value is zero. Also distinguish an alert based on the latest snapshot from one based on two completed historical observations; they answer different questions.
For pagination or batching, follow the time-series documentation rather than assuming a cursor or page parameter. Your client should tolerate a response with fewer dated observations than calendar days requested and should report which ranges failed, so a retry does not silently leave a hole in the backfill.
If you use an assistant-based workflow alongside your application, the MCP page describes the available integration. Keep the same checks on symbol, quote direction, and dates regardless of how a request is initiated.
FAQ
Is the latest HSI response a historical series?
No. It is a snapshot with a date and timestamp. Use the time-series endpoint for dated historical observations and keep the latest snapshot separate until you have decided how it belongs in your chart.
Can I request a time series ending today?
No. Set end_date to an earlier date. If your interface also needs the latest available HSI observation, retrieve it separately and label its timestamp.
Why might a date be missing from my chart?
Weekends, holidays, coverage, and provider behavior can all affect the dates returned. Check the response and documentation before filling a missing date, and distinguish filled values from actual observations.
Which HSI rate should I use?
The example includes both HSI and USDHSI. Confirm their definitions and quote direction in the symbol specifications before choosing one, and do not label a rate as an index-point close without verifying that interpretation.
Ready to test the request? Get a free API key through Register, then verify the latest response and your historical range before connecting HSI data to your chart.