private void InitializeDse() { string dseFileRulePath = @".\Config\Asia\DseFileRules.xml"; List <DseFileRule> dseRules = ConfigUtil.ReadConfig(dseFileRulePath, typeof(List <DseFileRule>)) as List <DseFileRule>; Dictionary <string, DseFileRule> ruleDic = new Dictionary <string, DseFileRule>(); ruleDic = dseRules.ToDictionary(e => e.PropertyName, StringComparer.Ordinal); // File - TransferRule - List<DseFileInfo> // string - TransferRule - DseFileInfo DseFileInfo transferedRecord = new DseFileInfo(); PropertyInfo[] properties = transferedRecord.GetType().GetProperties(); string record = "XE1247.HK MIKO INTL ORD HKGHKD1Miko International Holdings Ltd 114062620Miko Intl CHN 1247 124686854 1247.HK 4945 ORD Y1247 Miko International Holdings Ord Shs Stock Exch Hong KongXHKG N -9999999999999999900 -9999999999999999900 -9999999999999999900 -9999999999999999900 -9999999999999999999 -9999999999999999999 -999999999 200000ORD -999999999999999999900000000-999999999999999999900000000 KY0x00100b0009d654780x00100b0009d39f71Y20140115 CYM T+2 "; foreach (PropertyInfo p in properties) { if (ruleDic.ContainsKey(p.Name)) { DseFileRule dseRule = ruleDic[p.Name] as DseFileRule; string value = dseRule.ParseField(record); SetPropertyValue(transferedRecord.GetType(), p.Name, value, transferedRecord); } } }
private DseFileInfo ParseDseRecord(string record) { DseFileInfo parsedRecord = new DseFileInfo(); PropertyInfo[] properties = parsedRecord.GetType().GetProperties(); //string record = "XE1247.HK MIKO INTL ORD HKGHKD1Miko International Holdings Ltd 114062620Miko Intl CHN 1247 124686854 1247.HK 4945 ORD Y1247 Miko International Holdings Ord Shs Stock Exch Hong KongXHKG N -9999999999999999900 -9999999999999999900 -9999999999999999900 -9999999999999999900 -9999999999999999999 -9999999999999999999 -999999999 200000ORD -999999999999999999900000000-999999999999999999900000000 KY0x00100b0009d654780x00100b0009d39f71Y20140115 CYM T+2 "; foreach (PropertyInfo p in properties) { if (ruleDic.ContainsKey(p.Name)) { DseFileRule dseRule = ruleDic[p.Name] as DseFileRule; string value = dseRule.ParseField(record); SetPropertyValue(parsedRecord.GetType(), p.Name, value, parsedRecord); } } return(parsedRecord); }
private void CompareIpoNda(KoreaEquityInfo ipo) { if (dseDic == null) { return; } if (dseDic.ContainsKey(ipo.Ticker)) { DseFileInfo dseInfo = dseDic[ipo.Ticker]; string[] securityNames = dseInfo.SecurityDescription.Split(' '); string type = string.Empty; if (securityNames.Length > 1) { type = securityNames[securityNames.Length - 1]; dseInfo.SecurityDescription = dseInfo.SecurityDescription.Replace(type, "").Trim(); } if ((dseInfo.ISIN == ipo.ISIN) && (dseInfo.SecurityDescription == ipo.IDNDisplayName)) { return; } else { KoreaCheckIpoData changeData = new KoreaCheckIpoData(); changeData.ProductionType = ReutersProductionType.NDA; changeData.TickerFm = ipo.Ticker; changeData.TickerProduct = dseInfo.Ticker; changeData.IsTickerSame = true; changeData.IsinFm = ipo.ISIN; changeData.IsinProduct = dseInfo.ISIN; if (dseInfo.ISIN != ipo.ISIN) { changeData.IsIsinSame = false; } changedIpo.Add(changeData); } } else { // Mark Ticker missed. KoreaCheckIpoData missData = new KoreaCheckIpoData(); missData.ProductionType = ReutersProductionType.NDA; missData.TickerFm = ipo.Ticker; missData.TickerProduct = string.Empty; missData.IsinFm = ipo.ISIN; missData.IsinProduct = string.Empty; missData.IsTickerSame = false; missData.IsIsinSame = false; missedIpo.Add(missData); } }
private void GetRecords() { //List<DseFileInfo> xeRecord = new List<DseFileInfo>(); dseDic = new Dictionary <string, DseFileInfo>(); string currentDate = string.Empty; string[] fileStartArr = { "0184", "0673", "3073", "EM01" }; foreach (string fileStart in fileStartArr) { currentDate = GetCurrrentFileDate(fileStart); string fileName = string.Format("{0}{1}.M", fileStart, currentDate); string mfilePath = Path.Combine(mFileFolder, fileName); //If the EM01 file stored in common path, use this path. Please write a funtion for ConfigureOperator.GetFileSaveDirEm01() //if (fileStart.Equals("EM01")) //{ // string emFilePath = ConfigureOperator.GetFileSaveDirEm01(); // mfilePath = Path.Combine(mFileFolder, fileName); //} if (!File.Exists(mfilePath)) { continue; } using (StreamReader sr = new StreamReader(mfilePath)) { string tmp = null; while ((tmp = sr.ReadLine()) != null) { if (!tmp.StartsWith("XE")) { continue; } //if (tmp.StartsWith("XEIPO")) //{ // continue; //} string ric = tmp.Substring(0, tmp.IndexOf(' ')).Replace("XE", ""); if (!(ric.EndsWith("KS") || ric.EndsWith("KQ") || ric.EndsWith("KN"))) { continue; } DseFileInfo info = ParseDseRecord(tmp); if (info != null && !dseDic.ContainsKey(info.Ticker)) { dseDic.Add(info.Ticker, info); } //xeRecord.Add(ParseDseRecord(tmp)); string msg = string.Format("Get 1 record from file: {0}. RIC:{1}", fileName, ric); Logger.Log(msg); } } } }