private PriceAlert ScanObject(Stock monitorObject) { //get current price double curPrice = InternetReader.ReadCurrentPrice(monitorObject.Symbol); if (curPrice == -1) { return(null); } //load current 30/70 price. RSIPredict predict = _monitorRepo.LoadRSIPredict(monitorObject.Symbol); if (predict == null) { return(null); } if (monitorObject.InPossession && curPrice >= predict.PredictRsi70Price) { return(new PriceAlert { Symbol = monitorObject.Symbol, Price = curPrice, TargetPrice = predict.PredictRsi70Price, Buy = false }); } if (!monitorObject.InPossession && curPrice <= predict.PredictRsi30Price) { return(new PriceAlert { Symbol = monitorObject.Symbol, Price = curPrice, TargetPrice = predict.PredictRsi30Price, Buy = true }); } return(null); }
public void CanReadCurrentPrice() { double price = InternetReader.ReadCurrentPrice("AAPL"); Assert.IsTrue(price != 0); }