Beispiel #1
0
        protected void debugMarketSimulationMaofWatchCallback(IWrite iWrite, string cmdName, object[] cmdArguments)
        {
            if (marketSimulationMaof == default(MarketSimulationMaof))             // check if there active simulation to get data from
            {
                iWrite.WriteLine("No active market simulations.");
                return;
            }
            if (watchlistCallback == null)             // create a watchlist callback in the first call
            {
                watchlistCallback = new WatchlistCallback(iWrite);
            }
            if (cmdArguments.Length == 2)
            {
                // argument is legend or list
                string legendList = cmdArguments[1].ToString();
                legendList = legendList.ToUpper();
                if (legendList.CompareTo("LEGEND") == 0)
                {
                    watchlistCallback.printLegend();
                }
                else if (legendList.CompareTo("LIST") == 0)
                {
                    watchlistCallback.printList();
                }
                else
                {
                    iWrite.WriteLine("Use commands legend or list");
                }
                return;
            }
            if (cmdArguments.Length < 3)
            {
                iWrite.WriteLine("At least two arguments are required");
                return;
            }
            int  id;
            bool res = FindSecurity(cmdName, out id);

            if (!res)
            {
                iWrite.WriteLine("Unknown security in the command " + cmdName);
                return;
            }

            // first argument is add or rmv
            string addRmv = cmdArguments[1].ToString();

            addRmv = addRmv.ToUpper();
            if (addRmv.CompareTo("ADD") == 0)
            {
                marketSimulationMaof.AddWatch(id, watchlistCallback.callback);
            }
            else
            {
                marketSimulationMaof.RemoveWatch(id);
            }
        }