Exemple #1
0
        public bool GetSeries(DateTime start, DateTime end, Equity equity, DataFeed.DataType dataType, out TA.PriceVolumeSeries series)
        {
            string symbol = equity.Symbol;
            bool result = false;
            series = null;

            do
            {
                int size = (int)Math.Round((end - start).TotalDays);
                if (size <= 0)
                {
                    break;
                }

                // preallocate some memory
                series = new TA.PriceVolumeSeries(size);

                string url;
                result = buildURL(symbol, start, end, dataType, out url);
                if (!result)
                {
                    break;
                }

                Console.WriteLine("Get data from URL " + url + " between " + start + " and " + end);

                HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(url);

                HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse();

                Stream readStream = httpResponse.GetResponseStream();

                result = fillDataArray(readStream, series);
            }
            while (false);

            return result;
        }