> From TickerLayer docs, Indices: https://tickerlayer.com/docs/rest/indices#indices-agg-prev
> REST base URL https://api.tickerlayer.com, API key in the `x-api-key` header. WebSocket wss://stream.tickerlayer.com?apiKey=YOUR_API_KEY. Full API reference: https://tickerlayer.com/llms-full.txt

## Previous bar

**Endpoint:** `GET /indices/agg/:symbol/prev`

Most recent fully completed daily OHLCV bar in UTC (previous session close).

### Path parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `symbol` | string | Yes | Enabled index symbol (e.g. US500, DE40, EU50, JP225). Generic regional codes only, trimmed and uppercased before lookup. Full list: GET /indices/symbols. |

### Query parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `interval` | string | Returns the most recently settled bar at that interval instead of the previous daily bar, and adds `interval`, `bar_start`, `bar_end` and `as_of` to the response. Leave it out for the daily bar. Values: `1m`, `5m`, `15m`, `1h`, `4h`, `1d`. |

### Request

```bash
curl -sS "https://api.tickerlayer.com/indices/agg/US500/prev" \
  -H "x-api-key: <YOUR_API_KEY>"
```

```python
import requests

res = requests.get(
    "https://api.tickerlayer.com/indices/agg/US500/prev",
    headers={"x-api-key": "<YOUR_API_KEY>"},
)
print(res.json())
```

```javascript
const res = await fetch("https://api.tickerlayer.com/indices/agg/US500/prev", {
  headers: { "x-api-key": "<YOUR_API_KEY>" },
});
const data = await res.json();
console.log(data);
```

```go
req, _ := http.NewRequest("GET", "https://api.tickerlayer.com/indices/agg/US500/prev", nil)
req.Header.Set("x-api-key", "<YOUR_API_KEY>")
```

### Response

```json
{
  "symbol": "US500",
  "result": {
    "o": 5950.0,
    "h": 5980.0,
    "l": 5930.0,
    "c": 5965.0,
    "v": null,
    "t": 1732924800000
  }
}
```

### Notes

The bar is the real open, high, low, close and volume of the prior session, taken from the same daily series the range endpoint serves, so it matches `/indices/agg/:symbol/1/day/...` for that date; `v` is `null` where the index has no consolidated volume. `404 no bar available` when the daily bar cannot be resolved yet. A bar requested with `?interval=` is held for a short settle lag after it closes, so small clock differences between callers do not change which bar comes back, and it is the same bar the range endpoint returns for that window. `Cache-Control` and `ETag` mark when the value can next change. While the market is closed the last real bar is returned, still labelled with its own `bar_start`.
