예제 #1
0
 internal static void Clear()
 {
     UserCommandManager.commands.Clear();
     if (UserCommandManager.Cleared != null)
     {
         UserCommandManager.Cleared(typeof(UserCommandManager), EventArgs.Empty);
     }
 }
예제 #2
0
        public static void Send(string strategy, string text)
        {
            UserCommand command = new UserCommand(strategy, new OpenQuant.API.UserCommand(DateTime.Now, text));

            UserCommandManager.commands.Add(command);
            if (UserCommandManager.NewCommand != null)
            {
                UserCommandManager.NewCommand(typeof(UserCommandManager), new UserCommandEventArgs(command));
            }
        }
예제 #3
0
        public void Online(bool resetState)
        {
            if (resetState)
            {
                this.stops.Clear();
            }
            DataRequests dataRequests = (DataRequests)null;

            if (resetState)
            {
                dataRequests = this.BuildStrategyRequest();
                OpenQuant.API.Strategy.Global.Clear();
            }
            if (resetState)
            {
                UserCommandManager.Clear();
            }
            if (resetState)
            {
                this.strategyLogManager.Clear();
            }
            foreach (StrategyRunner strategyRunner in this.strategies.Values)
            {
                if (strategyRunner.Enabled)
                {
                    strategyRunner.Portfolio.TransactionAdded += new TransactionEventHandler(this.Portfolio_TransactionAdded);
                }
                if (resetState)
                {
                    strategyRunner.DataRequests       = dataRequests;
                    strategyRunner.StartDate          = this.startDate;
                    strategyRunner.StopDate           = this.stopDate;
                    strategyRunner.Cash               = this.cash;
                    strategyRunner.MetaPortfolio      = this.portfolio;
                    strategyRunner.StrategyLogManager = this.strategyLogManager;
                }
                strategyRunner.Online(resetState);
            }
            this.Connect();
        }