Tuple<double, double, double> CalculatePpm( G20_TickerInfo tickerInfo, DateTime from, DateTime until) { if (StringUtil.IsEmpty(tickerInfo.TbrTicker)) { logger.Warn("{0} is empty", tickerInfo.TbrTicker); return new Tuple<double, double, double>(0, 0, 0); } SortedList<DateTime, double> tbrMarketData = MarketDataManager.Ins().Get_PX_LAST_Data(tickerInfo.TbrTicker, "USD"); SortedList<DateTime, double> indexMarketData = MarketDataManager.Ins().Get_PX_LAST_Data(tickerInfo.StockTicker, tickerInfo.Currency); ZooData zoo = new ZooData(); zoo.SetPivot(tickerInfo.StockTicker, indexMarketData); zoo.Append(tickerInfo.TbrTicker, tbrMarketData); zoo.ToCsv(String.Format("C:\\tbr_{0}.csv", tickerInfo.Country)); //일단 보류한다. 특별한 성질을 찾지는 못했다. 특히 각 국가에 적용할 경우에 더욱 그렇다 //TbrAdj adj = new TbrAdj(tickerInfo, from, until); //String tradingTicker = tickerInfo.StockTicker; //String currency = tickerInfo.Currency; //SortedList<DateTime, double> tradingTargetData = ExperimentUtil.GetTradingTargetData( // tradingTicker, currency); //SortedList<DateTime, double> adjPnls = // MathUtil.GetAdjIncCum(adj.AdjIndex, tradingTargetData); //SortedList<DateTime, double> pnls = // MathUtil.GetIncCum(tradingTargetData, adjPnls.Keys[0].AddDays(-5)); //ZooData zoo = new ZooData(); //zoo.SetPivot("adjPnls", adjPnls); //zoo.Append("adj", adj.AdjIndex); //zoo.Append("pnls", pnls); //zoo.Append("tradingTarget", tradingTargetData); //double indexPpm = MathUtil.GetPPM(zoo.GetData("tradingTarget")); //double pnlPpm = MathUtil.GetPPM(zoo.GetData("pnls")); //double adjPnlPpm = MathUtil.GetPPM(zoo.GetData("adjPnls")); //return new Tuple<double, double, double>(indexPpm, // pnlPpm, adjPnlPpm); return new Tuple<double, double, double>(0, 0, 0); }
public void GetDataTest() { String kospiKey = MarketDataManager.Ins().GetKey("KOSPI Index", MarketDataFieldType.PX_LAST); SortedList<DateTime, double> kospiData = MarketDataManager.Ins().GetData(kospiKey); String nkyKey = MarketDataManager.Ins().GetKey("NKY Index", MarketDataFieldType.PX_LAST, "JPY"); SortedList<DateTime, double> nkyData = MarketDataManager.Ins().GetData(nkyKey); ZooData zoo = new ZooData(); zoo.SetPivot(kospiKey, kospiData); zoo.Append(nkyKey, nkyData); const String kPath = @"c:\test.csv"; zoo.ToCsv(kPath); }
Tuple<double, double, double> CalculatePpm(String tradingTicker, String rateTicker, String currency) { if (StringUtil.IsEmpty(tradingTicker) || StringUtil.IsEmpty(rateTicker)) { logger.Warn("{0}, {1} is empty", tradingTicker, rateTicker); return new Tuple<double, double, double>(0, 0, 0); } DateTime start = new DateTime(1990, 1, 1); DateTime until = ConvertUtil.Round(DateTime.Now); String indexKey = MarketDataManager.Ins().GetKey(tradingTicker, MarketDataFieldType.PX_LAST, currency); CentralBankRateAdj adj = new CentralBankRateAdj(indexKey, rateTicker, currency, start, until); SortedList<DateTime, double> tradingTargetData = MarketDataManager.Ins().Get_PX_LAST_Data( tradingTicker, currency); SortedList<DateTime, double> adjPnls = MathUtil.GetAdjIncCum(adj.AdjIndex, tradingTargetData); SortedList<DateTime, double> pnls = MathUtil.GetIncCum(tradingTargetData, adjPnls.Keys[0].AddDays(-5)); ZooData zoo = new ZooData(); zoo.SetPivot("adjPnls", adjPnls); zoo.Append("adj", adj.AdjIndex); zoo.Append("pnls", pnls); zoo.Append("tradingTarget", tradingTargetData); zoo.Append("rate", adj.CBRates); double indexPpm = MathUtil.GetPPM(zoo.GetData("tradingTarget")); double pnlPpm = MathUtil.GetPPM(zoo.GetData("pnls")); double adjPnlPpm = MathUtil.GetPPM(zoo.GetData("adjPnls")); return new Tuple<double, double, double>(indexPpm, pnlPpm, adjPnlPpm); //zoo.ToCsv(String.Format("c:\\{0}.csv", tradingTicker)); }