public async Task GetName_ValidSymbol_ReturnsName() { var name = await _downloadService.GetName(_stock); Assert.IsFalse(string.IsNullOrEmpty(name)); StringAssert.StartsWith("Cap", name); }
public async Task FullTest(int numberOfHiddenLayers, int numberOfNeurons) { _stock.Name = await _downloadService.GetName(_stock); _stock.HistoricalData = await _downloadService.GetHistoricalData(_stock, _startDate, refresh : true); _trainingSession = new TrainingSession(_portfolio, _stock) { NumberAnns = 5000, NumberHiddenLayers = numberOfHiddenLayers, NumberNeuronsPerHiddenLayer = numberOfNeurons, TrainSamplePercentage = 0.55 }; var timer = new Stopwatch(); timer.Start(); _trainingSession.PropertyChanged += (sender, args) => { if (args.PropertyName == "BestProfitLossCalculator" && timer.ElapsedMilliseconds > 7000) { Trace.Write($"\n{_trainingSession.AllNetworksPLsStdDevs.Count:N0}"); Trace.Write($" -> PL: {_trainingSession.BestProfitLossCalculator.PL:C2}"); Trace.Write($" ({_trainingSession.BestProfitLossCalculator.PLPercentage:P2})"); Trace.Write($" | median: {_trainingSession.AllNetworksPL:C2}"); Trace.Write($" | acc: {_trainingSession.BestProfitLossCalculator.PercentageWinningTransactions:P2}"); Trace.Write($" | study1: {_trainingSession.BestPrediction.BuyLevel}"); Trace.Write($" | study2: {_trainingSession.BestPrediction.SellLevel}"); timer.Restart(); } }; _trainingSession.FindBestAnn(new CancellationToken(), new NeuralStockSettings()); Console.Write("PL: {0:C2}", _trainingSession.BestProfitLossCalculator.PL); Console.Write(" ({0:P2})", _trainingSession.BestProfitLossCalculator.PLPercentage); Console.Write(" | median: {0:C2}", _trainingSession.AllNetworksPL); Console.Write(" | acc: {0:P2}", _trainingSession.BestProfitLossCalculator.PercentageWinningTransactions); Assert.Pass(); }