예제 #1
0
        /// <summary>
        /// 下载日线
        /// </summary>
        public bool doDownloadDayLine()
        {
            try
            {
                showBeginMessage("开始下载日线...");
                //读取下载日线命令文件
                String   filename = FileUtils.GetDirectory() + "download.cmd";
                String[] lines    = File.ReadAllLines(filename);

                //分析命令
                CommandContext     context     = new CommandContext();
                CommandInterpreter interpreter = new CommandInterpreter(filename, context);
                interpreter.Parse();

                //执行命令
                interpreter.Execute();

                showResultMessage("下载日线完成");


                return(true);
            }
            catch (Exception e)
            {
                showResultMessage("下载日线失败,任务终止执行", -1, e.Message);
                return(false);
            }
        }
예제 #2
0
        public bool doEntrust()
        {
            try
            {
                showBeginMessage("开始委托交易");
                //读取下载日线命令文件
                String filename = FileUtils.GetDirectory() + "entrust.cmd";


                //准备环境
                CommandContext   context = new CommandContext();
                List <TradeInfo> entrust = new List <TradeInfo>();
                if (sellEntrust.Count > 0)
                {
                    entrust.AddRange(sellEntrust);
                }
                if (buyEntrust.Count > 0)
                {
                    entrust.AddRange(buyEntrust);
                }
                context.PutExternalValue("entrust", entrust);

                //执行命令
                CommandInterpreter interpreter = new CommandInterpreter(filename, context);
                interpreter.Parse();
                interpreter.Execute();

                showResultMessage("委托完成");


                return(true);
            }
            catch (Exception e)
            {
                showResultMessage("委托失败,任务终止执行", -1, e.Message);
                return(false);
            }
        }
예제 #3
0
    public static void Main()
    {
        var interpreter = new CommandInterpreter(new NationsBuilder());

        interpreter.Execute();
    }
예제 #4
0
 public static void Main()
 {
     CommandInterpreter.Execute();
 }
예제 #5
0
    public static void Main()
    {
        var interpreter = new CommandInterpreter();

        interpreter.Execute();
    }