Ejemplo n.º 1
0
        AdjTable CreateAdjTable(AdjTradingInput input)
        {
            AdjTable adjTable = new AdjTable();

            // Get InstrumentKeys
            foreach (String instKey in input.InstKeyAdjDict.Keys)
            {
                // For each InstrumentKey, Calculate Adj
                List<IAdjLogic> adjLogics = input.InstKeyAdjDict[instKey];
                SortedList<DateTime, double> result =
                    AdjCalculator.Calculate(adjLogics, this.From, this.Until);
                adjTable.Data.Add(instKey, result);
            }
            return adjTable;
        }
Ejemplo n.º 2
0
        AdjTradingResultTable CreateTradingResultTable(AdjTable adjTable, AdjTradingInput input)
        {
            AdjTradingResultTable resultTable = new AdjTradingResultTable(this.From, this.Until);
            double investAmount = input.InvestAmount;

            foreach (String instKey in adjTable.Data.Keys)
            {
                ZooData zoo =
                    AdjTradingResultCalculator.Calculate(instKey, adjTable, this.From, this.Until, investAmount);

                resultTable.EachTradingResult.Add(instKey, zoo);
            }
            resultTable.CalculateTotal();

            return resultTable;
        }
Ejemplo n.º 3
0
 AdjTradingInput CreateInput(String key, List<List<IAdjLogic>> adjSets, double investAmount)
 {
     AdjTradingInput input = new AdjTradingInput(key, investAmount);
     foreach (List<IAdjLogic> adjSet in adjSets)
     {
         foreach (IAdjLogic adj in adjSet)
         {
             input.Append(adj);
         }
     }
     return input;
 }
Ejemplo n.º 4
0
 public AdjTradingResultTable ExecuteSimulation(AdjTradingInput input)
 {
     AdjTable adjTable = CreateAdjTable(input);
     AdjTradingResultTable resultTable = CreateTradingResultTable(adjTable, input);
     return resultTable;
 }
Ejemplo n.º 5
0
        static AdjTradingInput CreateInput(double investAmount)
        {
            AdjTradingInput input = new AdjTradingInput("simple", investAmount);
            String kospiKey = MarketDataManager.Ins().GetKey("KOSPI Index", MarketDataFieldType.PX_LAST, "KRW");
            DummyAdj kospiAdj1 = new DummyAdj(kospiKey, 1.0);
            input.Append(kospiAdj1);

            String spxKey = MarketDataManager.Ins().GetKey("SPX Index", MarketDataFieldType.PX_LAST, "USD");
            DummyAdj spxAdj1 = new DummyAdj(spxKey, 1.0);
            input.Append(spxAdj1);

            String chinaKey = MarketDataManager.Ins().GetKey("SHCOMP Index", MarketDataFieldType.PX_LAST, "CNY");
            DummyAdj chinaAdj1 = new DummyAdj(chinaKey, 1.0);
            input.Append(chinaAdj1);

            return input;
        }