CAC 40 (France) (CAC) OHLC API
You need daily OHLC candles for the CAC 40 to power a dashboard, backtest, or alerting service. By the end of this guide, you will know how to fetch and validate CAC 40 OHLC data with Indices-API, handle edge cases like weekends and same-day requests, and structure your code so it’s production-ready for charts, analytics, or event-driven workflows.
What you’re building: daily CAC 40 candles you can trust
The core job is to retrieve the CAC 40’s open, high, low, and close for a given market day and render it in your system. We’ll use three endpoints:
- Latest: to sanity-check symbol coverage and get the current snapshot cadence.
- OHLC: to fetch a specific day’s open, high, low, and close.
- Time-series: to backfill multiple days (e.g., a quarter) for charts and research.
Important: Don’t guess the symbol string. The CAC 40 appears as “CAC 40” in example payloads, but production symbols are curated and may include alternates (e.g., CAC). Confirm the exact code on the Indices-API Supported Symbols page before coding your requests.
Prerequisites and how CAC quotes are expressed
Indices-API returns index data “relative to USD” with a base of USD, and a unit field that reads per index. That means values in rates are expressed in terms of USD per index unit. Your downstream use depends on your application:
- If you chart raw index points: confirm the index symbol and scaling you need from the symbols catalog. If you must convert to a different base, use the convert endpoint as documented.
- If you compute spreads or percent changes: work from the rate fields consistently using the same base and unit each day.
Update frequency for the latest endpoint depends on plan tier (e.g., every 60 minutes or every 10 minutes). Use ETag/If-Modified-Since or your own cache to avoid redundant pulls. The Documentation details endpoint behaviors and optional parameters.
Endpoint overview for CAC 40 candles
We’ll focus on these:
- Latest endpoint: GET https://indices-api.com/api/latest?access_key=YOUR_API_KEY
- OHLC endpoint: open-high-low-close/YYYY-MM-DD (supply a market date, not today)
- Time-series endpoint: date range for daily historical rates between two dates
The OHLC endpoint returns a per-index object with open, high, low, and close fields on the requested date. When you’re requesting the CAC 40, ensure the symbol string exactly matches what’s on the symbols page. If you pass a symbol that is not supported, the API returns an error envelope (shown later in this post).
One quick sanity-check with the latest endpoint
This is a practical first call to confirm your key, inspect the base currency, and see how the index appears in the rates map. Replace YOUR_API_KEY with your token.
curl -s "https://indices-api.com/api/latest?access_key=YOUR_API_KEY"
If you pass an unsupported or malformed symbol parameter in other endpoints, or if your request otherwise references an invalid symbol, you may receive an error envelope. This is a real example of such an error from a live call. Use it to harden your error handling and symbol validation:
{"success":false,"error":{"code":400,"type":"invalid_symbol","info":"One or more invalid symbols have been specified."}}
How to use this:
- success: boolean indicating whether the request returned valid data.
- error.code, error.type, error.info: use these fields to surface actionable messages (e.g., prompt the user to choose a supported symbol) and to route retries vs. hard failures.
JavaScript example: calling latest and validating the response
The following Node.js snippet calls the same latest endpoint and demonstrates robust parsing. On success, you’ll read the fields you need for CAC 40 candles later (timestamp, base, date, rates). On error, you’ll see the exact envelope above and can respond accordingly.
import fetch from "node-fetch";
const ACCESS_KEY = process.env.INDICES_API_KEY || "YOUR_API_KEY";
const url = `https://indices-api.com/api/latest?access_key=${encodeURIComponent(ACCESS_KEY)}`;
async function getLatest() {
const res = await fetch(url, { timeout: 10000 });
if (!res.ok) {
throw new Error(`HTTP ${res.status}`);
}
const json = await res.json();
// Handle both success and error envelopes exactly as the API returns them.
if (json.success === false && json.error) {
// Example: {"success":false,"error":{"code":400,"type":"invalid_symbol","info":"One or more invalid symbols have been specified."}}
console.error(`Indices-API error ${json.error.code} (${json.error.type}): ${json.error.info}`);
return;
}
// On success: the fields you’ll actually use downstream.
// - json.timestamp: Unix seconds; convert to your system timezone if needed.
// - json.base: "USD"
// - json.date: "YYYY-MM-DD" of the snapshot
// - json.rates: object map; confirm the exact CAC 40 key on the Symbols page
// - json.unit: "per index"
const { timestamp, base, date, rates, unit } = json;
console.log("Snapshot timestamp:", timestamp);
console.log("Base currency:", base);
console.log("Snapshot date:", date);
console.log("Unit:", unit);
// Find CAC 40 safely: do not assume the key label; confirm and map it from the Symbols catalog.
const cacKey = "CAC 40"; // Replace after verifying on the Symbols page if needed.
if (rates && Object.prototype.hasOwnProperty.call(rates, cacKey)) {
console.log("Latest CAC 40 rate:", rates[cacKey]);
} else {
console.warn("CAC 40 key not present. Confirm the symbol on the Symbols page.");
}
}
getLatest().catch(err => {
console.error("Request failed:", err);
});
Fetching CAC 40 OHLC for a specific day
Use the OHLC endpoint to retrieve the open, high, low, and close for a given market day. The pattern is open-high-low-close/YYYY-MM-DD. Practical notes for CAC 40 (Euronext Paris):
- Use a confirmed market date, not today. The API’s end_date (for time-series) or OHLC date should be a completed trading day. Same-day candles are not final.
- Weekends and French market holidays: there is no trading; expect no OHLC for those dates. Reference a trading calendar such as the official Euronext schedule: Euronext trading hours and holidays.
- Timezone alignment: timestamps are Unix seconds; convert to your local or display timezone. Do not mix UTC and local in the same series without labeling.
- Plan cadence: the latest endpoint refresh interval depends on your plan (for example, every 60 minutes or every 10 minutes). OHLC represents the finished daily bar, independent of the intraday refresh cadence.
Because the live example in this article is an error envelope, do not copy candles from it. Always query the OHLC endpoint for the exact date you need after confirming the symbol on the Indices-API Supported Symbols page.
Backfilling CAC 40 with the time-series endpoint
When you need to build a rolling chart or conduct research, use the time-series endpoint to pull daily values over a date range. Tips that save time:
- End date cannot be today. Use yesterday or the last completed trading day to avoid partial data.
- Handle gaps: weekends and holidays will produce no entries; don’t interpolate unless your method explicitly requires it.
- Caching: archive raw JSON responses keyed by end_date to create deterministic replays for backtests and to cap API usage.
- Pagination/batching: if you request a large date span, break it into smaller ranges and merge; confirm exact constraints in the Documentation.
If your pipeline also needs intraday candles, see the intraday endpoint in the docs. You can stitch intraday intervals into a daily OHLC if you must recompute from raw intervals.
Field semantics you’ll actually use
Across endpoints, you will work with a small, consistent set of fields:
- success: when false, do not trust other fields; inspect error.type and error.info.
- timestamp: Unix seconds for when the snapshot was computed; convert and display explicitly.
- base: default USD; all rates are relative to this base.
- date: ISO date for the snapshot or trading session; prefer this for grouping in daily charts.
- rates: object map from symbol to value or to a sub-object (OHLC); ensure your key matches the symbols catalog entry for CAC 40.
- unit: per index; keep this with your metadata to avoid unit mismatches when combining sources.
For OHLC specifically, the value for CAC 40 under rates will be an object like { open, high, low, close }. Do not fabricate candles; always take them verbatim from the endpoint for the precise date.
CAC 40 in smart, sustainable, data-rich workflows
Developers increasingly embed market telemetry into IoT dashboards, ESG analytics, and predictive pipelines. CAC 40 exposure can be:
- Bound to building-level energy monitoring to correlate sustainability upgrades with market benchmarks.
- Piped into financial data analytics stacks that join macro indices with NLP signals for French large-cap news.
- Used as a control variable when modeling sector rotation or green-transition leaders within the index.
Indices-API’s JSON payloads are minimal and consistent, making them trivial to integrate with stream processors or serverless functions. If you manage private clusters or marketplaces, see MCP for managed connectivity patterns.
How to avoid the most common integration pitfalls
- Symbol drift: don’t hardcode; fetch or verify against the Symbols catalog at deploy time. If you pass an unsupported symbol, you’ll see the invalid_symbol error envelope shown above.
- End-of-day logic: the OHLC endpoint requires a finished trading day; don’t query today’s date. Schedule backfills after the market close and buffer for post-close adjustments.
- Weekend/holiday handling: pre-compute the Paris trading calendar to skip dark days. You can consult external calendars (e.g., Euronext Hours & Holidays).
- Base and unit consistency: keep the base=USD and unit="per index" metadata with your dataset; do not mix with other sources without explicit conversion steps.
- Caching and retries: cache stable daily responses and implement exponential backoff for transient network failures; do not retry invalid_symbol—fix the input.
Production checklist for CAC 40 OHLC
- Get an API key and store it securely (env var or vault).
- Confirm the CAC 40 symbol on the Symbols list.
- Add a daily job: call OHLC for yesterday (or last trading day) and persist open, high, low, close.
- For charts/backtests: backfill using the time-series endpoint in bounded ranges.
- Add guardrails: if success=false, log error.code/type/info and surface a clear operator message.
- Normalize timestamps to your display timezone; store raw Unix seconds for lineage.
- Unit tests: assert the presence of base, date, unit, and the CAC 40 key in rates for happy-path days.
Plan, trial, and key management
The Pro plan is $49.99/month with a 7-day trial. Start with a free key, validate symbol coverage for CAC 40, and then scale to backfills and production workloads. Create your key here: Register.
Where to go next
- Reference endpoint parameters and response structures: Indices-API Documentation.
- Verify CAC 40’s exact symbol code and any alternates: Indices-API Supported Symbols.
- If you need managed connectivity patterns for internal platforms, see: MCP.
FAQ
Which symbol should I use for CAC 40?
Do not guess. Check the CAC 40 entry on the Symbols page and use that symbol exactly in your requests.
Why did my request return invalid_symbol?
Your symbol string didn’t match a supported code. The API returns the error envelope with error.code, error.type, and error.info. Fix the input—retries will not help for this error class.
Can I request OHLC for today?
No. Use the last completed trading day. The end_date for time-series and the date for OHLC should not be today.
What timezone are timestamps in?
timestamp is Unix seconds; convert from UTC as needed. The date field is ISO YYYY-MM-DD and should be used for daily grouping.
How often does the latest endpoint update?
Depends on your plan (e.g., every 60 minutes or every 10 minutes). OHLC represents end-of-day values and is not tied to intraday refresh cadence.
Ready to ship CAC 40 candles into your app? Get your API key now and start integrating daily OHLC and backfills in minutes: Register.