public void TestSetup() { TradeSharpDictionary.Initialize(MoqTradeSharpDictionary.Mock); context = TestRobotUtil.GetRobotContextBacktest(new DateTime(2013, 12, 25), new DateTime(2013, 12, 25).AddDays(30)); bot = new VoidRobot(); bot.Graphics.Add(new Cortege2<string, BarSettings>("EURUSD", new BarSettings { StartMinute = 0, Intervals = new List<int> { 30 } })); bot.Initialize(context, CurrentProtectedContext.Instance); ExecutablePath.InitializeFake(string.Empty); context.SubscribeRobot(bot); context.InitiateTest(); // Инициализация дополнительных объектом, MOCK-и QuoteMaker.FillQuoteStorageWithDefaultValues(); }
private RobotContextBacktest MakeRobotContext(ACCOUNT accountData, List<BaseRobot> robots) { var timeFrom = testOnly ? accountData.TimeCreated : accountData.TimeCreated.AddMinutes(rand.Next(60*24*9)); try { var context = new RobotContextBacktest((tickers, end) => { }) { TimeFrom = timeFrom }; context.TimeFrom = timeFrom; context.TimeTo = endTime; context.AccountInfo = new Account { Currency = accountData.Currency, Group = accountData.AccountGroup, Balance = accountData.Balance, Equity = accountData.Balance, ID = accountData.ID }; foreach (var robot in robots) { context.SubscribeRobot(robot); robot.Initialize(context, CurrentProtectedContext.Instance); } context.InitiateTest(); return context; } catch (Exception ex) { Logger.Error("Error in MakeRobotContext()", ex); throw; } }