Announcement

Collapse
No announcement yet.

No Data WIth C#

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • No Data WIth C#

    I have a C# application that was getting market data from a different source that worked fine. I changed the quote feed to eSignal using your Multiple History Sample in C# as a guide.

    I can check entitlements and register symbols but none of the events ever fire.

    I then converted your Multiple History Sample to VS 2005 and ran that. It didn't receive any evets either. Is there something else I need to do to get the events to fire?

  • #2
    I am assuming that you are using a valid eSignal account with ActiveX Development entitlement in conjunction with the Multiple History Sample in C#. isEntitled() should return non-zero.

    To be able to obtain events in the .Net 2005 environment,
    you have to use the "Start without Debugging" option when executing your project.

    Comment


    • #3
      I'm using .net 2005 with ActiveX, and the events work most of the time. Sometimes however, an event just doesn't arrive. I have to clear the symbol to get the feed going again. Strange things start to happen after this that look very much like memory corruption problems.

      There appears to be some weakness, probably related to ActiveX and .net Interop.

      Comment


      • #4
        Visual Studio 2005 (.Net framework 2.0) is not officically supported by the Desktop API. We recommend using Visual Studio 2003 (.Net framework 1.1) or Visual Studio 6.0 at the moment.

        Comment


        • #5
          I use VS2005 and have some problems with getting events from several symbols.
          This is the source of my C# app:

          public void Start()
          {
          _Esignal = new IESignal.HooksClass();
          _Esignal.OnBarsReceived += new IESignal._IHooksEvents_OnBarsReceivedEventHandler( esignal_OnBarsReceived);
          _Esignal.OnBarsChanged += new IESignal._IHooksEvents_OnBarsChangedEventHandler(e signal_OnBarsReceived);
          _Esignal.OnQuoteChanged += new IESignal._IHooksEvents_OnQuoteChangedEventHandler( esignal_OnSymbolChanged);
          _Esignal.OnSymbolChanged += new IESignal._IHooksEvents_OnSymbolChangedEventHandler (esignal_OnSymbolChanged);
          }

          private void esignal_OnBarsReceived (int lHandle)
          {
          if (_Esignal.get_GetNumBars(lHandle) > 0)
          {
          IESignal.BarData bd = _Esignal.get_GetBar(lHandle, 0);
          // Working code: display bid/ask
          }
          }

          private void esignal_OnSymbolChanged (string symbol)
          {
          int lHandle = _Esignal.get_RequestHistory(symbol, "1", IESignal.barType.btBARS, 20, 0, 0);
          if (_Esignal.get_GetNumBars(lHandle) > 0)
          {
          IESignal.BarData bd = _Esignal.get_GetBar(lHandle, 0);
          // Working code: display bid/ask
          }
          }

          But not all symbols generates this events even if there bid/ask changes. For example "GBP@GAIN A0-FX". It does not generate any ivent, but when I run nex code manually:

          int lHandle = _Esignal.get_RequestHistory(symbol, "1", IESignal.barType.btBARS, 20, 0, 0);
          if (_Esignal.get_GetNumBars(lHandle) > 0)
          IESignal.BarData bd = _Esignal.get_GetBar(lHandle, 0);

          I see that bid/ask have changed.

          Please clearfy how to hadle change bid/ask event for this symbol.

          Comment


          • #6
            Hi Vitaly,

            As Anthony mentioned, Visual Studio 2005 (.Net framework 2.0) is not officically supported for use with the Desktop API. We recommend using Visual Studio 2003 (.Net framework 1.1) or Visual Studio 6.0 at the moment.

            Comment


            • #7
              I re-created my project in VS2003, but result is still the same...

              Several symbols do not fire events when bid and ask change.

              Do you need additional info about my project or additional source fragments to help me to solve the problem?

              Comment


              • #8
                Hello,

                Based on your code below, it looks like you are only handling OnBarsReceived and OnSymbolChanged. You need to handle all possible events related to the request you made. It looks like you set up handlers for them, but don't actually process them.

                If you are still having difficulties after implementing these please email support directly.

                Comment


                • #9
                  Thank you for your reply, but I handling all 4 possible events:
                  OnBarsReceived, OnBarsChanged, OnQuoteChanged and OnSymbolChanged.

                  Based on the code below, I use the same metod esignal_OnBarsReceived as a handler for 2 events OnBarsReceived and OnBarsChanged. Also I use the same metod esignal_OnSymbolChanged as a handler for 2 events OnQuoteChanged and OnSymbolChanged. I can do this because the event handlers for those events have equal arguments.
                  I implemented it as 4 different methods first, but the result was the same.

                  What another cause of the issue could you mention?

                  Comment


                  • #10
                    Thank for your help!

                    I add all 4 separate hendlers and now it seems to work well.

                    Sorry for trouble and thank you very much.

                    Comment


                    • #11
                      No, the cause was not in 4 separate event handlers!

                      I'm still studying it, but could you answer the question: wat is the range of "history handle" value in OnBarsReceived and OnBarsChanged events? And what this value means?

                      Thank you again.

                      Comment


                      • #12
                        The problem is that if I create history cach (execute RequestHistory function) for more than 50-53 symbols, I receive ivents from only 50-53 symbols. If the list of symbols is smaller than 50, everything works ok.

                        I execute RequestHistory next way:

                        HistoryHandle = _Esignal.get_RequestHistory(Symbol, "1", IESignal.barType.btBARS, 50, -1, -1);

                        What is wrong in my code?

                        Comment


                        • #13
                          You definitely need to process all 4 events, so do continue to do that.

                          I'm not quite clear on your last question. Can you give an example?

                          Comment


                          • #14
                            This is my task:

                            I have an array of symbols I need to monitor.

                            I subscribe to all 4 events from eSignal:
                            _Esignal = new HooksClass();
                            _Esignal.OnBarsReceived += new _IHooksEvents_OnBarsReceivedEventHandler(OnBarsRec eived);
                            _Esignal.OnBarsChanged += new _IHooksEvents_OnBarsChangedEventHandler(OnBarsChan ged);
                            _Esignal.OnQuoteChanged += new _IHooksEvents_OnQuoteChangedEventHandler(OnQuoteCh anged);
                            _Esignal.OnSymbolChanged += new _IHooksEvents_OnSymbolChangedEventHandler(OnSymbol Changed);

                            After that I execute get_RequestHistory function for each symbol to receive HistoryHandle value for every symbol:
                            _HistoryHandle = _Esignal.get_RequestHistory(_Symbol, "1", barType.btBARS, 5, -1, -1);
                            I successfully receive and store these values.

                            After that I begin to receive OnBarsReceived and OnBarsChanged events with HistoryHandle as arguments. By this HistoryHandle I detect with symbol fired those event.

                            So the problem is:
                            When my list of symbols is less than 50 symbols - everything works correct. But when my list is more than 50 symbols - several symbols do not fire events. Nevertheless I definitely know that bid/ask of these symbols changes.
                            My observation is that 50 arbitrary symbols of my list fire events, but oll other do not fire.

                            I implemented rough solution for now: I run 2 instances of my app and divide my list of symbols into 2 lists with less than 50 symbols. But it's unacceptable solution for me in future, I need one app to monitor all my 70-80 symbols.

                            Also after sereval hours of work these 2 apps begin to constantly throw "Unable to cast COM object of type IESignal.HookClass. The operation failed because the QueryInterface call on the COM component for the interface with IID {...}" exception and only one way to avoid this is to restart apps. It seems this exception occures only when there are 2 instances of my app working.

                            Please help me to solve these problems ASAP.

                            Comment


                            • #15
                              One more specification: calls of HookClass methods begin to throw exception after several hours of application work even when only one instance of the app works.

                              Full text of the exception is
                              Unable to cast COM object of type 'IESignal.HooksClass' to interface type 'IESignal.IHooks'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{C5916B45-A7EB-4919-A742-AD47AE3AE996}' failed due to the following error: System call failed. (Exception from HRESULT: 0x80010100 (RPC_E_SYS_CALL_FAILED)).

                              Comment

                              Working...
                              X