示例#1
0
        private async Task <IEnumerable <IndexHistoryData> > GetByBoardgroup(Boardgroup bg)
        {
            var result = new List <IndexHistoryData>();
            var from   = DateTime.MinValue;
            var secId  = bg.Securities.First();
            var data   = Array.Empty <IndexHistoryData>();

            do
            {
                var url = _config.PrepareUrl(bg.Id, secId, new Dictionary <string, string>
                {
                    ["from"]  = from.ToString("yyyy-MM-dd"),
                    ["limit"] = "100",
                });

                try
                {
                    data = await _httpClientService.Get <IndexHistoryData[]>(url, _config.ObjectPath);

                    result.AddRange(data);
                    if (data.Length > 0)
                    {
                        from = data.Max(h => h.TRADEDATE).AddDays(1);
                    }
                }
                catch (ServiceResponseException ex)
                {
                    Logger.LogError(
                        ex,
                        "{secId} history data not found. Url: {url}",
                        secId,
                        url);
                    break;
                }
            } while (data.Length > 0);

            return(result);
        }
示例#2
0
 public TypedBoardgroup(string type, Boardgroup bg)
 {
     Type       = type;
     Id         = bg.Id;
     Securities = bg.Securities;
 }