static void Main(string[] args) { var options = new CommandLineOptions(); if (Parser.Default.ParseArguments(args, options)) { DownloadQuotes(options); } }
private static void DownloadQuotes(CommandLineOptions options) { var kernel = new StandardKernel(new DownloaderModule(options)); ContractSpecification contractSpecification; var service = kernel.Get<IService>(); service.Download += Inform; IEnumerable<Market> markets; if (options.Symbol.ToLowerInvariant() == "all") { markets = service.GetWeeklyDataForAllSymbols(); } else if (ContractSpecification.TryParse(options.Symbol, out contractSpecification)) { markets = new Market(contractSpecification, service.GetWeeklyData(contractSpecification.Symbol)).AsCollection(); } else { WriteWrongMarketMessage(); return; } kernel.Get<FormatterFactory>().Create().Format(markets); }
public DownloaderModule(CommandLineOptions options) { _options = options; }