Example #1
0
        private void CompareIpoIdn(KoreaEquityInfo ipo)
        {
            if (idnDic == null)
            {
                return;
            }

            if (idnDic.ContainsKey(ipo.Ticker))
            {
                ReutersIdnInfo idnInfo = idnDic[ipo.Ticker];

                if ((idnInfo.BcastRef == ipo.BcastRef) && (idnInfo.DsplyName == ipo.IDNDisplayName) && (idnInfo.OffclCode == ipo.Ticker))
                {
                    return;
                }

                else
                {
                    KoreaCheckIpoData changeData = new KoreaCheckIpoData();

                    changeData.ProductionType  = ReutersProductionType.IDN;
                    changeData.TickerFm        = ipo.Ticker;
                    changeData.TickerProduct   = idnInfo.OffclCode;
                    changeData.BcastRefFm      = ipo.BcastRef;
                    changeData.BcastRefProduct = idnInfo.BcastRef;

                    if (idnInfo.OffclCode != ipo.Ticker)
                    {
                        changeData.IsTickerSame = false;
                    }

                    if (idnInfo.BcastRef != ipo.BcastRef)
                    {
                        changeData.IsIsinSame = false;
                    }

                    changedIpo.Add(changeData);
                }
            }
            else
            {
                // Mark Ticker missed.
                KoreaCheckIpoData missData = new KoreaCheckIpoData();

                missData.ProductionType = ReutersProductionType.IDN;
                missData.TickerFm       = ipo.Ticker;
                missData.TickerProduct  = string.Empty;

                missData.BcastRefFm      = ipo.BcastRef;
                missData.BcastRefProduct = string.Empty;

                missData.IsTickerSame   = false;
                missData.IsBcastRefSame = false;

                missedIpo.Add(missData);
            }
        }
Example #2
0
        private void GetGatsData()
        {
            idnDic = new Dictionary <string, ReutersIdnInfo>();

            string rics = string.Join(",", (from p in ipos select p.RIC).ToArray());
            string fids = "OFFCL_CODE,BCAST_REF,DSPLY_NAME";

            GatsUtil gats     = new GatsUtil();
            string   response = gats.GetGatsResponse(rics, fids);

            if (string.IsNullOrEmpty(response))
            {
                //No result from gats.

                return;
            }


            foreach (var ipo in ipos)
            {
                if (!response.Contains(ipo.RIC))
                {
                    continue;
                }

                ReutersIdnInfo idn = new ReutersIdnInfo();

                string offclPattern   = string.Format("{0} +OFFCL_CODE +(?<OfficalCode>.*?)\r\n", ipo.RIC);
                string bcastPattern   = string.Format("{0} +BCAST_REF +(?<BcastRef>.*?)\r\n", ipo.RIC);
                string diaplayPattern = string.Format("{0} +DSPLY_NAME +(?<DisplayName>.*?)\r\n", ipo.RIC);

                Regex r = new Regex(offclPattern);
                Match m = r.Match(response);
                if (m.Success)
                {
                    idn.OffclCode = m.Groups["OfficalCode"].Value.Trim();
                }

                r = new Regex(bcastPattern);
                m = r.Match(response);
                if (m.Success)
                {
                    idn.BcastRef = m.Groups["BcastRef"].Value.Trim();
                }

                r = new Regex(diaplayPattern);
                m = r.Match(response);
                if (m.Success)
                {
                    idn.DsplyName = m.Groups["DisplayName"].Value.Trim();
                }

                //as data in the database error, avid generating exception
                //idnDic.Add(ipo.Ticker, idn);
                if (!idnDic.ContainsKey(ipo.Ticker))
                {
                    idnDic.Add(ipo.Ticker, idn);
                }
                else
                {
                    idnDic.Add(ipo.Ticker + idnDic.Count.ToString(), idn);
                }
            }
        }