public DefaultStrategy(String strategyName, SimInputData input) { this.StrategyName = strategyName; this.Input = input; this._allocBase = new StaticAlloc(); this._opSet = new OperationSet(); this._adjustment = new DummyAdjustment(); }
public AssetRateCalculator(IAlloc alloc, List<IAdj> adjs, SimInputData inputData, MixupRule rule) { Trace.Assert(alloc != null); Trace.Assert(adjs != null); Trace.Assert(inputData != null); this.Alloc = alloc; this.Adjs = adjs; this.InputData = inputData; this.Rule = rule; }
public SimCase(String name, IAlloc alloc, List<IAdj> adjs, SimInputData inputData, MixupRule rule, MarketDataSet marketData) { Trace.Assert(name != null); Trace.Assert(alloc != null); Trace.Assert(adjs != null); Trace.Assert(inputData != null); Trace.Assert(marketData != null); this.Name = name; this.Alloc = alloc; this.Adjs = adjs; this.InputData = inputData; this.Rule = rule; this.Calculator = new AssetRateCalculator(alloc, adjs, inputData, rule); this.MarketData = marketData; }
public static MarketDataSet GetMarketDataSet(SimInputData input) { List<MarketData> l = new List<MarketData>(); MarketData mdKospiFuture = DataUtil.LoadDataAndAddToList("KM1 R:00_0_R Index", input.StartDate, input.EndDate, l); MarketData mdBond = DataUtil.LoadDataAndAddToList("KE1 R:00_0_R Comdty", input.ReadStartDate, input.EndDate, l); MarketData mdDollar = DataUtil.LoadDataAndAddToList("KU1 R:00_0_R Curncy", input.ReadStartDate, input.EndDate, l); MarketData mdKrxCreditDepositRate = DataUtil.LoadDataAndAddToList("KrxCreditDepositRate", input.ReadStartDate, input.EndDate, l); MarketData mdUsdKrwCurncy = DataUtil.LoadDataAndAddToList("USDKRW Curncy", input.ReadStartDate, input.EndDate, l); MarketData mdBokRate = DataUtil.LoadDataAndAddToList("KORP7D Index", input.ReadStartDate, input.EndDate, l); MarketData mdKospiIndex = DataUtil.LoadDataAndAddToList("KOSPI Index", input.ReadStartDate, input.EndDate, l); MarketData mdKtbSpotRate = DataUtil.LoadDataAndAddToList("KOTB3YR Index", input.ReadStartDate, input.EndDate, l); MarketData mdCycleLeadingIndex = DataUtil.LoadDataAndAddToList("SKLILY Index", input.ReadStartDate, input.EndDate, l); MarketData mdConsumerPriceIndex = DataUtil.LoadDataAndAddToList("KOCPI Index", input.ReadStartDate, input.EndDate, l); List<MarketData> alignedData = DataUtil.FillByPivotData(mdKospiFuture, l); Boolean arranged = DataUtil.IsArrangedDateAndIndex(alignedData); Trace.Assert(arranged); //Set data MarketDataSet data = new MarketDataSet(); data.Add(MarketDataSetKey.KospiFuture, alignedData[0]); data.Add(MarketDataSetKey.KtbFuture, alignedData[1]); data.Add(MarketDataSetKey.DollarFuture, alignedData[2]); data.Add(MarketDataSetKey.KrxCreditDepositRate, alignedData[3]); data.Add(MarketDataSetKey.DollarSpot, alignedData[4]); data.Add(MarketDataSetKey.BokRate, alignedData[5]); data.Add(MarketDataSetKey.KospiSpot, alignedData[6]); data.Add(MarketDataSetKey.KtbSpot, alignedData[7]); data.Add(MarketDataSetKey.CycleLeadingIndex, alignedData[8]); data.Add(MarketDataSetKey.ConsumerPriceIndex, alignedData[9]); data.RegisterPivotData(alignedData[0]); return data; }
public SimCaseResultOverview(SimInputData input, int curCaseCount, long totalCaseCount) { this.BaseInput = input; this.CurCaseCount = curCaseCount; this.TotalCaseCount = totalCaseCount; }
public GeneralOptimizer(String strategyName, SimInputData input) { this.StrategyName = strategyName; this.Input = input; }
void RunStaticAllocOptimizerExperiment() { SimInputData input = new SimInputData(); input.StartDate = new DateTime(2001, 1, 1); input.EndDate = DateTime.Now; input.InitInvestAmount = 1000000000; IStrategy strategy = new StaticAllocOptimizer("StaticAllocOptimizer", input); strategy.Build(); List<IResultHandler> resultHandlers = new List<IResultHandler>(); //resultHandlers.Add(new CsvOutHandler()); resultHandlers.Add(this); Experiment experiment = new Experiment(strategy, resultHandlers); experiment.Run(); }
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(); }
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(); }
void RunKrxCreditDepositRateOptimizerExperiment() { SimInputData input = new SimInputData(); //input.StartDate = new DateTime(2001, 1, 1); input.StartDate = new DateTime(2006, 1, 1); input.EndDate = new DateTime(2011, 5, 1); input.EndDate = DateTime.Now; input.InitInvestAmount = 1000000000; GeneralOptimizer strategy = new GeneralOptimizer("KrxCreditDepositRateOptimizer", input); strategy.Build(); for (int i = 0; i < 20; ++i) { double weight = 0.5 + 0.1 * (double)i; strategy.AddAdjustment(new KrxCreditDepositRateAdjustment(new CreditPolicyStatic(weight)), String.Format("Static ({0:n2})", weight)); strategy.AddAdjustment(new KrxCreditDepositRateAdjustment(new CreditPolicyWithMA(weight)), String.Format("MA ({0:n2})", weight)); } List<IResultHandler> resultHandlers = new List<IResultHandler>(); //resultHandlers.Add(new CsvOutHandler()); resultHandlers.Add(this); Experiment experiment = new Experiment(strategy, resultHandlers); experiment.Run(); }
void RunDollarPriceAdjExperiment() { SimInputData input = new SimInputData(); input.StartDate = new DateTime(2001, 1, 1); //input.StartDate = new DateTime(2006, 1, 1); input.EndDate = new DateTime(2011, 5, 1); input.EndDate = DateTime.Now; input.InitInvestAmount = 1000000000; GeneralOptimizer strategy = new GeneralOptimizer("DollarPriceOptimizer", input); strategy.Build(); for (int i = 0; i < 20; ++i) { double weight = 0.5 + 0.1 * (double)i; //double weight = i; strategy.AddAdjustment(new DollarPriceAdjustment(weight), String.Format("{0:n2}", weight)); } List<IResultHandler> resultHandlers = new List<IResultHandler>(); //resultHandlers.Add(new CsvOutHandler()); resultHandlers.Add(this); Experiment experiment = new Experiment(strategy, resultHandlers); experiment.Run(); }
public StaticAllocOptimizer(String strategyName, SimInputData input) { this.StrategyName = strategyName; this.Input = input; }
public void SetInputData(long notional) { SimInputData data = new SimInputData(); //data.StartDate = DataUtil.GetDateWithDayPrecision(DateTime.Now.AddYears(-10)); data.StartDate = new DateTime(2001, 1, 1); data.ReadStartDate = DataUtil.GetDateWithDayPrecision(DateTime.Now.AddYears(-100)); data.EndDate = DataUtil.GetDateWithDayPrecision(DateTime.Now.AddDays(-1)); data.InitInvestAmount = notional; this.InputData = data; this.Description = ""; logger.Info("{0} session data is ready.", SessionKey); }
public AdjExcelAdjResultConverter(SimInputData input, List<IAdj> adjs, MarketDataSet dataSet) { _input = input; _adjs = adjs; _marketData = dataSet; }
public KrxCreditDepositOptimizer(String strategyName, SimInputData input) { this.StrategyName = strategyName; this.Input = input; }