public void Run()
        {
            Clipboard.SetText("Cbr start");

            G20 g20 = new G20();

            List<G20_TickerInfo> tickerInfos = g20.Data;

            Dictionary<String, Tuple<double, double, double>> results =
                new Dictionary<string, Tuple<double, double, double>>();

            foreach (G20_TickerInfo tickerInfo in tickerInfos)
            {
                Tuple<double, double, double> result =
                    CalculatePpm(tickerInfo.StockTicker, tickerInfo.CentralBankRateTicker, tickerInfo.Currency);
                results.Add(tickerInfo.Country, result);

                logger.Info(String.Format(
                    "{0} 복리: {1:n4} 단리: {2:n4} 금리적용단리: {3:n4}",
                    tickerInfo.Country,
                    result.Item1, result.Item2, result.Item3));
            }

            StringBuilder sb = new StringBuilder();

            foreach (KeyValuePair<String, Tuple<double, double, double>> kv in results)
            {
                sb.Append(String.Format("{0}\t{1}\t{2}\t{3}\r\n", kv.Key, kv.Value.Item1,
                    kv.Value.Item2, kv.Value.Item3));
            }
            Clipboard.SetText(sb.ToString());
            logger.Info("Clipboard copy complete...");
        }
Пример #2
0
        static List<IAdjLogic> CreateAdjSet1()
        {
            List<IAdjLogic> output = new List<IAdjLogic>();

            G20 g20 = new G20();
            List<G20_TickerInfo> tickerInfos = g20.Data;
            foreach (G20_TickerInfo tickerInfo in tickerInfos)
            {
                String instKey = MarketDataManager.Ins().GetKey(tickerInfo.StockTicker,
                    MarketDataFieldType.PX_LAST, tickerInfo.Currency);
                String currency = tickerInfo.Currency;

                if (StringUtil.IsEmpty(instKey))
                {
                    continue;
                }
                DummyAdj adj = new DummyAdj(instKey, 1.0);
                output.Add(adj);
            }
            return output;
        }
Пример #3
0
        static List<IAdjLogic> CreateCbrAdjSet(DateTime from, DateTime until)
        {
            List<IAdjLogic> output = new List<IAdjLogic>();

            G20 g20 = new G20();
            List<G20_TickerInfo> tickerInfos = g20.Data;
            foreach (G20_TickerInfo tickerInfo in tickerInfos)
            {
                String instKey = MarketDataManager.Ins().GetKey(tickerInfo.StockTicker,
                    MarketDataFieldType.PX_LAST, tickerInfo.Currency);
                String cbrTicker = tickerInfo.CentralBankRateTicker;
                String currency = tickerInfo.Currency;

                if (StringUtil.IsEmpty(instKey) || StringUtil.IsEmpty(cbrTicker))
                {
                    continue;
                }
                CentralBankRateAdj adj = new CentralBankRateAdj(instKey, cbrTicker, currency, from, until);
                output.Add(adj);
            }
            return output;
        }
Пример #4
0
        public void Run()
        {
            G20 g20 = new G20();
            List<G20_TickerInfo> g20_data = g20.Data;

            DateTime start = new DateTime(1990, 1, 1);
            DateTime until = ConvertUtil.Round(DateTime.Now);

            Dictionary<String, Tuple<double, double, double>> results =
                new Dictionary<string, Tuple<double, double, double>>();

            foreach (G20_TickerInfo tickerInfo in g20_data)
            {
                if (StringUtil.IsEmpty(tickerInfo.TbrTicker))
                {
                    continue;
                }
                logger.Info(tickerInfo.TbrTicker);
                Tuple<double, double, double> result = CalculatePpm(tickerInfo, start, until);
                results.Add(tickerInfo.Country, result);

                logger.Info(String.Format(
                    "{0} 복리: {1:n4} 단리: {2:n4} 금리적용단리: {3:n4}",
                    tickerInfo.Country,
                    result.Item1, result.Item2, result.Item3));
            }

            StringBuilder sb = new StringBuilder();

            foreach (KeyValuePair<String, Tuple<double, double, double>> kv in results)
            {
                sb.Append(String.Format("{0}\t{1}\t{2}\t{3}\r\n", kv.Key, kv.Value.Item1,
                    kv.Value.Item2, kv.Value.Item3));
            }
            Clipboard.SetText(sb.ToString());
            logger.Info("Clipboard copy complete...");
        }