static TicksFactory CreateFactory(string symbol) { TicksFactory result = new TicksFactory(); string path = Config.QuoteDirectory + "\\" + symbol; string[] files = Directory.GetFiles(path); foreach (var element in files) { if (element.Contains("2010")) { result.LoadDukas(element); Console.WriteLine("{0} has been loaded", element); } } Console.WriteLine("factory is preparing..."); result.Prepare(); Console.WriteLine("factory is prepared..."); return(result); }
private static void Run(string path, StreamWriter stream) { Console.WriteLine(path); TicksFactory factory = new TicksFactory(); factory.LoadDukas(path); factory.Prepare(); List <KeyValuePair <DateTime, double> > bids = factory.Bids; List <KeyValuePair <DateTime, double> > asks = factory.Asks; int count = bids.Count; double average = 0; for (int index = 0; index < count; ++index) { average += (bids[index].Value + asks[index].Value) / 2; } average /= count; string name = Path.GetFileNameWithoutExtension(path); string st = string.Format("{0} = {1}", name, average); stream.WriteLine(st); }