Esempio n. 1
0
        public void RunTryAndError()
        {
            double investAmount = AdjTradingResultTable.kDefaultInvestAmount;

            this._result.Clear();

            while (true)
            {
                if (_generator.IsOver())
                {
                    break;
                }

                if (_generator.CurCaseNum == 0)
                {
                    logger.Info("Skip Case 0");
                }
                else
                {
                    Tuple<String, List<List<IAdjLogic>>> adjs = _generator.Peek();
                    AdjTradingInput input = CreateInput(adjs.Item1, adjs.Item2, investAmount);
                    AdjTradingField tf = new AdjTradingField(_from, _until);
                    AdjTradingResultTable resultTable = tf.ExecuteSimulation(input);

                    ResultSummaryData summary = new ResultSummaryData(
                        String.Format("Case {0}, '{1}'", _generator.CurCaseNum, input.Key), resultTable);
                    logger.Info(summary.ToString());
                    _result.Add(summary.Key, summary);

                    this.Invoke(new AddNewResult(UpdateUI), new object[] { });
                }
                _generator.Advance();
            }
        }
Esempio n. 2
0
        public static void RunTryAndError()
        {
            logger.Info("Run Try and error");

            DateTime from = new DateTime(1990, 1, 1);
            DateTime until = DateUtil.GetDate(DateTime.Now);

            List<IAdjLogic> adjSet1 = CreateAdjSet1();
            List<IAdjLogic> adjSet3 = CreateCbrAdjSet(from, until);

            AdjCaseGenerator generator = new AdjCaseGenerator();
            generator.Append("dummy", adjSet1);
            generator.Append("cbr", adjSet3);

            double investAmount = AdjTradingResultTable.kDefaultInvestAmount;

            List<ResultSummaryData> summaries = new List<ResultSummaryData>();

            while (true)
            {
                if (generator.IsOver())
                {
                    break;
                }

                if (generator.CurCaseNum == 0)
                {
                    logger.Info("Skip Case 0");
                }
                else
                {
                    Tuple<String, List<List<IAdjLogic>>> adjs = generator.Peek();
                    AdjTradingInput input = CreateInput(adjs.Item1, adjs.Item2, investAmount);
                    AdjTradingField tf = new AdjTradingField(from, until);
                    AdjTradingResultTable resultTable = tf.ExecuteSimulation(input);

                    ReportTub reportTub = CreateReportTub();
                    reportTub.CreateReport(resultTable);

                    ResultSummaryData summary = new ResultSummaryData(
                        String.Format("Case {0}, '{1}'", generator.CurCaseNum, input.Key), resultTable);
                    logger.Info(summary.ToString());

                    summaries.Add(summary);
                }

                generator.Advance();
            }

            ResultSummaryAnalyzer analyzer = new ResultSummaryAnalyzer();
            analyzer.SetSummaries(summaries);

            logger.Info("Finished");
        }
Esempio n. 3
0
        public static void RunMono()
        {
            DateTime from = new DateTime(1990, 1, 1);
            DateTime until = DateUtil.GetDate(DateTime.Now);
            double investAmount = AdjTradingResultTable.kDefaultInvestAmount;

            AdjTradingInput input = CreateInput(investAmount);
            AdjTradingField tf = new AdjTradingField(from, until);
            AdjTradingResultTable resultTable = tf.ExecuteSimulation(input);

            ReportTub reportTub = CreateReportTub();
            reportTub.CreateReport(resultTable);

            ResultSummaryData summary = new ResultSummaryData("test1", resultTable);
            logger.Info(summary.ToString());
        }