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(); } idnDic.Add(ipo.Ticker, idn); } }
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 { ProductionType = ReutersProductionType.IDN, TickerFm = ipo.Ticker, TickerProduct = idnInfo.OffclCode, BcastRefFm = ipo.BcastRef, BcastRefProduct = idnInfo.BcastRef, IdnDisplayNameFm = ipo.IDNDisplayName, IdnDisplayNameProduct = idnInfo.DsplyName }; if (idnInfo.OffclCode != ipo.Ticker) { changeData.IsTickerSame = false; } if (idnInfo.DsplyName != ipo.IDNDisplayName) { //Mark change changeData.IsIdnDisplayNameSame = false; } if (idnInfo.BcastRef != ipo.BcastRef) { changeData.IsIsinSame = false; } changedIpo.Add(changeData); } } else { // Mark Ticker missed. KoreaCheckIpoData missData = new KoreaCheckIpoData { ProductionType = ReutersProductionType.IDN, TickerFm = ipo.Ticker, TickerProduct = string.Empty, IdnDisplayNameFm = ipo.IDNDisplayName, IdnDisplayNameProduct = string.Empty, BcastRefFm = ipo.BcastRef, BcastRefProduct = string.Empty, IsTickerSame = false, IsIdnDisplayNameSame = false, IsBcastRefSame = false }; missedIpo.Add(missData); } }