Announcement

Collapse
No announcement yet.

Time and Sales Tick Download

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

  • Time and Sales Tick Download

    The Time and sales download is not working using the active X.

    I can't find any time and sales download code in the C example.

    I'm using the following delphi code:

    filter.sSymbol:=symbol;
    filter.bQuotes:=0;
    filter.bTrades:=1;
    filter.lNumDays:=10;
    filter.bFilterPrice:=0;
    filter.bFilterVolume:=0;
    filter.bFilterTradeExchanges:=0;
    filter.bFilterQuoteExchanges:=0;
    timeAndSale:=Hooks1.RequestTimeSales[filter];
    store(timeAndSale,symbol);

    the store function is not called, the program fires the event before and I cannot get the handle back and associate it with a symbol. I found a workaround for this issue but after it gets worse...

    The data that comes back in the event is garbage, and the event is called many time until I get an esignal "Not enough storage is available to complete this operation" exception.

    I hope the esignal 7.6 beta will solve my issue. Anyway maybe somebody found the solution with 7.5.
    Last edited by nedibe; 01-29-2004, 08:18 AM.

  • #2
    I use the time and sales everyday in my C++ app and have never received a "Not enough storage is available to complete this operation" exception. You might want to watch the memory usage in the Task Manager to see if your RAM is getting maxed out. Or, I suppose it could be hard drive space to cache the incoming data. Things to check anyway.

    The issue regarding the premature event has been reportedly fixed for the next release.

    Cheers... George

    Comment


    • #3
      Hi Georges,

      Could you copy paste your requesttimeandsales C++ code and the code inside the time and sales event so I can convert it in delphi pascal and test it.

      Thanks,
      Nick

      Comment


      • #4
        Here you go. I hate ripping out code as it takes it out of context, but here is the gist of it...

        Cheers... George

        Code:
        bool CESignalConv::RequestTimeSales(LPCTSTR symbol, long numDays, bool bQuotes, bool bTrades, long& resultHandle)
        {
        	TimeSalesFilter filter;
        	filter.bFilterPrice = false;
        	filter.bFilterQuoteExchanges = false;
        	filter.bFilterTradeExchanges = false;
        	filter.bFilterVolume = false;
        	filter.bQuotes = bQuotes;
        	filter.bTrades = bTrades;
        	filter.lNumDays = numDays;
        	filter.sSymbol = S2B(symbol);
        
        	bool bResult = false;
        	if (m_piHooks) {
        		HRESULT hr = (*m_piHooks)->get_RequestTimeSales(&filter, &resultHandle);
        		if (SUCCEEDED(hr)) {
        			bResult = true;
        		}
        	}
        	return bResult;
        }
        
        void CESignalConv::ES_OnTimeSalesChanged(long lHandle)
        {
        	FillTicks(lHandle, true, g_bLoadHistoryTicks);
        }
        
        void CESignalConv::FillTicks(long lHandle, bool bRTTicks, bool bHistoricTicks)
        {
        	CTickArray* pta = m_TickArrays[lHandle];
        	if (pta == NULL) return;
        
        	long numbars = (*m_piHooks)->GetGetNumTimeSalesBars(lHandle);
        	if (numbars == 0) return;
        
        	int rtbarCount = (*m_piHooks)->GetGetNumTimeSalesRtBars(lHandle);
        	int historicBars = numbars - rtbarCount;
        
        	///*** Bunch of stuff snipped from here on out
        	// I changed the loop here to retrieve ALL ticks just for example.
        	// In the "real" version of this function, my app actually only 
        	// requests the ticks it hasn't already copied into its own tick buffer
        	for (int barIdx = -numbars + 1; barIdx <= 0; ++barIdx) {
        		TimeSalesData ts = (*m_piHooks)->GetGetTimeSalesBar(lHandle, barIdx);
        		// Convert and store the ticks in my apps own special way
        		CopyTickInfo(ts, &pta->m_Ticks[tickindex++]);
        	}
        }

        Comment


        • #5
          I use this code but the if (SUCCEEDED(hr)) fails, What is wrong??
          when will the esignal 7.6 beta be available??

          void MainDialog::OnBnClickedButton1()
          {
          // TODO: Add your control notification handler code here
          TimeSalesFilter filter;
          filter.bFilterPrice = false;
          filter.bFilterQuoteExchanges = false;
          filter.bFilterTradeExchanges = false;
          filter.bFilterVolume = false;
          filter.bQuotes = true;
          filter.bTrades = true;
          filter.lNumDays = 1;
          filter.sSymbol = S2B("ES H4");

          if (m_piHooks) {
          HRESULT hr = (*m_piHooks)->get_RequestTimeSales(&filter, &resultHandle);
          if (SUCCEEDED(hr)) {
          AfxMessageBox("Sucess",MB_OK,0);
          }
          }
          }

          Comment


          • #6
            Did you call SetApplication("yourUserName") before attempting this? And, I assume you have added the ActiveX control usage to your eSignal account already? Are you calling CoInitialize() in your programs startup code?

            BTW, you could try using the more minimal call like this:

            Code:
            lHandle = (*m_piHooks)->GetRequestTimeSales(&filter);
            I just wrapped in the HRESULT stuff while I was testing.

            I don't know when the 7.6 beta will be released, but I have read that it should be very soon (week or so)? At least that was the plan last I heard.

            Comment


            • #7
              Still does not work...

              Could you post a c++ example for time and sales in the file section? the cactivex example does not include one...

              I could find out if it's my code or my config who does not work...

              Comment


              • #8
                I'll see what I can whip up. I don't want to post my whole app, so I'll try and piece together a new C++ time and sales project when I get a chance.

                Comment


                • #9
                  OK. Here is a quick and dirty app that grabs time and sales and updates the display in realtime. Just run it, put in your username and the symbol you want data for, then click "Get Data". If you want to change symbols, you will need to quit and restart the app. How's that for non-user friendly.

                  Cheers... George
                  Attached Files

                  Comment


                  • #10
                    It Works!!!

                    It works!!!

                    You rule!!!!!

                    Comment


                    • #11
                      Now that's what I like to hear.

                      Comment

                      Working...
                      X