Help Center Blog Open An Account

Update own variables in real-time when invoke comes R API

Hello guys!
I’m a little bit new in programmin. Now trying to write some simple software with C# with R API and have a big problem.Maybe someone knows how to solve it. The Rithmic Support doesn’t help me after more then 10 letters to them. Always saying that they don’t understand me or something like “Use Visual Studio” to create your software while I was asking on “how to use their functions”.

The problem is, that now I’m trying to “broadcast” the single price of BestAskQuote into the Console (SampleMD from the R API). It’s not a problem to edit sample method like BestAskQuote and use Console.Write in it. But the problem is, that I want to “broadcast” my own variables. For example, I’m creating the public variable myOwnAsk, then I’m putting it in that method and setting it by this:

public double myOwnAsk;

        public override void BestAskQuote(AskInfo oInfo)
        {
            aaPrice = oInfo.Price;
       }

As I already know, this method (BestAskQuote) invokes only when the information changes - this is from the manual:
Subscriptions using this flag will cause [RCallbacks::BestAskQuote()], [RCallbacks::BestBidAskQuote()], and/or [RCallbacks::BestBidQuote()] to be invoked when data is received from the infrastructure.

It uses the next function in the code:
oEngine.subscribe(sExchange, sSymbol, SubscriptionFlags.Best, null);

So, it uses REngine:subscribe method to “broadcast” the data.
All I want, is to use my own variable (myOwnAsk) and “broadcast” or stream it only when this native subscribe method goes. So I need to create the analogue of it.
Because if now I’m trying to Console.Write(myOwnAsk) it shows me only once and doesn’t have more Prints. I tried to do it via “while” -> it starts to firing without any updates…

So, just what I need (I think) is to copy that “subscribe” invokes to “stream” the specified quote of the instrument I choose.

Who can help me with it, please? I just want to build a simple app which will show me the current Quotes and Updates on it. Firstly it will be Console app, then - non-console. Thank you guys!

After some time in the coding and experiments I can restructure my question. I see that there is

            oEngine.subscribe(sExchange, sSymbol, SubscriptionFlags.Best, null);

which represents the “subscription” or something like Event OnUpdate… I need to catch it and catch all the data from this function and then set that data to my own variables.