/// <summary> /// 根据品种名得到其对应的合约 /// </summary> /// <param name="species"></param> private List <string> GetContractBySpeciesName(string species, out string ZLCode) { //先得到中文名 string chineseName = CodeSetManager.GetSpeciChineseName(species); string otherCode = ""; if (speciesNameDict.ContainsKey(chineseName)) { SpeciesItem si = speciesNameDict[chineseName]; if (species.Equals(si.code)) { otherCode = si.otherCode; } else if (species.Equals(si.otherCode)) { otherCode = si.code;; } } List <Contract> codeInfos = CodeSetManager.GetCodeListBySpecies(species); List <Contract> codeInfo2 = CodeSetManager.GetCodeListBySpecies(otherCode); if (codeInfo2 != null) { codeInfos.AddRange(codeInfo2); } //List<string> zhuliCodes = HQService.HQServ.GetZhuliCode(); ZLCode = ""; //foreach (String codeInfo in zhuliCodes) //{ // string name = GetValidSpeciesName(codeInfo); // if (name.Equals(species)) // { // ZLCode = codeInfo; // break; // } //} List <string> ret = new List <string>(); if (codeInfos != null) { foreach (Contract cif in codeInfos) { ret.Add(cif.Code); } } return(ret); }
/// <summary> /// 得到所有的品种 /// </summary> /// <returns></returns> private List <SpeciesItem> GetAllSpecies() { List <SpeciesItem> ret = new List <SpeciesItem>(); SpeciesItem si = null; List <Species> speciesList = null; speciesList = CodeSetManager.GetAllInnerSpecies();// CodeSet.GetListSpeciesByMarket(HSMarketDataType.FUTURES_MARKET | HSMarketDataType.CFFEX_BOURSE); //foreach (Species s in speciesList) //{ // si = null; // string chnName=CodeGen.CodeSet.GetSpeciChineseName(s.speciesName); // if (speciesNameDict.ContainsKey(chnName)) // { // si = speciesNameDict[chnName]; // si.otherCode = s.speciesName; // } // else // { // si = new SpeciesItem(); // si.code = s.speciesName; // si.name = chnName; // ret.Add(si); // speciesNameDict[chnName] = si; // } //} //speciesList=CodeSet.GetListSpeciesByMarket(HSMarketDataType.FUTURES_MARKET | HSMarketDataType.SHANGHAI_BOURSE); //foreach (Species s in speciesList) //{ // si = null; // string chnName = CodeGen.CodeSet.GetSpeciChineseName(s.speciesName); // if (speciesNameDict.ContainsKey(chnName)) // { // si = speciesNameDict[chnName]; // si.otherCode = s.speciesName; // } // else // { // si = new SpeciesItem(); // si.name = chnName; // si.code = s.speciesName; // ret.Add(si); // speciesNameDict[chnName] = si; // } //} //speciesList = CodeSet.GetListSpeciesByMarket(HSMarketDataType.FUTURES_MARKET | HSMarketDataType.ZHENGZHOU_BOURSE); //foreach (Species s in speciesList) //{ // si = null; // string chnName = CodeGen.CodeSet.GetSpeciChineseName(s.speciesName); // if (speciesNameDict.ContainsKey(chnName)) // { // si = speciesNameDict[chnName]; // si.otherCode = s.speciesName; // } // else // { // si = new SpeciesItem(); // si.code = s.speciesName; // si.name = chnName; // ret.Add(si); // speciesNameDict[chnName] = si; // } //} //speciesList = CodeSet.GetListSpeciesByMarket(HSMarketDataType.FUTURES_MARKET | HSMarketDataType.DALIAN_BOURSE); foreach (Species s in speciesList) { //Todo: //if (s.SpeciesCode.Contains("SP") || s.SpeciesCode.Contains("efp") || s.SpeciesCode.Contains("_o")) if (s.SpeciesCode.Contains("efp") || s.SpeciesCode.StartsWith("sc") || s.ProductType == "Combination" || s.ProductType.Contains("Option") || s.SpeciesCode == "CVX") { continue; } si = null; string chnName = CodeSetManager.GetSpeciChineseName(s.SpeciesCode); if (speciesNameDict.ContainsKey(chnName)) { si = speciesNameDict[chnName]; si.otherCode = s.SpeciesCode; } else { si = new SpeciesItem(); si.code = s.SpeciesCode; si.name = chnName; ret.Add(si); speciesNameDict[chnName] = si; } } return(ret); }