コード例 #1
0
        public static List<Price> GetHistoricalMINUTE_FromWEB(DateTime StartDate, DateTime EndDate, int TimeFrame, string ContractName)
        {
            string startdate = StartDate.ToString("yyyyMMdd");
            string endddate = EndDate.ToString("yyyyMMdd");

            string URL = "http://www.hisat.co.za/updater/minuteUpdate.aspx?Instrument=" + ContractName + "&StartDate=" + startdate + @"&EndDate=" + endddate + @"&Password=PieterF&Username=PFOUCHE&compression=" + TimeFrame;
            Debug.WriteLine(URL);

            List<Price> Data = new List<Price>();
            List<string> rawData = new List<string>();

            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(URL);
            req.AutomaticDecompression = DecompressionMethods.GZip;
            WebResponse resp = req.GetResponse();
            Stream s = resp.GetResponseStream();
            StreamReader sr = new StreamReader(s, Encoding.ASCII);

            while (sr.Peek() >= 0)
            {
                string _rawData = sr.ReadLine();
                if (!rawData.Contains(_rawData)) rawData.Add(_rawData);
            }

            foreach (string ss in rawData)
            {
                Price p = new Price();
                List<string> data = new List<string>(ss.Split(','));
                string date = data[0];

                int y = int.Parse(date.Substring(0, 4));
                int mm = int.Parse(date.Substring(4, 2));
                int d = int.Parse(date.Substring(6, 2));

                string time = data[1];
                int h = int.Parse(time.Substring(0, 2));
                int m = int.Parse(time.Substring(3, 2));


                p.TimeStamp = new DateTime(y, mm, d, h, m, 0);
                p.Open = int.Parse(data[2]);
                p.High = int.Parse(data[3]);
                p.Low = int.Parse(data[4]);
                p.Close = int.Parse(data[5]);
                p.Volume = int.Parse(data[6]);
                p.InstrumentName = ContractName;
                Data.Add(p);

            }

            return Data.DistinctBy(t => t.TimeStamp).ToList();

        }
コード例 #2
0
        private void stringtoPrice(string l)
        {

            var sp = l.Split(',');

            int day = int.Parse(sp[0].ToString().Substring(0, 2));
            int month = int.Parse(sp[0].ToString().Substring(3, 2));
            int year = int.Parse(sp[0].ToString().Substring(6, 4));
            int hour = int.Parse(sp[1].ToString().Substring(0, 2));
            int min = int.Parse(sp[1].ToString().Substring(3, 2));
            var open = double.Parse(sp[2].ToString());
            var high = double.Parse(sp[3].ToString());
            var low = double.Parse(sp[4].ToString());
            var close = double.Parse(sp[5].ToString());
            var vol = int.Parse(sp[6].ToString());

            AlsiUtils.Price p = new Price();
            DateTime dt = new DateTime(year, month, day, hour, min, 0);
            p.TimeStamp = dt.AddMinutes(-1);
            p.Open = open;
            p.High = high;
            p.Low = low;
            p.Close = close;
            p.Volume = vol;
            p.InstrumentName = "Hist";
            AllHisto.Add(p);



        }
コード例 #3
0
        private void SetOHLC_IntraTrade_SingleTradePL()
        {
            var tpl = new List<ProfitAlgoLayer.TakeProfitTrade>();
                 StreamWriter sr = new StreamWriter(@"d:\ohlcPL2.csv");
            int C = _CompletedTrades.Count;
            double totProfit = 0;
            double start = 0;
            var dc = new AlsiDBDataContext();
            var M = dc.OHLC_5_Minutes.ToList();
            for (int i = 1; i < C; i++)
            {
                var pl5 = from x in _FullTradeList
                          where x.TimeStamp >= _CompletedTrades[i].OpenTrade.TimeStamp && x.TimeStamp <= _CompletedTrades[i].CloseTrade.TimeStamp
                          select x;



                tpl = pl5.ToList();

                if (tpl.Count > 1)
                {


                    foreach (var v in tpl)
                    {
                        var f = M.Where(z => z.Stamp == v.TimeStamp).First();
                        var market = new Price(f.Stamp, f.O, f.H, f.L, f.C, f.Instrument);


                        start = tpl.First().TradedPrice;

                        double o = 0;
                        if (tpl[0].Reason == Trade.Trigger.OpenShort) o = (start - market.Open) ;
                        if (tpl[0].Reason == Trade.Trigger.OpenLong) o = (market.Open - start) ;

                        double h = 0;
                        if (tpl[0].Reason == Trade.Trigger.OpenShort) h = (start - market.High) ;
                        if (tpl[0].Reason == Trade.Trigger.OpenLong) h = (market.High - start) ;

                        double l = 0;
                        if (tpl[0].Reason == Trade.Trigger.OpenShort) l = (start - market.Low) ;
                        if (tpl[0].Reason == Trade.Trigger.OpenLong) l = (market.Low - start) ;

                        double c = 0;
                        if (tpl[0].Reason == Trade.Trigger.OpenShort) c = (start - market.Close) ;
                        if (tpl[0].Reason == Trade.Trigger.OpenLong) c = (market.Close - start) ;



                        var P = new Price();
                        P.TimeStamp = market.TimeStamp;
                        P.Open = o;
                        P.High = h;
                        P.Low = l;
                        P.Close = c;
                        if (v.TimeStamp == tpl.Last().TimeStamp)
                        {
                            totProfit += tpl.Last().RunningProfit;
                        }

                        OHLC_LIST.Add(P);

                        sr.WriteLine(P.TimeStamp.Date 
                            +","+P.TimeStamp
                         +","+v.Reason
                            + "," + P.Open                           
                            + "," + P.High
                                + "," + P.Low
                                 + "," + P.Close
                                  + "," + 0
                                  + "," + market.Open
                                   + "," + market.High
                                    + "," + market.Low
                                     + "," + market.Close
                                     + "," + totProfit

                                     );

                    }
                    //Debug.WriteLine(P.Close);
                    //	Debug.WriteLine(i + "," + (o + tpl[0].RunningTotalProfit_New) + "," + (h + tpl[0].RunningTotalProfit_New) + "," + (l + tpl[0].RunningTotalProfit_New) + "," + (c + tpl[0].RunningTotalProfit_New));
                    //	Debug.WriteLine(i + "," + P.Open + "," + "," + P.High + "," + P.Low + "," + P.Close);
                }
            }
             sr.Close();
        }
コード例 #4
0
            private static List<Price> convertTickToMinute(List<RawTick> TickData)
            {


                DateTime start = DateTime.Now;

                List<Price> minuteData = new List<Price>();

                List<double> open = new List<double>();
                List<double> close = new List<double>();
                List<DateTime> minuteRawTime = new List<DateTime>();
                List<double> low = new List<double>();
                List<double> high = new List<double>();



                //OPEN
                //DateTime start_open = DateTime.Now;
                foreach (var p in TickData)
                {
                    int yearT = p.Stamp.Value.Year;
                    int monthT = p.Stamp.Value.Month;
                    int dayT = p.Stamp.Value.Day;
                    int hourT = p.Stamp.Value.Hour;
                    int minuteT = p.Stamp.Value.Minute;

                    DateTime d = new DateTime(yearT, monthT, dayT, hourT, minuteT, 0);
                    if (!minuteRawTime.Contains(d))
                    {
                        minuteRawTime.Add(d);
                        open.Add((double)p.Price);
                    }
                }
                //DateTime finish_open = DateTime.Now;
                //TimeSpan duration_open = finish_open - start_open;
                //Debug.WriteLine("[OPEN] Convertion Time Ticks to Minutes : " + duration_open.Seconds + ":" + duration_open.Milliseconds);


                //CLOSE
                //DateTime start_close = DateTime.Now;
                TickData.Reverse();
                minuteRawTime.Clear();
                foreach (var p in TickData)
                {
                    int yearT = p.Stamp.Value.Year;
                    int monthT = p.Stamp.Value.Month;
                    int dayT = p.Stamp.Value.Day;
                    int hourT = p.Stamp.Value.Hour;
                    int minuteT = p.Stamp.Value.Minute;

                    DateTime d = new DateTime(yearT, monthT, dayT, hourT, minuteT, 0);
                    if (!minuteRawTime.Contains(d))
                    {
                        minuteRawTime.Add(d);
                        close.Add((double)p.Price);
                    }
                }
                //DateTime finish_close = DateTime.Now;
                //TimeSpan duration_close = finish_open - start_open;
                //Debug.WriteLine("[Close] Convertion Time Ticks to Minutes : " + duration_close.Seconds + ":" + duration_close.Milliseconds);



                //HIGH+LOW
                DateTime start_HL = DateTime.Now;
                close.Reverse();
                minuteRawTime.Reverse();
                TickData.Reverse();



                int ind = minuteRawTime.Count - 1;

                for (int x = 0; x <= ind; x++)
                {

                    int yy = minuteRawTime[x].Year;
                    int mm = minuteRawTime[x].Month;
                    int dy = minuteRawTime[x].Day;
                    int hh = minuteRawTime[x].Hour;
                    int mn = minuteRawTime[x].Minute;
                    int ss = minuteRawTime[x].Second;

                    DateTime dd = new DateTime(yy, mm, dy, hh, mn, ss);


                    double min = 100000;
                    double max = 1;
                    foreach (var p in TickData)
                    {
                        int yearT = p.Stamp.Value.Year;
                        int monthT = p.Stamp.Value.Month;
                        int dayT = p.Stamp.Value.Day;
                        int hourT = p.Stamp.Value.Hour;
                        int minuteT = p.Stamp.Value.Minute;


                        if (dd.Year == yearT && dd.Month == monthT && dd.Day == dayT && dd.Hour == hourT && dd.Minute == minuteT)
                        {
                            if (p.Price > max) max = (double)p.Price;
                            if (p.Price < min) min = (double)p.Price;
                        }

                    }
                    low.Add(min);
                    high.Add(max);

                }


                for (int x = 0; x <= ind; x++)
                {

                    //Debug.WriteLine(minuteRawTime[x] + " Open " + open[x] + " Close " + close[x] + " High " + high[x] + " Low " + low[x]);
                    Price m = new Price();
                    m.Close = close[x];
                    m.Open = open[x];
                    m.High = high[x];
                    m.Low = low[x];
                    m.TimeStamp = minuteRawTime[x];
                    minuteData.Add(m);
                }

                //DateTime finish_HL = DateTime.Now;
                //TimeSpan duration_HL = finish_HL - start_HL;
                //Debug.WriteLine("[HIGH LOW] Convertion Time Ticks to Minutes : " + duration_HL.Seconds + ":" + duration_HL.Milliseconds);

                //Debug.WriteLine(minuteData[0].TimeStamp + " Open : {0} High : {1} Low : {2}  Close : {3}", minuteData[0].Open, minuteData[0].High, minuteData[0].Low, minuteData[0].Close);



                DateTime finish = DateTime.Now;
                TimeSpan duration = finish - start;
                Debug.WriteLine("Convertion Time Ticks to Minutes : " + duration.Seconds + ":" + duration.Milliseconds);

                return minuteData;

            }
コード例 #5
0
 private static bool GetTimestampForPrice(Price price)
 {
     if (price.TimeStamp >= DateTime.Now.AddSeconds(-DateTime.Now.Second)) return true;
     return false;
 }
コード例 #6
0
        private void TickDataToXMinData()
        {
            AlsiUtils.AlsiDBDataContext dc = new AlsiDBDataContext();
            switch (_Interval)
            {
                case GlobalObjects.TimeInterval.Minute_2:
                    break;

                case GlobalObjects.TimeInterval.Minute_5:
                    dc.OHLC_5_Temp();
                    break;

                case GlobalObjects.TimeInterval.Minute_10:
                    break;
            }

            GlobalObjects.Points.Clear();
            foreach (var p in dc.OHLC_Temps)
            {
                var P = new Price()
                {
                    TimeStamp = p.Stamp,
                    Open = p.O,
                    High = p.H,
                    Low = p.L,
                    Close = p.C,
                    InstrumentName = _ContractName,
                };
                GlobalObjects.Points.Add(P);
            }


        }
コード例 #7
0
        static public List<Price> readDataFromDataBase_1_MIN_MasterMinute(int numberOfPeriods, bool reverseList)
        {
            try
            {
                List<Price> prices = new List<Price>();

                AlsiDBDataContext dc = new AlsiDBDataContext();
                dc.Connection.ConnectionString = AlsiUtils.Data_Objects.GlobalObjects.CustomConnectionString;


                var count = (from p in dc.MasterMinutes
                             select (p.Stamp)).Count();

                //Console.WriteLine("10 Minute Data Count : " + count);


                var result = from q in dc.MasterMinutes
                                         .Skip(count - numberOfPeriods)
                                         .Take(numberOfPeriods)
                             select new { q.Stamp, q.O, q.H, q.L, q.C, q.Instrument };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close = v.C;
                    p.Open = v.O;
                    p.High = v.H;
                    p.Low = v.L;
                    p.TimeStamp = v.Stamp;
                    p.InstrumentName = v.Instrument;
                    prices.Add(p);

                }

                if (reverseList) prices.Reverse();
                return prices;
            }
            catch (Exception ex)
            {
                Debug.WriteLine("readDataFromDataBase_10_MIN  Database Busy : " + ex.Message);
                return null;
            }
        }
コード例 #8
0
        static public List<Price> readDataFromDataBase(GlobalObjects.TimeInterval T, dataTable TD, DateTime Start, DateTime End, bool reverseList)
        {

            List<Price> prices = new List<Price>();

            AlsiDBDataContext dc = new AlsiDBDataContext();


            if (TD == dataTable.Temp)
            {
                var result = from q in dc.OHLC_Temps
                             where q.Stamp > Start && q.Stamp < End
                             select new { q.Stamp, q.O, q.H, q.L, q.C, };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close = v.C;
                    p.Open = v.O;
                    p.High = v.H;
                    p.Low = v.L;
                    p.TimeStamp = v.Stamp;
                    prices.Add(p);

                }
                dc.Clean_OHLC_Temp();
                if (reverseList) prices.Reverse();
                return prices;
            }

            if (TD == dataTable.AllHistory)
            {
                if (T == GlobalObjects.TimeInterval.Minute_2)
                {
                    var firstinDB = dc.OHLC_2_Minutes.AsEnumerable().First().Stamp;
                    var lastinDB = dc.OHLC_2_Minutes.AsEnumerable().Last().Stamp;
                    if (firstinDB > Start) dc.OHLC_2_AllHistory();
                    if (lastinDB > End) dc.OHLC_2_AllHistory();
                }
                if (T == GlobalObjects.TimeInterval.Minute_5)
                {
                    try
                    {
                        var firstinDB = dc.OHLC_5_Minutes.AsEnumerable().First().Stamp;
                        var lastinDB = dc.OHLC_5_Minutes.AsEnumerable().Last().Stamp;
                        if (firstinDB > Start) dc.OHLC_5_AllHistory();
                        if (lastinDB < End) dc.OHLC_5_AllHistory();
                    }
                    catch { dc.OHLC_5_AllHistory(); }

                }
                if (T == GlobalObjects.TimeInterval.Minute_10)
                {
                    var firstinDB = dc.OHLC_10_Minutes.AsEnumerable().First().Stamp;
                    var lastinDB = dc.OHLC_10_Minutes.AsEnumerable().Last().Stamp;
                    if (firstinDB > Start) dc.OHLC_10_AllHistory();
                    if (lastinDB < End) dc.OHLC_10_AllHistory();
                }
            }
            if (TD == dataTable.MasterMinute)
            {
                if (T == GlobalObjects.TimeInterval.Minute_2)
                {
                    var min2 = dc.OHLC_2_Minutes;
                    if (min2.Count() == 0)
                    {
                        dc.OHLC_2();
                    }
                    else
                    {
                        var firstinDB = dc.OHLC_2_Minutes.AsEnumerable().First().Stamp;
                        var lastinDB = dc.OHLC_2_Minutes.AsEnumerable().Last().Stamp;
                        if (firstinDB > Start) dc.OHLC_2();
                        if (lastinDB < End) dc.OHLC_2();
                    }
                }

                if (T == GlobalObjects.TimeInterval.Minute_5)
                {
                    var min5 = dc.OHLC_5_Minutes;
                    if (min5.Count() == 0)
                    {
                        dc.OHLC_5();
                    }
                    else
                    {
                        var firstinDB = min5.AsEnumerable().First().Stamp;
                        var lastinDB = min5.AsEnumerable().Last().Stamp;
                        if (firstinDB > Start) dc.OHLC_5();
                        if (lastinDB < End) dc.OHLC_5();
                    }
                }

                if (T == GlobalObjects.TimeInterval.Minute_10)
                {
                    var min10 = dc.OHLC_10_Minutes;
                    if (min10.Count() == 0)
                    {
                        dc.OHLC_10();
                    }
                    else
                    {
                        var firstinDB = dc.OHLC_10_Minutes.AsEnumerable().First().Stamp;
                        var lastinDB = dc.OHLC_10_Minutes.AsEnumerable().Last().Stamp;
                        if (firstinDB > Start) dc.OHLC_10();
                        if (lastinDB < End) dc.OHLC_10();
                    }
                }

                if (T == GlobalObjects.TimeInterval.Hour_1)
                {
                   dc.OHLC_Hour_1();
                }
            }





            if (T == GlobalObjects.TimeInterval.Minute_2)
            {
                var result = from q in dc.OHLC_2_Minutes
                             where q.Stamp > Start && q.Stamp < End
                             select new { q.Stamp, q.O, q.H, q.L, q.C, q.Instrument };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close = v.C;
                    p.Open = v.O;
                    p.High = v.H;
                    p.Low = v.L;
                    p.TimeStamp = v.Stamp;
                    p.InstrumentName = v.Instrument;
                    prices.Add(p);

                }
            }

            if (T == GlobalObjects.TimeInterval.Minute_5)
            {
                var result = from q in dc.OHLC_5_Minutes
                             where q.Stamp > Start && q.Stamp < End
                             select new { q.Stamp, q.O, q.H, q.L, q.C, q.Instrument };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close = v.C;
                    p.Open = v.O;
                    p.High = v.H;
                    p.Low = v.L;
                    p.TimeStamp = v.Stamp;
                    p.InstrumentName = v.Instrument;
                    prices.Add(p);

                }
            }
            if (T == GlobalObjects.TimeInterval.Minute_10)
            {
                var result = from q in dc.OHLC_10_Minutes
                             where q.Stamp > Start && q.Stamp < End
                             select new { q.Stamp, q.O, q.H, q.L, q.C, q.Instrument };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close = v.C;
                    p.Open = v.O;
                    p.High = v.H;
                    p.Low = v.L;
                    p.TimeStamp = v.Stamp;
                    p.InstrumentName = v.Instrument;
                    prices.Add(p);

                }
            }

            if (T == GlobalObjects.TimeInterval.Hour_1)
            {
                var result = from q in dc.OHLC_1_Hours 
                             where q.Stamp > Start && q.Stamp < End
                             select new { q.Stamp, q.O, q.H, q.L, q.C, q.Instrument };

                foreach (var v in result)
                {
                    Price p = new Price();
                    p.Close = v.C;
                    p.Open = v.O;
                    p.High = v.H;
                    p.Low = v.L;
                    p.TimeStamp = v.Stamp;
                    p.InstrumentName = v.Instrument;
                    prices.Add(p);

                }
            }




            if (reverseList) prices.Reverse();
            return prices;


        }
コード例 #9
0
        public static List<Price> GetHistoricalTICK_FromWEB(DateTime StartDate, DateTime EndDate, string ContractName)
        {
            List<Price> Data = new List<Price>();

            try
            {
                string startdate = StartDate.ToString("yyyyMMdd");
                string endddate = EndDate.ToString("yyyyMMdd");
                string URL = "http://www.hisat.co.za/updater/tickUpdate.aspx?Instrument=" + ContractName + "&StartDate=" + startdate + @"&EndDate=" + endddate + @"&Password=PieterF&Username=PFOUCHE";                
                List<string> rawData = new List<string>();
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(URL);
                req.AutomaticDecompression = DecompressionMethods.GZip;
                WebResponse resp = req.GetResponse();
                Stream s = resp.GetResponseStream();
                StreamReader sr = new StreamReader(s, Encoding.ASCII);

                while (sr.Peek() >= 0)
                {
                    string _rawData = sr.ReadLine();
                    if (!rawData.Contains(_rawData)) rawData.Add(_rawData);
                }
                
                for (int x = 0; x < rawData.Count; x++)
                {
                    Price p = new Price();
                    List<string> data = new List<string>(rawData[x].Split(','));
                    string date = data[0];

                    int y = int.Parse(date.Substring(0, 4));
                    int mm = int.Parse(date.Substring(4, 2));
                    int d = int.Parse(date.Substring(6, 2));

                    string time = data[1];
                    int h = int.Parse(time.Substring(0, 2));
                    int m = int.Parse(time.Substring(3, 2));
                    int ss = int.Parse(time.Substring(6, 2));

                    p.TimeStamp = new DateTime(y, mm, d, h, m, ss, 0);
                    p.Close = int.Parse(data[2]);
                    p.Volume = int.Parse(data[3]);
                    
                    Data.Add(p);
                }

                int countMili = 0;
                for (int x = 0; x < Data.Count - 1; x++)
                {
                    if (Data[x + 1].TimeStamp.Second == Data[x].TimeStamp.Second)
                    {
                        countMili++;
                        Data[x].TimeStamp = Data[x].TimeStamp.AddMilliseconds(countMili);
                    }
                    else                  
                    {
                        countMili++;
                        Data[x].TimeStamp = Data[x].TimeStamp.AddMilliseconds(countMili);
                        countMili = -1;
                    }

                }
                Data[Data.Count - 1].TimeStamp = Data[Data.Count - 1].TimeStamp.AddMilliseconds(100);
                return Data;

            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                return Data;
            }


        }
コード例 #10
0
        public Trade()
        {
            Extention = new Data_Objects.RegressionExt();
            OHLC = new Price();

        }
コード例 #11
0
        public static List<Price> getPriceFromXML(FileInfo file, string InstrumentCode)
        {
            List<DateTime> datum = new List<DateTime>();
            List<int> open = new List<int>();
            List<int> high = new List<int>();
            List<int> low = new List<int>();
            List<int> close = new List<int>();
            List<int> volume = new List<int>();
            List<Price> p = new List<Price>();

            #region Messy

            using (XmlReader reader = XmlReader.Create(file.FullName))
            {
                while (reader.Read())
                {
                    // Only detect start elements.
                    if (reader.IsStartElement())
                    {
                        //Timestamp		
                        if (reader.Name == "Date")
                        {
                            {
                                string attribute_date = reader["Date"];
                                if (attribute_date != null)
                                {
                                    Debug.WriteLine("  Has attribute name: " + attribute_date);
                                }
                                // Next read will contain text.
                                if (reader.Read())
                                {
                                    string ds = reader.Value.Trim();
                                    DateTime d = DateTime.Parse(ds);
                                    datum.Add(d);
                                }
                            }
                        }

                        //OPEN
                        if (reader.Name == "Open")
                        {
                            string attribute_open = reader["Open"];
                            if (attribute_open != null)
                            {
                                Debug.WriteLine("  Has attribute name: " + attribute_open);
                            }
                            // Next read will contain text.
                            if (reader.Read())
                            {
                                string o = reader.Value.Trim();
                                open.Add(int.Parse(o));

                            }
                        }

                        //HIGH
                        if (reader.Name == "High")
                        {
                            string attribute_high = reader["High"];
                            if (attribute_high != null)
                            {
                                Debug.WriteLine("  Has attribute name: " + attribute_high);
                            }
                            // Next read will contain text.
                            if (reader.Read())
                            {
                                string h = reader.Value.Trim();
                                high.Add(int.Parse(h));
                            }
                        }

                        //LOW
                        if (reader.Name == "Low")
                        {
                            string attribute_low = reader["Low"];
                            if (attribute_low != null)
                            {
                                Debug.WriteLine("  Has attribute name: " + attribute_low);
                            }
                            // Next read will contain text.
                            if (reader.Read())
                            {
                                string l = reader.Value.Trim();
                                low.Add(int.Parse(l));
                            }
                        }

                        //CLOSE
                        if (reader.Name == "Close")
                        {
                            string attribute_close = reader["Close"];
                            if (attribute_close != null)
                            {
                                Debug.WriteLine("  Has attribute name: " + attribute_close);
                            }
                            // Next read will contain text.
                            if (reader.Read())
                            {
                                string c = reader.Value.Trim();
                                close.Add(int.Parse(c));
                            }
                        }





                        //VOLUME
                        if (reader.Name == "Volume")
                        {
                            string attribute_vol = reader["Volume"];
                            if (attribute_vol != null)
                            {
                                Debug.WriteLine("  Has attribute name: " + attribute_vol);
                            }
                            // Next read will contain text.
                            if (reader.Read())
                            {
                                string v = reader.Value.Trim();
                                volume.Add(int.Parse(v));
                            }
                        }


                    }

                }

            }
            #endregion



            for (int x = 0; x < datum.Count; x++)
            {
                var pp = new Price
                {
                    TimeStamp = datum[x],
                    Open = open[x],
                    High = high[x],
                    Low = low[x],
                    Close = close[x],
                    Volume = volume[x],
                    InstrumentName = InstrumentCode
                };
                p.Add(pp);
            }

            return p;
        }