Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1425
Real-Time Functions
posted

Hi All,

I'm looking at implementing support for real-time functions in an application e.g. a function that takes a market index and returns the latest value for that index, from Bloomberg or simillar. This function could then be applied to a new column in a grid to give real-time values for the corresponding market index (from another column in the grid).

Writing a custom CalcFunction to get the latest price wouldn't be a problem. But is there a way to allow the function to effectively broadcast a new value for a cell when the value for that index changes?

One idea I have is to make use of the dirty flag for each formula provider in the CalcManager and extend the CalcFunction class. My thinking is I could achieve my the desired affect by having the extended CalcFunction react to the new information available and flag any formula providers that use this function as dirty - causing the CalcManager to refresh the values.

So my questions are:

  1. Is there a nice way to achieve this?
  2. If there isn't a nice way, does my solution sound plausible?

Any help will, as always, be greatly appreciated.

Cheers,

Richard

Parents
  • 469350
    Offline posted

    Hi Richard,

    It seems to me like the simplest way to do this would be to use a NamedReference. What you would do is add a NamedReference to the NamedReferences collection of the UltraCalcManager. Name it whatever you like. then simply set the formula on this NamedReference to a literal value representing the market index any time it changes.The advantage of this approach is that you only change the formula when the value actually changes and this will automatically trigger the recalculation of any formulas in your application that are using the NamedReference.

    Or, another option would be to create your own UltraCalcFunction. There's a sample of how do create your own functions in a function library. There's a property on the UltraCalcFunction which you can override to tell it that it is always dirty. This is how the Time function works. But this is less efficient than the first approach, since this type of function will always be recalculating whether it has changed or not.

Reply Children
No Data