コード例 #1
0
        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;
        }
コード例 #2
0
ファイル: Sheet12.cs プロジェクト: HongSeokHwan/legacy
        MarketDataSet GetNewMarketDataSet(DateTime curDate, Dictionary<string, double> priceData)
        {
            DateTime StartDate = EquityVolPredefinedVariables.ReadStartDate;
            DateTime EndDate = EquityVolPredefinedVariables.ReadEndDate;

            MarketDataSet mds  = new MarketDataSet();
            double curPrice = 0;
            foreach (KeyValuePair<string, double> pair in priceData)
            {
                curPrice = pair.Value;
                MarketDataSetKey key = DataUtil.GetMarketDataKeyFromTicker(pair.Key);
                if (EquityMarketDataManager.Ins().ContainsMarketPriceData(key))
                {
                    MarketData mdCache = EquityMarketDataManager.Ins().GetMarketPriceData(key);

                    MarketData md = GetNewMarketData(StartDate, EndDate, mdCache);
                    if (!md.IsExistDate(curDate))
                    {
                        md.AddDatum(curDate, new OHLC(0, 0, 0, curPrice));
                        mds.Add(key, md);
                    }
                }
            }

            MarketData mdKospi =
                DataUtil.GetKeyMarketData(MarketDataSetKey.KospiFuture, StartDate, EndDate);
            if (!mdKospi.IsExistDate(curDate))
            {
                DOHLC lastPrice = mdKospi.GetByIndex((int)mdKospi.GetTotalCount() - 1);
                mdKospi.AddDatum(curDate, lastPrice.OHLC);
            }

            mds.RegisterPivotData(mdKospi);
            return mds;
        }