Announcement

Collapse
No announcement yet.

RequestHistory - no history

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

  • RequestHistory - no history

    I am trying to get an application working (based on the MultipleHistorySample) that will let me get the 'close' value on today's and yesterday's activity.

    I am using the RequestHistory API call as follows:

    info.historyHandle =
    esignal.get_RequestHistory(info.symbol, "D", IESignal.barType.btDAYS, 4, 0, 0);

    Sometimes I get zero bars received, sometimes 1, and sometimes more than one.

    1. Why zero bars? I noticed code in the sample that checks for this.
    2. When one bar is returned, it is dated with today's date. Everything looks OK when this happens.
    3. When more than one bar, there is NEVER any data in bars 1 to n. dClose is always zero. The date formats out to 12/30/1899 12:00:00.

    What I need is today's and yesterday's (i.e. last market day available), so that I can find the difference. This will allow me to calculate how my position has changed.

    The DDE syntax of =WINROS|Last!'NG V6', etc. is working fine in Excel; however, my application is in C#.Net. .Net no longer supports DDE; so, I must get a C# (or VB.Net) solution.

    Thanks,

    Gary
    GaryES

  • #2
    Have you tried using XMLGetBasicQuote instead?

    This will give you an XML string with some tags such as "Last" and "PrevClose"

    Comment


    • #3
      Suggestion worked wonderfully

      Thanks Dion,

      I had a chance this weekend to try the XML based call - works great - thanks again.

      For anyone interested in the implementation, here is the snippet of code in my program that replaced the old code that didn't work:


      //-Ask for the XML quote data---------------------------------
      string sXML = eSignal.XMLGetBasicQuote(sSymbol);

      //-Convert the XML stream into an XML document--------
      XmlDocument xmldoc = new XmlDocument();
      xmldoc.LoadXml(sXML);

      //-Get desired data from the child nodes--------------------
      XmlNode oParent = xmldoc.SelectSingleNode("Quote");
      XmlNode oChild;

      oChild = oParent.SelectSingleNode("Last");
      m_Last = Decimal.Parse(oChild.InnerText);

      oChild = oParent.SelectSingleNode("PrevClose");
      m_Close = Decimal.Parse(oChild.InnerText);

      oChild = oParent.SelectSingleNode("Change");
      m_Change = Decimal.Parse(oChild.InnerText);

      Hope this helps.

      Gary
      GaryES

      Comment

      Working...
      X