예제 #1
0
 AdjRateDatum GetAdjRateDatum(DateTime curDate, MarketDataSet marketData, AdjRateDataLog adjLog)
 {
     AdjRateDatum ret = SetBaseAdjRateDatum();
     foreach (IAdj adj in this.Adjs)
     {
         AdjRateDatum datum = adj.CalculateAdjRateDatum(curDate, marketData);
         adjLog.Add(adj.GetKey(), curDate, datum.Clone());
         ret = GetOperatedAdjRateDatum(ret, datum);
     }
     return ret;
 }
예제 #2
0
        public Tuple<AssetRateDataLog, AdjRateDataLog> Calculate(MarketDataSet marketData)
        {
            DateTime curDate = this.InputData.StartDate;

            AssetRateDataLog assetLog = new AssetRateDataLog();
            AdjRateDataLog adjLog = new AdjRateDataLog();

            while (curDate <= this.InputData.EndDate)
            {
                if (marketData.IsExistDate(curDate))
                {
                    AssetRateDatum assetDatum = this.Alloc.CalculateAndGetAssetRateDatum(curDate, marketData);
                    AdjRateDatum adjDatum = GetAdjRateDatum(curDate, marketData, adjLog);
                    assetDatum.Multiply(adjDatum);
                    assetDatum.SetScale();
                    assetLog.Add(curDate, assetDatum);
                }
                curDate = curDate.AddDays(1);
            }

            return new Tuple<AssetRateDataLog, AdjRateDataLog>(assetLog, adjLog);
        }