コード例 #1
0
        private void SaveEMAValue(decimal EMAValue, ExchangePairTypeEnum pairTypeEnum)
        {
            if (EMAValue == 0)
            {
                return;
            }

            Domain.Dtos.EcoIndex.EcoIndex ecoIndex = new Domain.Dtos.EcoIndex.EcoIndex
            {
                Id    = EcoIndexEnum.EMA,
                Name  = ResolvePairTypeName(pairTypeEnum),
                Time  = DateTime.Now,
                Value = EMAValue
            };

            _elasticClient.SaveEcoIndexData(ecoIndex);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        private string ResolvePairTypeName(ExchangePairTypeEnum pairTypeEnum)
        {
            switch (pairTypeEnum)
            {
            case ExchangePairTypeEnum.BTC_USD:
                return("btc_usd");

            case ExchangePairTypeEnum.ETH_USD:
                return("eth_usd");

            case ExchangePairTypeEnum.ETH_BTC:
                return("eth_btc");

            case ExchangePairTypeEnum.ETH_EUR:
                return("eth_eur");

            case ExchangePairTypeEnum.BTC_EUR:
                return("btc_eur");
            }

            return("unknown");
        }
コード例 #4
0
        private Domain.Dtos.EcoIndex.EcoIndex GetLastEmaValue(ExchangePairTypeEnum exchangePairTypeEnum)
        {
            List <Domain.Dtos.EcoIndex.EcoIndex> ecoIndex = _elasticClient.GetLastEcoIndex(_exchangeName.ToString().ToLower() + "_eco_index", EcoIndexEnum.EMA, ResolvePairTypeName(exchangePairTypeEnum));

            return(ecoIndex?.FirstOrDefault());
        }
コード例 #5
0
        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);
        }