Exemplo n.º 1
0
        void Load()
        {
            this.Data.Clear();

            String query = "select * from g20";
            DataRowCollection rows = DBUtil.SelectFromDB(query);
            for (int i = 0; i < rows.Count; ++i)
            {
            //country,currency_symbol,stock_index_ticker,pbr_ticker,central_bank_rate,gdp_ticker
                DataRow row = rows[i];
                String  country = Convert.ToString(row["country"]);
                String currency = Convert.ToString(row["currency_symbol"]);
                String stockIndex = Convert.ToString(row["stock_index_ticker"]);
                String pbr = Convert.ToString(row["pbr_ticker"]);
                String centralBankRate = Convert.ToString(row["central_bank_rate"]);
                String gdp = Convert.ToString(row["gdp_ticker"]);
                String bond_3yr = Convert.ToString(row["bond_3yr"]);
                String bond_10yr = Convert.ToString(row["bond_10yr"]);
                String perTicker = Convert.ToString(row["per_ticker"]);
                String tbrTicker = Convert.ToString(row["tbr_ticker"]);

                G20_TickerInfo datum = new G20_TickerInfo();
                datum.Country = country;
                datum.Currency = currency;
                datum.StockTicker = stockIndex;
                datum.CentralBankRateTicker = centralBankRate;
                datum.GdpTicker = gdp;
                datum.Bond_3yrTicker = bond_3yr;
                datum.Bond_10yrTicker = bond_10yr;
                datum.PerTicker = perTicker;
                datum.TbrTicker = tbrTicker;

                this.Data.Add(datum);
            }
        }
Exemplo n.º 2
0
        public TbrAdj(G20_TickerInfo tickerInfo, DateTime from, DateTime until)
        {
            this.AdjIndex = new SortedList<DateTime, double>();
            this.TickerInfo = tickerInfo;
            this._fromDate = from;
            this._untilDate = until;

            LoadMarketData();
            Calculate();
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
 public String GetIndexKey(G20_TickerInfo tickerInfo)
 {
     String indexKey = MarketDataManager.Ins().GetKey(tickerInfo.StockTicker,
         MarketDataFieldType.PX_LAST, tickerInfo.Currency);
     return indexKey;
 }