question

Upvotes
Accepted
46 5 6 10

Eikon COM API in VBA: how to take an action ONLY WHEN all the economic indicators have been published ?

Hey,

I am currently working with the COM Eikon API in VBA and have the following issue: before a macroeconomic indicator is published, its actual value (ECON_ACT) is by default set to 0. I am working with multiple indicators being published at the same time, but since they are sometimes published with a small time difference from one another, I have set an if condition that action is taken only when ALL indicators are not equal to 0 (otherwise action might be taken on the first indicator's notification of release while the others have not been released yet). However, in the case that the actual value of an indicator is actually 0, my if prevents action from being taken.

Any idea how to overcome this ?

Thanks!

eikoneikon-com-api
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.

Hello @alexandros.pantalis

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If so please can you click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question.

Thanks,

AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.
Thanks,
-AHS

Upvotes
Accepted
39.4k 77 11 27

One way you could do this is instead of checking the value of ECON_ACT field, check field SRC_ES_NS, which provides the time when the actual value for the indicator is published to ECON_ACT field, and which cannot be zero once the indicator value is published.
Another way is to create an array of indicators and boolean values indicating whether the indicator was updated. When you establish the subscriptions and receive initial images for all indicators, set the values of boolean values to false. Then once an indicator receives an update you change the boolean value for that indicator to true. And then when the sum of all boolean values is true you know all indicators have been updated.

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
46 5 6 10

Thanks for your answer!

Would you have any code sample for the array of indicators and boolean values solution ?

Thanks!!

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
39.4k 77 11 27

I just realized boolean type would not be enough, as we need to distinguish 3 states: initial state before the subscriptions are initiated, the subscription returns initial image and raises the first OnUpdate event for the item, an update is received and a second OnUpdate event for the item is raised. An example using Excel VBA is attached. In this example I used integers to encode and distinguish the states.
example.zip


example.zip (18.2 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.

Upvotes
46 5 6 10

Hey!

Thanks a lot for your answer.

I tried to implement on economic indicators but couldn't seem to make it work..

Really sorry to ask you such precise assistance but could you help me implement the solution in this particular case: actual-value-0-code.zip

Thank you very much!!!


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.

Upvote
39.4k 77 11 27

See attached. In this example I used a custom enum and added comments to make it more illustrative. The problem with using economic indicator RICs in an example is that you cannot test it, except in the live scenario during the release.
actual-value-0-code.zip


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
46 5 6 10

Thanks so much!!

I’ll test it and keep you up ;)

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
46 5 6 10

copy-of-actual-value-0-code.zipHey Alex, sorry for the delay and thanks a lot for your answer, it works great for getting non-0 values!

However I am trying to incorporate smartestimate values as well but keep getting errors (check attached), any idea how to do this ??

Thanks a lot!!


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.

At a quick glance I see two errors in your example:
1. You use string value identical to variable name instead of using the variable.

'You have:
.RegisterItems RICs, "FieldName, ForecastFieldName"
'You should have:
.RegisterItems RICs, Array(FieldName, ForecastFieldName)

2. Incorrect boundaries in the For loop assigning UserTag property values

'You have:
For i = 1 To NumberOfRICs * 2
'You should have:
For i = 1 To NumberOfRICs

There may be other errors in your example. These are just the two I caught at a quick glance.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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