示例#1
0
        void RunOptimization()
        {
            SimInputData input = new SimInputData();
            input.ReadStartDate = new DateTime(1990, 1, 1);
            input.StartDate = new DateTime(2001, 1, 1);
            input.EndDate = new DateTime(2011, 5, 1);
            input.EndDate = DateTime.Now;
            input.InitInvestAmount = 1000000000; // 100억
            GeneralOptimizer strategy = new GeneralOptimizer("", input);
            strategy.Build();

            for (int i = 0; i < 40; ++i)
            {
                double kospiWeight = 1 + 0.1 * i;

                //const String kAdjName = "DeltaVolEqIrAdj_result";
                //const String kAdjName = "DeltaVolBaseEqIrAdj_result";
                const String kAdjName = "DeltaVolEqIrAggrAdj_result";
                //const String kAdjName = "DeltaVolBaseEqIrAggrAdj_result";

                ExcelAdjustment adj = new ExcelAdjustment(
                    String.Format("{0}.xlsx", kAdjName), "Sheet1", kospiWeight);
                strategy.AddAdjustment(adj, String.Format("kAdjName ({0:n2})", kospiWeight));

            }

            List<IResultHandler> resultHandlers = new List<IResultHandler>();
            //resultHandlers.Add(new CsvOutHandler());
            resultHandlers.Add(this);

            Experiment experiment = new Experiment(strategy, resultHandlers);
            experiment.Run();
        }
示例#2
0
        void RunMixUp()
        {
            SimInputData input = new SimInputData();
            input.ReadStartDate = new DateTime(1990, 1, 1);
            input.StartDate = new DateTime(2001, 1, 1);
            input.EndDate = new DateTime(2011, 5, 1);
            //input.EndDate = DateTime.Now;
            input.InitInvestAmount = (long)100 * 100000000;

            DefaultStrategy strategy = new DefaultStrategy("", input);
            strategy.SetBaseAlloc(new StaticAlloc("SA", 0.33, 0.33, 0.34));
            strategy.Build();

            DollarPriceAdjustment dollarPriceAdj = new DollarPriceAdjustment(0.9);
            KrxCreditDepositRateAdjustment cdAdj = new KrxCreditDepositRateAdjustment(new CreditPolicyWithMA(1.5));
            KrxCreditDepositRateAdjustment cdAdj2 = new KrxCreditDepositRateAdjustment(new CreditPolicyWithUpDownMA(1.5));
            MaeKoVolAdjustment maeAdj = new MaeKoVolAdjustment(1.2);
            MaeBokRateAdjustment maeBokRateAdj = new MaeBokRateAdjustment(new BokRatePolicy_Static(), 1.0);
            MacroAA_Adjustment macroAA_Adj = new MacroAA_Adjustment();

            strategy.AddAdjustment(cdAdj2, "CD2");
            strategy.AddAdjustment(maeAdj, "MaeKoVol");
            strategy.AddAdjustment(maeBokRateAdj, "MaeBokRate");
            strategy.AddAdjustment(macroAA_Adj, "MacroAA");

            ExcelAdjustment deltaVol_Adj = new ExcelAdjustment("DeltaVolEqIrAdj_result.xlsx", "Sheet1", 1.5);
            strategy.AddAdjustment(deltaVol_Adj, "DeltaVolEqIr");

            //ExcelAdj deltaVolBase_Adj = new ExcelAdj("DeltaVolBaseEqIrAdj_result.xlsx", "Sheet1", 1.5);
            //strategy.AddAdjustment(deltaVolBase_Adj, "DeltaVolBaseEqIr");

            //ExcelAdj deltaVolAggr_Adj = new ExcelAdj("DeltaVolEqIrAggrAdj_result.xlsx", "Sheet1", 1.0);
            //strategy.AddAdjustment(deltaVolAggr_Adj, "DeltaVolEqIrAggr");

            //ExcelAdj deltaVolBaseAggr_Adj = new ExcelAdj("DeltaVolBaseEqIrAggrAdj_result.xlsx", "Sheet1", 1.5);
            //strategy.AddAdjustment(deltaVolBaseAggr_Adj, "DeltaVolBaseEqIrAggr");

            List<IResultHandler> resultHandlers = new List<IResultHandler>();
            //resultHandlers.Add(new CsvOutHandler());
            resultHandlers.Add(this);

            Experiment experiment = new Experiment(strategy, resultHandlers);
            experiment.Run();
        }