public void ZeroReturn()
        {
            EMAEcoIndexManager emaManager = new EMAEcoIndexManager();

            List <TickerFormattedDto> tickers = new List <TickerFormattedDto>
            {
                new TickerFormattedDto
                {
                    ExchangeType = ExchangeTypeEnum.Cex,
                    High         = 100,
                    Last         = -100,
                    Low          = 100,
                    PairType     = ExchangePairTypeEnum.ETH_BTC,
                    Time         = DateTime.Now,
                    Volume       = 100
                }
            };

            EcoIndex lastEMA = new EcoIndex
            {
                Id    = EcoIndexEnum.EMA,
                Name  = "BTC_ETH",
                Time  = DateTime.Now,
                Value = -110
            };

            decimal Ema = emaManager.CalculateEma(tickers, lastEMA);

            Assert.AreEqual(0M, Ema);
        }
Exemple #2
0
 public CexMarketManager()
 {
     _cexApiClient            = new CexApiClient(ConfigurationProvider.GetConfigurationByName(ConfigurationNameHolder.CexApiUrl, ""));
     _elasticClient           = new ElasticDatabaseClient(ConfigurationProvider.GetConfigurationByName(ConfigurationNameHolder.ElasticApiUrl, ""), ElasticApiUrlHolder.ExchangeName.CEX);
     _coinMonitoringApiClient = new CoinMonitoringApiClient(ConfigurationProvider.GetConfigurationByName(ConfigurationNameHolder.CoinMonitoringApi, ""));
     _rsiManager = new RSIEcoIndexManager(ElasticApiUrlHolder.ExchangeName.CEX);
     _emaManager = new EMAEcoIndexManager(ElasticApiUrlHolder.ExchangeName.CEX);
     _forceIndexEcoIndexManager = new ForceIndexEcoIndexManager(ElasticApiUrlHolder.ExchangeName.CEX);
 }
        public void WithNotEnoughData()
        {
            EMAEcoIndexManager emaManager = new EMAEcoIndexManager();

            List <TickerFormattedDto> tickers = new List <TickerFormattedDto>
            {
            };

            EcoIndex lastEMA = null;

            decimal Ema = emaManager.CalculateEma(tickers, lastEMA);

            Assert.AreEqual(0M, Ema);
        }