NIFTY INDIA MFG (NIMFG) Price Change API — Daily percentage and absolute change endpoint
You need to compute today’s move in NIFTY INDIA MFG (NIMFG) — both the absolute point change and the day-over-day percentage — so you can alert users, annotate a chart, or reconcile P&L. By the end of this guide you’ll query Indices-API for NIMFG, read the relevant fields, and calculate daily change safely for trading days versus weekends.
What you will build: daily percentage and absolute change for NIMFG
The core workflow has three small parts:
- Fetch the latest NIMFG quote (USD base, quote expressed per index).
- Fetch the previous close for NIMFG (yesterday’s value; use the most recent trading day, not “today”).
- Compute absolute change (Δ) and percentage change (Δ%).
You can get these numbers in one shot with the fluctuation endpoint for a start_date/end_date pair, or you can combine the latest endpoint with a single prior historical rate from your cache or a time-series request. This article shows both approaches and the practical gotchas that affect correctness.
Endpoints used and when to use each
| Endpoint | What it returns | When to use for NIMFG change |
|---|---|---|
| Latest | Most recent quote for all indices with base=USD and a timestamp/date | Fast intraday display; pair with the prior close from cache or historical/time-series to compute day change |
| Fluctuation | start_rate, end_rate, change, change_pct between two dates | Directly get daily absolute and percentage changes for NIMFG between two trading dates |
| Time-series | Daily rates between start_date and end_date | Backfill a sequence of day-over-day changes or find the last available trading day before today |
Full parameter details are in the Documentation, and you can confirm the NIMFG symbol on the Symbols page.
One-call daily change via fluctuation
If you already know the two dates to compare (typically yesterday to today’s date or the most recent trading day), call the fluctuation endpoint with base=USD and the NIMFG symbol. The response includes the absolute change and change_pct you need. Important: end_date cannot be today if today has not settled a closing print; for reliable daily P&L, set end_date to the latest completed trading day. On weekends or holidays, use the last business day.
Choosing dates safely
- If it’s a trading day before the market close: set both start_date and end_date to the most recent completed trading day to get yesterday-over-yesterday change, or wait for close before using today.
- If it’s after close: you can request yesterday (start_date) to today (end_date). If the API enforces settlement, “today” may still resolve to the last completed day.
- Never force end_date to the current calendar date when markets are closed; roll back to the last open session.
You’ll find the accepted date format and availability window in the Documentation. If you need an API key to try this now, you can Register for a free trial.
Alternative: latest + prior close
Another reliable pattern is to read the latest NIMFG quote and compare it to the prior close you store or fetch from a short time-series request. This is useful for dashboards that refresh prices intraday and label the live change against yesterday’s close.
- Get the latest NIMFG rate in USD. The API’s base is USD by default, so rates are expressed “per index.”
- Resolve yesterday’s value from your cache or a time-series slice.
- Compute:
- absolute_change = latest - previous_close
- percent_change = (absolute_change / previous_close) * 100
cURL: fetch the latest NIMFG quote
Use the latest endpoint with your API key. This is a single GET — filter client-side for NIMFG.
curl -s "https://indices-api.com/api/latest?access_key=YOUR_API_KEY"
The example below shows a real NIMFG response structure you can expect from the latest endpoint. We’ll parse the fields in the next section.
Official latest JSON sample for NIMFG
{"data":{"success":true,"timestamp":1794962460,"date":"2026-11-18","base":"USD","rates":{"NIMFG":0.0058725196642626,"USD":1,"USDNIMFG":170.28465755262275}}}
How to read this:
- success: API request status boolean.
- timestamp: Unix time (seconds, UTC) of the quote snapshot. Use this to drive cache expiry and show “as of” labels.
- date: The calendar date for the snapshot in YYYY-MM-DD.
- base: USD. All quotes in rates are relative to USD.
- rates.NIMFG: USD per one NIMFG “index unit” (per index). This is the value you’ll use for charting and change calculations when operating in USD terms.
- rates.USD: Always 1 because base=USD.
- rates.USDNIMFG: Inverse convenience quote (how many NIMFG units one USD buys). If you prefer to compute in index units per USD, use this.
JavaScript: compute day-over-day change for NIMFG
This snippet fetches latest NIMFG, resolves the prior close using a second request (time-series) and computes absolute and percentage changes. It also demonstrates caching logic and weekend handling at a basic level.
async function fetchJson(url) {
const res = await fetch(url);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return res.json();
}
function formatPct(v) {
return `${(v).toFixed(2)}%`;
}
function formatAbs(v) {
// Keep enough precision for USD-per-index quoting
return v.toFixed(6);
}
function prevBusinessDate(from = new Date()) {
// Roll back to the previous weekday; for exchange holiday specifics, consult your trading calendar
const d = new Date(Date.UTC(from.getUTCFullYear(), from.getUTCMonth(), from.getUTCDate()));
let dow = d.getUTCDay(); // 0 Sun ... 6 Sat
// If Monday, roll back to Friday; if Sunday, roll back to Friday; if Saturday, roll back to Friday
const back = (dow === 1) ? 3 : (dow === 0 ? 2 : (dow === 6 ? 1 : 1));
d.setUTCDate(d.getUTCDate() - back);
return d.toISOString().slice(0, 10);
}
(async () => {
const API_KEY = "YOUR_API_KEY";
const baseUrl = "https://indices-api.com/api";
// 1) Latest NIMFG (base=USD)
const latestUrl = `${baseUrl}/latest?access_key=${API_KEY}`;
const latest = await fetchJson(latestUrl);
// Navigate to the data shape used in the official sample
const payload = latest.data || latest; // handle either top-level or data-wrapped response
if (!payload.success) throw new Error("API returned success=false");
const asOfDate = payload.date;
const ts = payload.timestamp;
const usdPerIndex = payload.rates.NIMFG; // USD per NIMFG index unit
// 2) Get prior close. Use a 2-day window ending at the most recent business date before 'asOfDate'
const endDate = prevBusinessDate(new Date(asOfDate + "T00:00:00Z"));
const startDate = endDate; // just yesterday's settled value
const tsUrl = `${baseUrl}/timeseries?access_key=${API_KEY}&start_date=${startDate}&end_date=${endDate}`;
const hist = await fetchJson(tsUrl);
if (!hist.success || !hist.timeseries) throw new Error("Time-series query failed");
// The response places rates by date; extract yesterday's USD-per-index
const yClose = hist.rates[endDate]?.NIMFG;
if (typeof yClose !== "number") throw new Error("Missing NIMFG in time-series rates");
// 3) Compute change
const abs = usdPerIndex - yClose;
const pct = (abs / yClose) * 100;
console.log(JSON.stringify({
symbol: "NIMFG",
base: payload.base, // "USD"
asOf: new Date(ts * 1000).toISOString(),
latest_usd_per_index: usdPerIndex,
prev_close_usd_per_index: yClose,
change_abs_usd: abs,
change_pct: pct
}, null, 2));
})().catch(err => {
console.error(err);
process.exit(1);
});
Notes:
- Base currency is USD. Your application should consistently treat rates.NIMFG as “USD per index.” If you instead prefer index-units-per-USD, use rates.USDNIMFG.
- The time-series end_date should be the last completed trading day. Never set an end_date to the current day while markets are open.
- Cache latest responses using timestamp and date to avoid hitting rate limits and to keep UI stable between updates. The API updates the latest endpoint periodically depending on your plan; see the Documentation for update frequency.
How to compute absolute and percentage change
Once you have latest_usd_per_index and prev_close_usd_per_index:
- absolute_change = latest_usd_per_index − prev_close_usd_per_index
- percentage_change = (absolute_change / prev_close_usd_per_index) × 100
For alerting thresholds, decide whether to use closing-to-latest (intraday) or closing-to-closing (end of day). For charts, annotate with the timestamp to avoid mixing sessions.
Practical details that save time
- Base currency and units:
- base is USD by default; treat values under rates as USD per index unless the field name encodes an inverse (e.g., USDNIMFG).
- If you need a different display currency, use the convert endpoint as a separate step (see the Documentation for parameters).
- Trading days vs weekends:
- The time-series and fluctuation endpoints operate on calendar dates, but index markets observe weekends and public holidays. If a date is non-trading, the most recent prior business day’s rate is what you typically compare against.
- Never assume “end_date = today” is valid; when markets are closed, roll back.
- Update frequency and caching:
- Latest updates periodically depending on your subscription plan. Cache using timestamp and date and revalidate on your refresh cadence (e.g., every 60s to 10m, per plan).
- Upstream responses include a timestamp (UTC). Use it to avoid reprocessing stale data and to debounce alerts.
- Pagination and ranges:
- When backfilling, prefer the time-series endpoint with a bounded window. Don’t request year-long ranges into a live UI; instead, segment ranges and cache results server-side.
- Error handling:
- Always check success before dereferencing fields. If success=false, inspect the error object (see docs) and retry with backoff only on transient conditions.
Build a robust “daily move” service for NIMFG
For production alerting and dashboards, consider this flow:
- At the end of each trading day, persist the closing NIMFG value (USD per index) with its date and timestamp.
- Intraday, poll the latest endpoint on your plan’s cadence; compute change against the persisted prior close and update your UI.
- For end-of-day reporting, call the fluctuation endpoint with start_date=yesterday and end_date=today (post close) to reconcile your computed Δ and Δ% against the API’s canonical values.
This pattern shields your system from calendar edge cases and lets you control caching while still verifying outcomes against the dedicated price-change endpoint.
Confirming the symbol and payload fields
The symbol for NIFTY INDIA MFG in this article is NIMFG. Always verify symbols and any regional variants on the Indices-API Supported Symbols page before shipping to production.
Fields you will rely on in code:
- timestamp (number, seconds UTC): drives caching and “as of” labeling.
- date (YYYY-MM-DD): pairs with time-series and fluctuation requests.
- base (string): should be "USD" unless you explicitly request otherwise.
- rates.NIMFG (number): USD per index, primary value for change calculations.
- rates.USDNIMFG (number): inverse convenience quote, optional.
Security, performance, and deployment notes
- Keep access_key server-side; proxy requests if you have a browser UI. Rotate keys per your organization’s policy.
- Cache-control: store last good payload and serve stale-on-error briefly to avoid UI flicker during transient network issues.
- Idempotency: fluctuation and time-series reads are safe to retry. Add jittered backoff on 5xx errors.
- Validation: assert presence and type of rates.NIMFG before math; handle NaN and divide-by-zero cases in your pipeline.
Where to go next
- Explore the full request/response surface, parameters, and examples in the Indices-API Documentation.
- Confirm symbol coverage and attributes for NIMFG and related India indices on the Symbols page.
- If you use third-party market calendars to refine “previous business day” logic, consider integrating them with your scheduler. For background on market calendar practices, see external resources such as the NSE holiday list or global market calendars from recognized data providers.
- Get an API key and try the endpoints now: Register.
For more about Indices-API as a service and compatibility information, visit the homepage at indices-api.com and the compatibility notes at MCP.
FAQ
How are NIMFG quotes expressed?
Quotes are USD-based by default. Use rates.NIMFG as “USD per index.” If you need the inverse, rates.USDNIMFG tells you how many NIMFG index units one USD represents.
Can I set end_date to today when calling fluctuation?
Only if today’s trading session has a settled value. For consistent daily change, set end_date to the latest completed trading day. On weekends and holidays, roll back accordingly.
What timezone are timestamps in?
The timestamp field is Unix epoch seconds in UTC. The date field is a calendar date (YYYY-MM-DD) also aligned to UTC.
How often do latest values update?
Update cadence depends on your plan. Cache responses and revalidate on your plan’s interval; see the Documentation for specifics.
Where do I confirm the exact NIMFG symbol and related indices?
Use the Symbols list before deploying.
Ship your NIMFG daily change integration in minutes. Grab an API key and start testing with the endpoints shown above: Register. For details on parameters and more endpoints (including fluctuation, time-series, and OHLC), see the Documentation and check compatibility in MCP.