This 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 this sample, you need to have 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 from a command line, go to the folder in which you unzipped the sample (see attachment below) and enter the following command:
Windows
> NewsSample.exe [-h <host>] -u <username> -p <password> [-r <requestType> -ns <sources> ] -s <symbolOrStoryID> -sf <storyFormat> -c <categories> -hc <headlineStoryCount> ] -b <beginTime> -e <endTime> -hd <days> -actions <allActions> -sp <searchText> ] -f <searchFields> -phrase <isPhrase> -all <allWords> -fulltext <fullText> ] -wholeword <wholeWord> -matchcase <matchCase> -so <sortOrder>]
Linux
$ export LD_LIBRARY_PATH=./ $ chmod a+x NewsSample $ ./NewsSample [-h <host>] -u <username> -p <password> [-r <requestType> -ns <sources> -s <symbolOrStoryID>] -sf <storyForma6t> -c <categories> -hc <headlineStoryCount> -b <beginTime> -e <endTime> ] -hd <days> -actions <allActions> -sp <searchText> -f <searchFields> -phrase <isPhrase> ] -all <allWords> -fulltext <fullText> -wholeword <wholeWord> -matchcase <matchCase> ] -so <sortOrder> ]
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) |
-r | <requestType> | Specifies what kind of news request to make. Valid values include:
|
-ns | <sources> | Comma separated list of news services. News services are specified by the Interactive Data two letter service code for each news service. For example: -ns "CT,PR,N1,PC" |
-s | <symbolsOrStoryID> | Comma separated list of symbols or a single story ID for which to make a request. Multiple symbols must be enclosed in quotes and separated by commas. For example: 'IBM,GE,WFM' note: You cannot mix symbols and story IDs. You cannot submit multiple story IDs in a single request. |
-sf | <storyFormat> | The format the News Service should provide for the requested story. Valid formats include:
|
-c | <categories> | A single word, or multiple words enclosed in quotes and separated by commas that identify vendor categories, products, topics, language, region, etc. For example: business |
-hc | <headlineStoryCount> | The number of headlines or stories to return for a search request, regardless of the total number available. |
-b | <beginTime> | The start of the time range in which to conduct the news search. The date format is as follows: yyyy/MM/dd HH:mm:ss Setting this value to 0 indicates to start the search as far back as possible; forever. |
-e | <endTime> | The end of the time range in which to conduct the news search. The date format is as follows: yyyy/MM/dd HH:mm:ss Setting this value to 0 indicates to use the current time as the end time for the search. |
-hd | <days> | The number of days to search from the current day moving backward. |
-actions | <allActions> | Valid values include: 0 = Send only new headlines (default) 1 = Send all headline update actions |
-sp | <searchText> | A single word, set of words, or phrase to search. Multiple words should be separated by commas. Multiple words and phrases should be contained in quotes. |
-f | <searchFields> | The fields in which to search for the instruments, words, phrases, etc. Search fields include:
|
-phrase | <isPhrase> | Valid values include: 0 = The search text is not a phrase (default) 1 = The search text is a phrase |
-all | <allWords> | Valid values include: 0 = Do not require a match of all words (default) 1 = Require all words specified |
-fulltext | <fullText> | Valid values include: 0 = Do not perform a full-text search (default) 1 = The search is a full-text search |
-wholeword | <wholeWord> | Valid values include: 0 = Allow partial word matches (default) 1 = Require whole word matches |
-matchcase | <matchCase> | Valid values include: 0 = The search is case-insensitive (default) 1 = The search is case-sensitive The default is to search the headline field. |
-so | <sortOrder> | The order in which to return the news search results. Valid values include: 0 = time descending (default) 1 = time ascending 2 = relevancy score |
Note: If you do not enter a value for one or more of the sample arguments default values will be used.
<username> and <password> must be entered at the command line.