question

Upvotes
Accepted
2 0 1 3

TS1 data incorrect decoded date

When we requested TS1 data and decode the date of RIC EUR= using RFA C++ and TS1 decoder using below code.

time_t time = sample->getDate();
time_tm = gmtime(&time);
sprintf(time_str,”%4ld/%02ld/%02ld",(long int)(1900+time_tm->tm_year),(long int)(time_tm->tm_mon+1),(long int)time_tm->tm_mday);

The result is like:

DATE,BID,OPEN,HIGH,LOW,ASK,HIGH BID,LOW BID,OPEN ASK,HIGH ASK,LOW ASK
2018/06/27,No data available
2018/06/26,1.1552,1.1646,1.1672,1.1539,1.1555,1.1672,1.1539,1.165,1.1674,1.1541
2018/06/25,1.1645,1.1702,1.172,1.1633,1.1649,1.172,1.1633,1.1706,1.1722,1.1636
2018/06/24,1.1702,1.1657,1.1713,1.1625,1.1706,1.1713,1.1625,1.1658,1.1715,1.1629
2018/06/21,1.1655,1.1602,1.1675,1.1598,1.1659,1.1675,1.1598,1.1605,1.1677,1.16
2018/06/20,1.1601,1.157,1.1633,1.1507,1.1605,1.1633,1.1507,1.1573,1.1636,1.1509 

When compared this output with other services like Datascope Select, it seems the DATE is inconsistent with DSS. See the DSS data here. For example data from TS1 on 25 June appears in DSS on 26 June. Is this TS1 data issue or decoding issue?

trepdss-rest-apirfarfa-apits1
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
11.3k 25 8 13

Hi @Wiwat,

It seems that the TS1 C++ API internally convert the date using machine's local time, so an application needs to use localtime() to correctly decode the date. Please use the localtime() instead, and then let us know the result.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
7.6k 15 6 9

@Wiwat
According to TS1_DevGuide.pdf from RFA C++ 8.1 package, getDate return the time, in seconds, since epoch (in GMT). So you might need to call method localtime(...) instead of gmtime. Our example StarterConsumer_TS1 also use method localtime when display the data in TS1Decoder::displayByDate(..).

time_t time = sample->getDate();
time_tm = localtime(&time);
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
2 0 1 3

Hi, we are not trying to get the localtime actually. The issue we have is with gmtime() where it decodes a DATE to be different from other Thomson Reuters services e.g., Datascope Select. You can try with "EUR=" where TS1's BID=1.1601 on 20/06/2018 where on DSS's BID=1.1601 on 21/06/2018.

If the decoding code part is correct, is it possible that TS1 database is incorrect?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 0 0 0

Hi, sample->getDate() return the time, in seconds, since epoch (in GMT).

We tried the time sample returned from ‘sample->getDate()’ using ‘localtime’ as well as ‘gmtime’ functions and found that TS1 Application’s date output is in sync with the DataSCopeSelect’s date output for the same bid price.

  • The following is the output when the time sample returned from ‘sample->getDate()’ is converted using the ‘gmtime’ function.

  • The following is the output when the time sample returned from ‘sample->getDate()’ is converted using the ‘localtime’ function. We have run the application in Chicago Time Zone whose GMT Time equivalent is GMT – 5 considering the daylight savings in to account now.


ts1localtime.png (215.6 KiB)
ts1gmtime.png (100.7 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Do you run it on Windows or Linux?