public static async Task <IEnumerable <WatchList> > GetWatchLists() { var retval = new List <WatchList>(); var listsReq = new WatchListsRequest(); IEnumerable <Watchlist> watchLists; try { watchLists = await listsReq.Execute(); foreach (var watchList in watchLists) { var listReq = new WatchListRequest(watchList.Id); var list = await listReq.Execute(); retval.Add(new WatchList { Name = watchList.Id, Tickers = new ObservableCollection <string>(list.Watchlist.Watchlistitem.OrderBy(t => t.Instrument.Sym).Select(t => t.Instrument.Sym).ToList()) }); } } catch (Exception ex) { ConsoleMessageLogger.Instance.Log("Error retrieving Watch Lists: " + ex.Message); } return(retval); }
private static async void GetWatchLists() { var listsReq = new WatchListsRequest(); var watchLists = await listsReq.Execute(); foreach (var watchList in watchLists) { var listReq = new WatchListRequest(watchList.Id); var list = await listReq.Execute(); Console.WriteLine(watchList.Id); Console.WriteLine(new string('-', watchList.Id.Length)); Console.WriteLine(string.Join("\n", list.Watchlist.Watchlistitem.OrderBy(c => c.Instrument.Sym).Select(c => c.Instrument.Sym))); } }