public static async Task <IEnumerable <(BfProductCode ProductCode, string Symbol)> > GetAvailableMarketsAsync(this BitFlyerClient client, CancellationToken ct) { var result = new List <(BfProductCode ProductCode, string Symbol)>(); foreach (var task in client.GetMarketsAllAsync(ct)) { var markets = (await task).GetContent(); foreach (var market in markets) { if (market.ProductCode.StartsWith("BTCJPY")) { if (string.IsNullOrEmpty(market.Alias)) { continue; // ******** BTCJPY future somtimes missing alias, skip it ******** } result.Add(((BfProductCode)Enum.Parse(typeof(BfProductCode), market.Alias.Replace("_", "")), market.ProductCode)); } else { result.Add(((BfProductCode)Enum.Parse(typeof(BfProductCode), market.ProductCode.Replace("_", "")), market.ProductCode)); } } } return(result.Distinct(e => e.ProductCode)); }