Encog.App.Quant.Loader.Yahoo.YahooDownload.BuildURL C# (CSharp) Method

BuildURL() private static method

This method builds a URL to load data from Yahoo Finance for a neural network to train with.
private static BuildURL ( String ticker, System.DateTime from, System.DateTime to ) : Uri
ticker String The ticker symbol to access.
from System.DateTime The beginning date.
to System.DateTime The ending date.
return System.Uri
        private static Uri BuildURL(String ticker, DateTime from,
                             DateTime to)
        {
            // construct the URL
            var mstream = new MemoryStream();
            var form = new FormUtility(mstream, null);

            form.Add("s", ticker);
            form.Add("a", "" + (from.Month - 1));
            form.Add("b", "" + from.Day);
            form.Add("c", "" + from.Year);
            form.Add("d", "" + (to.Month - 1));
            form.Add("e", "" + to.Day);
            form.Add("f", "" + to.Year);
            form.Add("g", "d");
            form.Add("ignore", ".csv");
            mstream.Close();
            byte[] b = mstream.GetBuffer();

            String str = "http://ichart.finance.yahoo.com/table.csv?"
                         + StringUtil.FromBytes(b);
            return new Uri(str);
        }