News

R. Todd Gafford -

This executable sample demonstrates methods for requesting and processing headlines and news stories. There is a link to download the sample at the end of this article. 

Before you run the sample, you need to have the following:

  • Java Runtime Environment (JRE) 1.6 or higher
  • A current Interactive Data client account. If you do not yet have an account, click here to find out about setting up a trial.

To run the sample executable jar from a command line, go to the folder in which you unzipped the sample (see attachment below) and enter the following command:

Windows
> java -jar NewsSample.jar [-h <host>] -u <username> -p <password> [-m <mode> -y <storyID> -s <symbols>]
Linux
$ export LD_LIBRARY_PATH=./bin
$ java -jar NewsSample.jar [-h <host>] -u <username> -p <password> [-m <mode> -y <storyID> -s <symbols>]

where:

Argument Value Description
-h <host> is the address to use to connect to the Interactive Data Consolidated Feed Network.
-u <username> is the username for your client (required field)
-p <password> is the password for your client (required field)
-m <mode> Three modes available:
- subscribe: Retrieves streaming headlines with different search criteria (e.g. category, service, symbol) 
One of the fields returned is the StoryID. The StoryID can then be specified to request the StoryBody using 
the story mode of the NewsSample. 

- request: Retrieves a fixed number of headlines with different search criteria (e.g. category, service, symbol). 
One of the fields returned is the StoryID. The StoryID can then be specified to request the StoryBody using the 
Story mode of the NewsSample. 

- story: When given a StoryID, this mode returns the StoryBody. One form of the StoryBody is in URL format which 
client application can further open the story text using a browser.
-y <storyID> is used with story mode to request a specific story. Client application can further open the story text using a browser.
-s <symbols> is a comma separated list of symbols for which to make a headline request. Multiple symbols must be enclosed in quotes with no spaces between symbols. For example: 'IBM,GE,WFM'

Note: If you do not enter a value for <host>, <mode>, <symbols> or <storyID> the values listed in the NewsSample.properties file will be used. 

<username> and <password> must be entered at the command line.