The Quote Store typically holds large numbers of 'quotes' (market prices, FX spot rates and other data items representing a single value at a single point in time), and it can be difficult to audit the information it contains.
Retrieving a time-series of quotes for a particular instrument
By default, the ListQuotesForScope API returns every quote for every category in a particular scope. To reduce the amount of information, you can filter on any of the data fields in a quote
object, using dot notation for the nested fields underlined in red below:
For example, to retrieve the entire time-series of quotes for a particular instrument, apply a filter such as quoteId.quoteSeriesId.instrumentIdType eq 'Figi' and quoteId.quoteSeriesId.instrumentId eq 'BBG000BF46Y8'
:
curl -X GET 'https://<your-domain>.lusid.com/api/api/quotes/<your-scope>?filter=quoteId.quoteSeriesId.instrumentIdType%20eq%20%27Figi%27%20and%20quoteId.quoteSeriesId.instrumentId%20eq%20%27BBG000BF46Y8%27' -H 'Authorization: Bearer <your-API-access-token'
To retrieve the time-series of quotes for a particular instrument after 2023-01-01, apply a filter such as quoteId.quoteSeriesId.instrumentId eq 'BBG000BF46Y8' and quoteId.effectiveAt gt 2021-01-01
:
curl -X GET 'https://<your-domain>.lusid.com/api/api/quotes/<your-scope>?filter=quoteId.quoteSeriesId.instrumentId%20eq%20%27BBG000BF46Y8%27%20and%20quoteId.effectiveAt%20gt%202021-01-01' -H 'Authorization: Bearer <your-API-access-token'
Retrieving the latest quote for a particular instrument
The GetQuotes API returns the latest quote for the instrument specified in the body of the request.
For example, to retrieve the latest mid price for an instrument identified by FIGI and sourced from Bloomberg (note also the ephemeral LATEST-BP-MID-PRICE
ID, which is used to identify failures in the response):
curl -X POST 'https://<your-domain>.lusid.com/api/api/quotes/<your-scope>/$get' -H 'Content-Type: application/json-patch+json' -H 'Authorization: Bearer <your-API-access-token>' -d '{ "LATEST-BP-MID-PRICE": { "provider": "Bloomberg", "instrumentId": "BBG000C05BD1", "instrumentIdType": "Figi", "quoteType": "Price", "field": "mid" } }'
To retrieve the latest price providing it is not more than three days old, specify the maxAge
parameter with an ISO 8601 time interval such as P0Y0M3D
, for example:
curl -X POST 'https://<your-domain>.lusid.com/api/api/quotes/<your-scope>/$get?maxAge=P0Y0M3D'
-H 'Content-Type: application/json-patch+json'
-H 'Authorization: Bearer <your-API-access-token>'
-d '{
"LATEST-BP-MID-PRICE": {
"provider": "Bloomberg",
"instrumentId": "BBG000BF46Y8",
"instrumentIdType": "Figi",
"quoteType": "Price",
"field": "mid"
}
}'
To retrieve the latest price providing it is not more than three days older than a historical date, combine the maxAge
and effectiveAt
parameters, for example:
curl -X POST 'https://<your-domain>.lusid.com/api/api/quotes/<your-scope>/$get?effectiveAt=2022-03-14&maxAge=P0Y0M3D' -H 'Content-Type: application/json-patch+json' -H 'Authorization: Bearer <your-API-access-token>' -d '{ "LATEST-BP-MID-PRICE": { "provider": "Bloomberg", "instrumentId": "BBG000BF46Y8", "instrumentIdType": "Figi", "quoteType": "Price", "field": "mid" } }'