LSEG Data Library for .NET

Headlines

Headlines news data can be retrieved as a list of headlines using the Headlines definition.

Each headline contains a raw content field, a story ID, a headline title and several metadata fields.

These metadata fields contain information about the creators, sources, languages, subjects and instrument codes.

Usage

The code snipet bellow, exemplifies a couple of use cases for retrieving headlines data.


    var definition = Headlines.Definition();

    // Default Count: Retrieve the most recent 100 headlines about any instrument
    var data1 = definition.GetData();

    // Default Count: Retrieve most recent 100 headlines for Apple
    var data2 = definition.Query("R:AAPL.O");

    // Specify Count: Retrieve most recent N headlines for Apple
    var data3 = definition.Query("R:AAPL.O").Count(15);

    // Retrieve a large number of headlines and a callback to retrieve each page.  Each page contains 100 headlines.
    definition.Query("R:AAPL.O")
              .Count(350)
              .GetData((response, def, s) =>
              {
                  // Use the response object and display the desired headlines details
              });

    // Retrieve headlines using queries and sort the result.
    var startdate = DateTime.Now.AddMonths(-15);
    var enddate = startdate.AddDays(1);

    var query = $"Apple daterange:\"{startdate:yyyy-MM-dd},{enddate:yyyy-MM-dd}\"";

    var data = Headlines.Definition()
                        .Query(query)
                        .Count(0)
                        .Sort(Headlines.SortOrder.oldToNew)
                        .GetData();

Headline entries can be sorted using the Sort() and providing a Headlines.ShortOrder value.

The available values are "oldToNew" and "newToOld".