question

Upvotes
Accepted
646 6 13 25

AdxRtList CF_DATE format

CF_DATE comes as a number of days from Jan 1, 1901 in double (why?) type...

Is there a way to get it in string format?

Python API returns string.

And more general question about the COM API: why do API return the values of the same field in different format for different tickers?

Example 1: CF_DATE is an empty string when is not available, but otherwise - doube

Example 2: TR.VWAP (TR.Close, TR.HIGH) is a double value, but 'NULL' string value if not available for a ticker. Why not just 0?

Thanks,

Igor

eikoneikon-com-api
icon clock
10 |1500

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

Upvotes
Accepted
4.6k 26 7 22

@igorg CF_DATE is represented in the Excel (1900) date format:

> In the 1900 date system, dates are calculated by using January 1, 1900, as a starting point. When you enter a date, it is converted into a serial number that represents the number of days elapsed since January 1, 1900.

You can convert it to a date in code fairly easily depending on what environment you use.

COM API is an ease-of-use API that was designed with VBA and Variant type in mind. If you use C++ or .NET with this API, you can run into type casting issues like the one you are describing above.

Returning 0 values for numeric fields is confusing, if an instrument is quoted in points or is a very low interest rate, 0 can be a legitimate HIGH or CLOSE price.

icon clock
10 |1500

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

Upvotes
39.2k 75 11 27

Eikon COM APIs are targeted primarily for use in MS Office VBA and are meant to be most friendly for Excel users. This is why the dates are returned in OLE Automation date format, which is the date format Excel uses. The logic behind the dates returned as strings when not available is to force the type mismatch error rather than to allow zero to propagate into calculations that may return incorrect result to an unsuspecting user. In other words this logic was built with the view that in financial calculations error is better than incorrect result.

icon clock
10 |1500

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

That's understandable. But in c++ it leads me to have expected field type in the memory and to make a comparison of every received value type with expected...

What will be a format of the fields that have datetime values?

I don't believe we have any datetime values on the datafeed. I believe date and time are always separated into different fields. But for your purposes it doesn't matter because AdfinX Real-Time COM library will return date, time and datetime values (if there are any) in the same OLE Automation date format.

Oh, I didn't know about ole date format. It answers my question about the date. Thank you.

Click below to post an Idea Post Idea