public string GetTimeSeriesRaw(string ric,
                                       string startDate,
                                       string endDate,
                                       Interval?interval = Interval.daily,
                                       IEnumerable <TimeSeriesField> fields = null,
                                       int?count         = null,
                                       Calendar?calendar = null,
                                       Corax?corax       = null)
        {
            string[] formats = { "yyyy-MM-dd", "yyyy-MM-ddTHH:mm:ss", "yyyy-MM-ddTHH:mm:sszzz" };
            DateTime expectedDate;

            if (!DateTime.TryParseExact(startDate, formats, null, DateTimeStyles.None, out expectedDate))
            {
                EikonException error = new EikonException(HttpStatusCode.BadRequest, "Unsupported start Date Format. (yyyy-MM-dd, yyyy-MM-ddTHH:mm:SS, or yyyy-MM-ddTHH:mm:SSzzz");
                _logger?.LogError(error.Message);
                error.Source = "TimeSeries";
                throw (error);
            }
            if (!DateTime.TryParseExact(endDate, formats, null, DateTimeStyles.None, out expectedDate))
            {
                EikonException error = new EikonException(HttpStatusCode.BadRequest, "Unsupported end Date Format. (yyyy-MM-dd, yyyy-MM-ddTHH:mm:SS, or yyyy-MM-ddTHH:mm:SSzzz");
                _logger?.LogError(error.Message);
                error.Source = "TimeSeries";
                throw (error);
            }
            if (fields != null)
            {
                if (fields.Contains(TimeSeriesField.TIMESTAMP) == false)
                {
                    List <TimeSeriesField> temp = fields.ToList();
                    temp.Insert(0, TimeSeriesField.TIMESTAMP);

                    fields = temp;
                }
            }
            TimeSeriesRequest request = new TimeSeriesRequest
            {
                rics = new List <string> {
                    ric
                },
                fields    = fields?.ToList(),
                startdate = startDate,
                enddate   = endDate,
                interval  = interval,
                calendar  = calendar,
                corax     = corax,
                count     = count
            };


            var response = SerializeAndSendRequest <TimeSeriesRequest>(request);

            return(response);
        }
        public string GetTimeSeriesRaw(string ric,
                                       DateTime startDate,
                                       DateTime endDate,
                                       Interval?interval = Interval.daily,
                                       IEnumerable <TimeSeriesField> fields = null,
                                       int?count         = null,
                                       Calendar?calendar = null,
                                       Corax?corax       = null)
        {
            if (fields != null)
            {
                if (fields.Contains(TimeSeriesField.TIMESTAMP) == false)
                {
                    List <TimeSeriesField> temp = fields.ToList();
                    temp.Insert(0, TimeSeriesField.TIMESTAMP);

                    fields = temp;
                }
            }
            TimeSeriesRequest request = new TimeSeriesRequest {
                rics = new List <string> {
                    ric
                },
                fields    = fields?.ToList(),
                startdate = startDate.Kind == DateTimeKind.Utc ? startDate.ToString("yyyy-MM-ddTHH:mm:ssZ") : startDate.ToString("yyyy-MM-ddTHH:mm:sszzz"),
                enddate   = endDate.Kind == DateTimeKind.Utc ? endDate.ToString("yyyy-MM-ddTHH:mm:ssZ") : endDate.ToString("yyyy-MM-ddTHH:mm:sszzz"),
                interval  = interval,
                calendar  = calendar,
                corax     = corax,
                count     = count
            };


            var response = SerializeAndSendRequest <TimeSeriesRequest>(request);

            return(response);
            //if (response == null) return null;


            //return JsonConvert.DeserializeObject<TimeSeriesResponse>(response, new JsonSerializerSettings
            //{
            //    Error = HandleDeserializationError
            //});
        }