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");
        }
Beispiel #2
0
        public static AdjCaseGenerator CreateGenerator(DateTime from, DateTime until)
        {
            List<IAdjLogic> adjSet1 = CreateAdjSet1();
            List<IAdjLogic> adjSet2 = CreateCbrAdjSet(from, until);
            List<IAdjLogic> adjSet3 = CreateVolAdjSet(from, until);
            List<IAdjLogic> adjSetKrw = CreateUsdXxxSet();
            List<IAdjLogic> adjSetNzd = CreateUsdXxxSet2();

            AdjCaseGenerator generator = new AdjCaseGenerator();
            //generator.Append("dummy", adjSet1);
            generator.Append("cbr", adjSet2);
            //generator.Append("vol", adjSet3);
            generator.Append("usdkrw", adjSetKrw);
            generator.Append("usdnzd", adjSetNzd);

            return generator;
        }