DataSource for C SDK  8.0.4.341990-53978ef8
Publishing News Data

Macros

#define NEWS_AUTHSTR_FIELDNUM   5
 Definition of the authorisation string field number. More...
 
#define NEWS_COMPANY_CODE_FIELDNUM   102
 Definition of the company code field number. More...
 
#define NEWS_DATETIME_FIELDNUM   2
 Definition of the date time field number. More...
 
#define NEWS_HEADLINE_FIELDNUM   0
 Definition of the headline field number. More...
 
#define NEWS_PRODUCT_CODE_FIELDNUM   100
 Definition of the product code field number. More...
 
#define NEWS_STORYCODE_FIELDNUM   1
 Definition of the storycode field number. More...
 
#define NEWS_TOPIC_CODE_FIELDNUM   101
 Definition of the topic code field number. More...
 
#define NEWS_USER_CODE_FIELDNUM   200
 Definition of the user code starting field number. More...
 
#define NEWS_USER_CODE_MAX   10
 Maximum number of user codes. More...
 

Functions

void ds_add_news_authstr (ds_data_t *data, const char *authstr)
 Add an authorisation string to the news headline message. More...
 
void ds_add_news_company_code (ds_data_t *data, const char *code)
 Add a company code to the news headline message. More...
 
void ds_add_news_datetime (ds_data_t *data, const char *datestr)
 Add a date stamp to the news headline message. More...
 
void ds_add_news_field (ds_data_t *data, const char *fieldname, const char *value)
 Add a custom field to a news headline message. More...
 
void ds_add_news_headline (ds_data_t *data, const char *headline)
 Add a news headline to the news headline message. More...
 
void ds_add_news_product_code (ds_data_t *data, const char *code)
 Add a product code to the news headline message. More...
 
void ds_add_news_storycode (ds_data_t *data, const char *story)
 Add a story code to the news object. More...
 
void ds_add_news_topic_code (ds_data_t *data, const char *code)
 Add a topic code to the news headline message. More...
 
void ds_add_news_user_code (ds_data_t *data, int codenum, const char *code)
 Add a user defined code to the news headline message. More...
 
ds_data_tds_init_news (const char *subject, unsigned short flags)
 Create a news headline message. More...
 

Detailed Description

Both news stories and headlines may be streamed. Conventionally, the streaming of stories has been thought not to have been beneficial. However, if the data can be arranged such that story corrections are transmitted on the same symbol names as the original story, then the end user will obtain an updated story without having to re-request the story. This is particularly useful for news articles that provide market summaries.

Publishing News Headlines

A news headline update should contain as a minimum the headline of the the story and the time of the story. To uniquely identify the story a story code should be added using the ds_add_news_storycode() function.

To facilitate efficient story searching, topic codes can be added to the headline update using the ds_add_news_product_code(), ds_add_news_topic_code() and ds_add_news_user_code() functions.

Example: Send to all subscribed peers a news headline on the /NEWS symbol.

ds_data_t *dsdata;
ds_add_news_headline(dsdata,"This is a headline");
ds_add_news_datetime(dsdata,"Oct 14 16:39");
Publishing News Stories

Depending on your data requirements, stories may be sent to the Liberator as either broadcast (using the F_NONACTIVE flag), or active.

Story updates should be created using ds_init_data() with the DS_STORY_TYPE object type flag. These updates contain a single field with the fieldnumber 0 which contains the story text.

The story text may be broken across multiple datasource update packets, to indicate that a subsequent update is a continuation and not a replacement, the text should be inserted with the fieldnumber 1.

Example: Send a complete story in one datasource packet.

ds_data_t *dsdata;
ds_add_data(dsdata,0,"Complete story text");

Example: Send a story in a multiple datasource packets.

ds_data_t *dsdata;
ds_add_data(dsdata,0,"First part of story text");
ds_add_data(dsdata,1,"Second part of story text");

Example: Send a story and then send a correction.

ds_data_t *dsdata;
ds_add_data(dsdata,0,"Complete story");
ds_add_data(dsdata,0,"Story correction");
See also
Data Object Flags
Creating Data Objects
Sending DataSource Objects to Peers

Macro Definition Documentation

#define NEWS_AUTHSTR_FIELDNUM   5

Definition of the authorisation string field number.

#define NEWS_COMPANY_CODE_FIELDNUM   102

Definition of the company code field number.

#define NEWS_DATETIME_FIELDNUM   2

Definition of the date time field number.

#define NEWS_HEADLINE_FIELDNUM   0

Definition of the headline field number.

#define NEWS_PRODUCT_CODE_FIELDNUM   100

Definition of the product code field number.

#define NEWS_STORYCODE_FIELDNUM   1

Definition of the storycode field number.

#define NEWS_TOPIC_CODE_FIELDNUM   101

Definition of the topic code field number.

#define NEWS_USER_CODE_FIELDNUM   200

Definition of the user code starting field number.

#define NEWS_USER_CODE_MAX   10

Maximum number of user codes.

Function Documentation

void ds_add_news_authstr ( ds_data_t data,
const char *  authstr 
)

Add an authorisation string to the news headline message.

Parameters
dataThe news headline message
authstrThe authorisation string to be added

The authorisation string will be available to the Liberator's authentication module if content based permissioning is required

void ds_add_news_company_code ( ds_data_t data,
const char *  code 
)

Add a company code to the news headline message.

Parameters
dataThe news headline message
codeThe company code to be added
void ds_add_news_datetime ( ds_data_t data,
const char *  datestr 
)

Add a date stamp to the news headline message.

Parameters
dataThe news headline message
datestrThe datestamp to be added
void ds_add_news_field ( ds_data_t data,
const char *  fieldname,
const char *  value 
)

Add a custom field to a news headline message.

Parameters
dataThe news headline message
fieldnameThe fieldname
valueThe value of the field
void ds_add_news_headline ( ds_data_t data,
const char *  headline 
)

Add a news headline to the news headline message.

Parameters
dataThe news headline message
headlineThe headline to be added
void ds_add_news_product_code ( ds_data_t data,
const char *  code 
)

Add a product code to the news headline message.

Parameters
dataThe news headline message
codeThe product code to be added
void ds_add_news_storycode ( ds_data_t data,
const char *  story 
)

Add a story code to the news object.

Parameters
dataThe news headline message
storyThe story code to be added
void ds_add_news_topic_code ( ds_data_t data,
const char *  code 
)

Add a topic code to the news headline message.

Parameters
dataThe news headline message
codeThe topic code to be added
void ds_add_news_user_code ( ds_data_t data,
int  codenum,
const char *  code 
)

Add a user defined code to the news headline message.

Parameters
dataThe news headline message
codenumAn identifier for this type of code
codeThe code to be added

A maximum of NEWS_USER_CODE_MAX user defined codes are permitted

ds_data_t* ds_init_news ( const char *  subject,
unsigned short  flags 
)

Create a news headline message.

Parameters
subjectThe name of the object
flagsObject flags

Generated on Wed Dec 4 2024 14:56:20 for DataSource for C SDK