public static int FillBarRange(DateTime from, DateTime to, string symbol, string periodicity, string priceType) { _barList = new List <Bar>(); _barRange = DivideBars(_client.QueryQuoteHistoryBarsRange( new DateTime(from.Ticks, DateTimeKind.Utc), new DateTime(to.Ticks, DateTimeKind.Utc), symbol, periodicity, priceType.Equals("Ask") ? PriceType.Ask : PriceType.Bid)); _barIEnumerator = _barRange.GetEnumerator(); return(0); }
static void RequestBarsFiles(QuoteHistoryClient client, DateTime from, DateTime to, string symbol, string periodicity, PriceType priceType, bool verbose) { Stopwatch sw = new Stopwatch(); sw.Start(); int count = 0; foreach (var bar in client.QueryQuoteHistoryBarsRange(from, to, symbol, periodicity, priceType)) { count++; if (verbose) { Console.WriteLine(bar); } } long elapsed = sw.ElapsedMilliseconds; Console.WriteLine($"Elapsed = {elapsed}ms"); Console.WriteLine($"Throughput = {((double)count/(double)elapsed)*1000.0:0.#####} bars per second"); }