コード例 #1
0
        public Indicator AnalyzeData(DataState state)
        {
            List <double> closePrices = _analyseRepo.LoadClosePriceBySymbol(state.Symbol, true).ToList();

            RSIPredict value = new RSIPredict();

            value.Symbol            = state.Symbol;
            value.Date              = state.Last.Value;
            value.PredictRsi30Price = RSICalculator.PredictPrice(RSICalculator.Period, 30, closePrices);
            value.PredictRsi50Price = RSICalculator.PredictPrice(RSICalculator.Period, 50, closePrices);
            value.PredictRsi70Price = RSICalculator.PredictPrice(RSICalculator.Period, 70, closePrices);

            return(value.ToIndicator());
        }
コード例 #2
0
        public void CanSerializeToXml_RSIPredict()
        {
            var source = new RSIPredict
            {
                Symbol            = "A",
                Date              = DateTime.Today,
                PredictRsi30Price = 1.0,
                PredictRsi50Price = 2.0,
                PredictRsi70Price = 3.0,
            };

            var i = source.ToIndicator();

            var target = EntityHelper.DeserializeFromXml <RSIPredict>(i.Data);

            Assert.IsTrue(source.Symbol == target.Symbol);
            Assert.IsTrue(source.Date == target.Date);
            Assert.IsTrue(source.PredictRsi30Price == target.PredictRsi30Price);
            Assert.IsTrue(source.PredictRsi50Price == target.PredictRsi50Price);
            Assert.IsTrue(source.PredictRsi70Price == target.PredictRsi70Price);
        }