Example #1
0
        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);
        }
Example #2
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);
        }