protected IRestResponse HandleElasticResponse(IRestResponse response) { if (response.StatusCode == HttpStatusCode.OK || response.StatusCode == HttpStatusCode.Created) { _Logger.DebugFormat($"Elastic save completed for {_exchangeName.ToString()} Method: {response.Request.Method}"); } else { _Logger.ErrorFormat($"Error happened trying to do action [{_exchangeName.ToString()}] data error: [{response.Content}]"); } return(response); }
private List <TickerFormattedDto> LoadTickerFormattedDtos(ExchangePairTypeEnum exchangePairTypeEnum) { GetFormattedDataRequest tickerRequest = new GetFormattedDataRequest { From = DateTime.Now.AddMinutes(-25), To = DateTime.Now, PatterName = _exchangeName.ToString().ToLower() + "_formatted", PairType = (int)exchangePairTypeEnum, ExchangeType = _exchangeName == ElasticApiUrlHolder.ExchangeName.CEX ? 1 : 2, Size = 25 }; GetFormattedDataResponse response = _elasticClient.GetFormattedTickers(tickerRequest); List <TickerFormattedDto> tickers = response?.hits?.hits?.Select(r => r._source).ToList(); return(tickers); }
private List <Domain.Dtos.EcoIndex.EcoIndex> GetLastEmaValues(ExchangePairTypeEnum exchangePairTypeEnum) { List <Domain.Dtos.EcoIndex.EcoIndex> ecoIndexes = _elasticClient.GetLastEcoIndex(_exchangeName.ToString().ToLower() + "_eco_index", EcoIndexEnum.EMA, ResolvePairTypeName(exchangePairTypeEnum), 2); return(ecoIndexes); }