Is this a Bug with Refinitiv.Data.Content NuGet package.

Appears to be a bug in with Refinitiv.Data.Content NuGet package https://www.nuget.org/packages/Refinitiv.Data.Content/

This code doesn’t appear to set POST request body parameters correctly for eventTypes; Refinitiv.Data.Content.HistoricalPricing.EventsDefinition.Params.DefinePostParams(string url)

This means we’re not able to call POST https://api.refinitiv.com/data/historical-pricing/v1/views/events using the Refinitiv.Data.Content NuGet package. If we specify multiple RICS, and event type ‘quote’ it returns this error;

{

"HTTPStatusCode": 400,

"HTTPReason": "Bad Request",

"Contents": {

"error": {

"id": "463a2f6c-0bf9-489b-af96-2cf7a5b495da",

"code": "400",

"message": "Validation error",

"status": "Bad Request",

"errors": [

{

"key": "EventsMultiRicRequestBody",

"reason": "EventsMultiRicRequestBody.eventTypes in body must be of type string"

},

{

"key": "EventsMultiRicRequestBody",

"reason": "EventsMultiRicRequestBody.eventTypes in body should be one of [trade quote]"

}

]

}

}

}

The call we make is based on this example https://github.com/Refinitiv-API-Samples/Example.DataLibrary.DotNet/blob/main/src/2.%20Content/2.1-HistoricalPricing/2.1.02-HistoricalPricing-Events/2.1.02-HistoricalPricing-Events.cs#L31, but with multiple RICs and quote event type

var endTimeLocal = new LocalDateTime(2023, 04, 04, 16, 00, 01)

.InZoneLeniently(DateTimeZoneProviders.Tzdb["Europe/London"]);

var items = new[] { "NDXd2123A2475.U", "NDXPq0523A1900.U", "SPXp212334000.U" };

var events = Events.Definition(items)

.EventTypes(Events.EventType.quote)

.End(endTimeLocal.ToDateTimeUtc())

.Count(1);

var response = events.GetData(); // response.IsSuccess == false here

Best Answer

  • Hi @arkadiusz.polanowski

    The above issue you encountered has been identified and addressed. It will be available in the next release of the library.

    For example, here is a snippet of code and the results:

    var response = Events.Definition().Universe("AAPL.O", "MSFT.O")
    .Fields("BID", "BIDSIZE", "ASK", "ASKSIZE")
    .Start(DateTime.UtcNow.AddDays(-29))
    .End(DateTime.UtcNow.AddDays(-27))
    .EventTypes(Events.EventType.quote)
    .GetData();

    1682604431546.png

    To move forward, you can access and process this request at the delivery layer within the library. For example, here is a basic HistoricalPricing example.

    Based on this example, you can create something like this:

    var endpoint = "https://api.refinitiv.com/data/historical-pricing/v1/views/events";
    var data = EndpointRequest.Definition(endpoint)
    .Method(EndpointRequest.Method.POST)
    .BodyParameters(new JObject()
    {
    ["fields"] = new JArray("BID", "BIDSIZE", "ASK", "ASKSIZE"),
    ["universe"] = new JArray("AAPL.O", "MSFT.O"),
    ["eventTypes"] = new JArray("quote"),
    ["start"] = $"{DateTime.UtcNow.AddDays(-29):O}",
    ["end"] = $"{DateTime.UtcNow.AddDays(-27):O}"
    })
    .GetData();

Answers