Exemple #1
0
        public void Start()
        {
            new List <TimeSpan> {
                FinancialTimeSpans.M1
            }.ForEach(timeFrame => {
                IBarsCreator creator = new BarsCreator(null, null, timeFrame, @"C:\quotes\EURUSD\Dukascopy\");
                string path          = new SeriesDescriptor()
                                       .InstrumentDescriptors.Single(x => x.Name == "EURUSD")
                                       .ProviderDescriptors.Single(x => x.Name == "Dukascopy")
                                       .Path;
                SeriesReader reader = new SeriesReader(path);
                DateTime dateTime;
                decimal ask, bid;
                int lastMonth = -1;
                while (reader.Next(out dateTime, out ask, out bid))
                {
                    creator.AddQuote(dateTime, ask);
#if _VERBOSE
                    if (dateTime.Month != lastMonth)
                    {
                        Console.WriteLine("{0} -> {1}/{2} -> {3}", dateTime, ask, bid, creator.BarsCount);
                        lastMonth = dateTime.Month;
                    }
#endif
                }
                creator.Finish();
            });
        }
Exemple #2
0
        public void TestMethod()
        {
            IBarsCreator creator = new BarsCreator(null, null, TimeSpan.FromMinutes(1), null);
            string       path    = new SeriesDescriptor()
                                   .InstrumentDescriptors.Single(x => x.Name == "EURUSD")
                                   .ProviderDescriptors.Single(x => x.Name == "Dukascopy")
                                   .Path;
            SeriesReader reader = new SeriesReader(path);
            DateTime     dateTime;
            decimal      ask, bid;

            while (reader.Next(out dateTime, out ask, out bid))
            {
                creator.AddQuote(dateTime, ask);
            }
        }
Exemple #3
0
        public List <IBar> ReadAll()
        {
            IBarsCreator creator = new BarsCreator(null, null, TimeSpan.FromMinutes(1), null);

            DateTime[] dateTimes;
            double[]   prices;
            ReadAll(out dateTimes, out prices);
            int count = prices.Count();

            if (count != dateTimes.Count())
            {
                throw new Exception("Wrong samples qty");
            }
            for (int i = 0; i < count; i++)
            {
                creator.AddQuote(dateTimes[i], (decimal)prices[i]);
            }
            return(creator.GetBars());
        }