public void Setup() { var sunday = new LocalMarketHours(DayOfWeek.Sunday, new TimeSpan(17, 0, 0), TimeSpan.FromTicks(Time.OneDay.Ticks - 1)); var monday = LocalMarketHours.OpenAllDay(DayOfWeek.Monday); var tuesday = LocalMarketHours.OpenAllDay(DayOfWeek.Tuesday); var wednesday = LocalMarketHours.OpenAllDay(DayOfWeek.Wednesday); var thursday = LocalMarketHours.OpenAllDay(DayOfWeek.Thursday); var friday = new LocalMarketHours(DayOfWeek.Friday, TimeSpan.Zero, new TimeSpan(17, 0, 0)); var earlyCloses = new Dictionary <DateTime, TimeSpan>(); _exchangeHours = new SecurityExchangeHours(TimeZones.NewYork, USHoliday.Dates.Select(x => x.Date), new[] { sunday, monday, tuesday, wednesday, thursday, friday }.ToDictionary(x => x.DayOfWeek), earlyCloses); _liveTradingDataFeed = new TestableLiveTradingDataFeed(); var jobPacket = new LiveNodePacket() { DeployId = "", Brokerage = BrokerageName.OandaBrokerage.ToString(), DataQueueHandler = "LiveDataQueue" }; var algo = new BenchmarkAlgorithm(); _liveTradingDataFeed.Initialize(algo, jobPacket, new LiveTradingResultHandler(), new LocalDiskMapFileProvider(), null, new DefaultDataProvider()); algo.Initialize(); }
protected override void BenchmarkThreadRoutineStartSettup() { // sgminer extra settings AlgorithmType NHDataIndex = BenchmarkAlgorithm.NiceHashID; if (Globals.NiceHashData == null) { Helpers.ConsolePrint("BENCHMARK", "Skipping sgminer benchmark because there is no internet " + "connection. Sgminer needs internet connection to do benchmarking."); throw new Exception("No internet connection"); } if (Globals.NiceHashData[NHDataIndex].paying == 0) { Helpers.ConsolePrint("BENCHMARK", "Skipping sgminer benchmark because there is no work on Nicehash.com " + "[algo: " + BenchmarkAlgorithm.GetName() + "(" + NHDataIndex + ")]"); throw new Exception("No work can be used for benchmarking"); } _benchmarkTimer.Reset(); _benchmarkTimer.Start(); // call base, read only outpus //BenchmarkHandle.BeginOutputReadLine(); }
// killing proccesses can take time virtual public void EndBenchmarkProcces() { if (BenchmarkHandle != null && BenchmarkProcessStatus != BenchmarkProcessStatus.Killing && BenchmarkProcessStatus != BenchmarkProcessStatus.DoneKilling) { BenchmarkProcessStatus = BenchmarkProcessStatus.Killing; try { Helpers.ConsolePrint("BENCHMARK", String.Format("Trying to kill benchmark process {0} algorithm {1}", BenchmarkProcessPath, BenchmarkAlgorithm.GetName())); BenchmarkHandle.Kill(); BenchmarkHandle.Close(); } catch { } finally { BenchmarkProcessStatus = BenchmarkProcessStatus.DoneKilling; Helpers.ConsolePrint("BENCHMARK", String.Format("Benchmark process {0} algorithm {1} KILLED", BenchmarkProcessPath, BenchmarkAlgorithm.GetName())); //BenchmarkHandle = null; } } }