C# = Retrieving yahoo historical prices

Discussion in 'Trading Software' started by Batman28, Nov 17, 2006.


  1. I follow most of this. I have a question about the

    resultsGrid.DataSource = historicalData;

    Do I need to initialize resultsGrid, or include a header or something to use that object?

    -uncleTom
     
    #11     Dec 5, 2006
  2. I just dropped a DataGridView component from the toolbox on the form and gave it a name (resultsGrid). No initialization or headers required. The only code I added to the form is the code in my earlier post.

    I did this in Visual C# community edition. My first piece of C# code ever...you've been warned.

    Oh, the other bit of code was the OHLC class. Something like this:

    Code:
    class OHLC
        {
            private string date;
            private string open;
            private string high;
            private string low;
            private string close;
    
            public OHLC(string date, string open, string high, string low, string close)
            {
                this.date = date;
                this.open = open;
                this.high = high;
                this.low = low;
                this.close = close;
            }
    
            public string Date
            {
                get { return date; }
            }
    
            public string Open
            {
                get { return open; }
            }
    
            public string High
            {
                get { return high; }
            }
    
            public string Low
            {
                get { return low; }
            }
    
            public string Close
            {
                get { return close; }
            }
    
        }
    
    Note: everything is a string. No datatype conversions etc. and no Volume property which you'd probably want to add.

    If I knew I was going to get so many questions about this (PMs) I would have saved the code!
     
    #12     Dec 5, 2006
  3. Mojo,

    Big help, thanks a bunch. Good luck with your automation stuff by the way. I'm sort of "climbing that same ladder". Going to a lot of interviews in Chicago, looking for a entry position.


    ANyway - first time with C#. Seems like you can do a lot of stuff like Vb.net. I'm going to read up on the diff. within in C++.

    Thanks again
    -chris
     
    #13     Dec 6, 2006