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
batchrun
Batches and batch runs
Some datasets are published in batches. A Batch represents a recurring publication, identified by its id. A BatchRun is one occurrence of a batch: for a daily batch a new batch run is created each day. A BatchRun has an id that identifies the run, a batch field that refers to its Batch and an asOf date.
Batches and batch runs are entities that you can read with the latest service:
https://consumer.qa.data.spglobal.com/namespace/Batch/latest
https://consumer.qa.data.spglobal.com/namespace/BatchRun/latest
To find recent batch runs, filter on asOf:
https://consumer.qa.data.spglobal.com/namespace/BatchRun/latest?asOf>=2017-03-04Z
Reading the records of a batch run
https://consumer.qa.data.spglobal.com/namespace/Entity/BATCH_RUN_ID/batchrun?limit=1000
returns the records of Entity that were published in the batch run with the given id. The response is always an envelope:
{
"batchrun": [...],
"requestId": "A011.1598447117.14",
"timeToFirstWrite": 2,
"after": "19101427"
}
| Field | Description |
|---|---|
batchrun | The records of the batch run. |
requestId | Add it to your logs to correlate your requests with the server logs. |
timeToFirstWrite | The time in milliseconds the server needed before it started to send the response. |
after | The value for the after parameter of the request for the next page. |
Use limit and after to page through the records. Without a limit up to 100,000 records are returned. Stop when the response contains no records or no after value.
To retrieve batches as they are published, poll the BatchRun entity for new runs. When a new BatchRun id appears, request the data of that run with the URL above.
Listing the batch runs of an entity
https://consumer.qa.data.spglobal.com/namespace/Entity/batchruns?limit=10&descending=true
lists the batch runs that contain data for the entity. Results are in ascending order of asOf, so use descending=true to get the most recent first. Each batch run has the fields id, batch, publicationMode, asOf, count, publishTime and incrementFrom.
You can restrict the list with batch, mode and id (a list of batch run ids), and with from and to, which are bounds on asOf. limit and after page through the list, and with envelope=true the response is an envelope that contains after.
batchrun compared to timeseries
Both services give access to historical data, with important differences:
- The data of the timeseries service can be available slightly later than that of the batchrun service.
- Data can be downloaded faster from the batchrun service.
- When a batch run is republished for the same
asOf, its records overwrite the matching records of the first run in the time series. The timeseries service therefore only provides the full results of the most recent run for anasOf, while the batchrun service provides the full results of every run.
Important: The data of a batch run is immutable. It is not updated for later corrections or enhancements. The timeseries service shows the most correct and most enhanced record available for each point in time.
For a batch run that is an increment of earlier runs, aggregateIncrementFrom=true returns the combined records of the whole chain.
The statusIdentifier field of the BatchRun entity must not be used in application logic.