Getting started
Concepts
- Model concepts
- API concepts
- API versions
- Entitlements
- Filters
- Request parameters
- Usage quota
- Error codes
Services
Parameters
- after
- aggregate
- aggregateIncrementFrom
- cursor
- dateFormat
- descending
- entity
- envelope
- fields
- format
- from
- groupBy
- groupById
- groupByIdAndTime
- groupByTo
- includeMetaData
- inline
- inlineLatest
- inlineTimeseries
- limit
- modulus
- nextUrl
- part
- pivot
- rankBy
- requestTimeout
- returnPreSignedUrl
- showMessage
- showStreamCursor
- to
- trace
- verifyLinks
- wait
Deprecated parameters
Datasets
- ECR: timeseries and observations
- ECR: usage patterns
- fiindices: retrieving index data
- Parsing: asset classes
- Parsing: best practices
Samples
timeseries
The timeseries service returns the historical records of an entity, ordered by id and then by time.
Records in a time range
Append /timeseries to the entity URL and specify the time range with from and to:
https://consumer.qa.data.spglobal.com/namespace/Entity/timeseries?limit=10000&from=2017-01-01Z&to=2017-01-07Z
from and to are optional. Without from the range is unbounded in the past, without to it is unbounded in the future.
Note: This request can return a very large number of records: the number of instances multiplied by the update frequency and the length of the time range. Always set a limit.
Records in a time range for specific ids
Add an id parameter to restrict the request to a list of identifiers:
https://consumer.qa.data.spglobal.com/namespace/Entity/timeseries?limit=10000&from=DATE&to=DATE&id=ID1,ID2
Other filters can be used as well.
Paging
The number of records per request is limited. The default and the maximum are determined by your account, and the default is 10,000. A larger limit is refused with an error.
To retrieve more records, request the envelope and repeat the request with after set to the value from the envelope. Do not construct the after value yourself: its content depends on the entity and the request, and in API version 2 it is opaque.
https://consumer.qa.data.spglobal.com/namespace/Entity/timeseries?from=DATE1&to=DATE2&limit=10000&envelope=truehttps://consumer.qa.data.spglobal.com/namespace/Entity/timeseries?from=DATE1&to=DATE2&limit=10000&envelope=true&after=AFTER_VALUE_1https://consumer.qa.data.spglobal.com/namespace/Entity/timeseries?from=DATE1&to=DATE2&limit=10000&envelope=true&after=AFTER_VALUE_2
Stop when a response contains no records or no after value.
Latest filters and time series filters
There are two kinds of filter in a timeseries request:
- Latest filters are evaluated on the latest data to create a list of ids, which are then requested from the time series. If the field had a different value earlier in the time series, the difference is ignored. In API version 2 a latest filter is written with the prefix
latest.. - Time series filters are evaluated on the time series itself. If a record matches only for part of the time range, only that part is returned.
Open the same URL with format=HTML to see which fields of the entity are latest filters and which are time series filters.
Range filters
A range filter on a field, written as field>=value and field<=value, cannot be combined with from and to. Only fields that are configured as time series range filters can be used.
The latest. prefix is required on a latest filter in version 2, and the request must then be read through the latest data first, which is not compatible with an explicit sortBy.
Group by id
groupById returns a single record for each id in the time range: the first (first, the "opening" value) or the last (last, the "closing" value).
For entities that store several records for the same id and time, groupByIdAndTime and groupByTo select the first or latest record by its key extension.
Combining entities
inlineLatest and inlineTimeseries expand references to other entities.
The URLs .../history and .../ID/history are aliases of .../timeseries. https://consumer.qa.data.spglobal.com/namespace/Entity/ID/timeseries selects the id from the path.
Other parameters
sortBy, descending, fields, dateFormat, format, showMessage, showStreamCursor and requestTimeout also apply to the timeseries service.