Ejemplo n.º 1
0
        private void GetCodeId(string fileName, List <CodeInfo> codes, HashSet <string> hashset)
        {
            int    startIndex = fileName.LastIndexOf('\\');
            int    endIndex   = fileName.LastIndexOf('_');
            string codeId     = fileName.Substring(startIndex + 1, endIndex - startIndex - 1);

            if (codeId.IndexOf("主力连续") >= 0)
            {
                return;
            }

            CodeIdParser parser = new CodeIdParser(codeId);

            if (parser.Suffix.Length == 3)
            {
                codeId = parser.VarietyId + "1" + parser.Suffix;
            }

            int tradingDay = int.Parse(fileName.Substring(endIndex + 1, 8));

            SetVarietyStart(parser.VarietyId, tradingDay);

            if (!hashset.Contains(codeId))
            {
                hashset.Add(codeId);
                CodeInfo codeInfo = CodeInfoUtils.GetCodeInfo(codeId, dataLoader_Variety);
                if (codeInfo == null)
                {
                    return;
                }
                codeInfo.Start = tradingDay;
                codes.Add(codeInfo);
            }
        }
Ejemplo n.º 2
0
        private String GetCodePath(String code, int date)
        {
            CodeIdParser parser      = new CodeIdParser(code);
            VarietyInfo  varietyInfo = dataLoader_Variety.GetVariety(parser.VarietyId);

            return(srcDataPath + "\\" + varietyInfo.Exchange + "\\" + date + "\\"
                   + CodeInfoUtils.GetSimpleCodeId(code) + "_" + date + ".csv");
        }
Ejemplo n.º 3
0
 public void SetUp()
 {
     codeInfoUtils = new CodeInfoUtils();
     task          = new Versioning
     {
         ProjectDir  = string.Empty,
         Language    = codeInfoUtils.GetCodeLanguage(CodeLanguage.CSharp),
         VersionPart = "1"
     };
 }
        private void Loop(string path, int tradingDay, List <CodeInfo> codes, HashSet <string> set_Codes)
        {
            DirectoryInfo dir = new DirectoryInfo(path);

            FileInfo[] files = dir.GetFiles();

            for (int i = 0; i < files.Length; i++)
            {
                string       fileName  = files[i].Name;
                string       oldCodeId = fileName.Substring(0, fileName.IndexOf('_'));
                CodeIdParser parser    = new CodeIdParser(oldCodeId);
                //if (parser.Suffix == "MI")
                //    continue;
                string complexCodeId = CodeInfoUtils.GetComplexCodeId(parser, tradingDay);
                if (complexCodeId == null)
                {
                    continue;
                }
                CodeIdParser parser2 = new CodeIdParser(complexCodeId);
                if (parser2.Suffix == null)
                {
                    continue;
                }
                if (parser2.Suffix.Length < 2 || parser2.Suffix.Length > 4)
                {
                    continue;
                }
                //string varietyId = CodeInfoUtils.GetVariety(oldCodeId);
                //string[] splitCodeArr = CodeInfoUtils.SplitCodeId(oldCodeId);
                //string newCodeId = GetCodeId(tradingDay, splitCodeArr);
                if (set_Codes.Contains(complexCodeId))
                {
                    continue;
                }
                set_Codes.Add(complexCodeId);
                CodeInfo codeInfo = CodeInfoUtils.GetCodeInfo(complexCodeId, dataLoader_Variety);
                if (codeInfo == null)
                {
                    continue;
                }
                if (!codeInfo.Code.EndsWith("0000") && !codeInfo.Code.EndsWith("MI"))
                {
                    codeInfo.Start = tradingDay;
                    SetVarietyStart(parser2.VarietyId, tradingDay);
                }
                else
                {
                    //indexCodes.Add(codeInfo);
                    continue;
                }
                codes.Add(codeInfo);
            }
        }
Ejemplo n.º 5
0
 public void SetUp()
 {
     fileTestHelper = new FileTestHelper();
     codeInfoUtils  = new CodeInfoUtils();
     task           = new NuspecGenerator
     {
         PackageDir    = string.Empty,
         ProjectDir    = ProjectDir,
         OutputPath    = Path.GetFullPath(Assembly),
         Language      = codeInfoUtils.GetCodeLanguage(CodeLanguage.CSharp),
         Configuration = Configuration
     };
 }
Ejemplo n.º 6
0
        private void GenerateIndexCodes(List <CodeInfo> codes)
        {
            string[] keies = this.dic_Variety_Start.Keys.ToArray <string>();
            for (int i = 0; i < keies.Length; i++)
            {
                string variety = keies[i];
                int    start   = dic_Variety_Start[variety];

                CodeInfo codeInfo = CodeInfoUtils.GetCodeInfo(variety + "0000", dataLoader_Variety);
                codeInfo.Start = start;
                codes.Add(codeInfo);

                CodeInfo codeInfo2 = CodeInfoUtils.GetCodeInfo(variety + "MI", dataLoader_Variety);
                codeInfo2.Start = start;
                codes.Add(codeInfo2);
            }
        }
        public List <CodeInfo> GenerateCodes()
        {
            List <CodeInfo>  codes = new List <CodeInfo>();
            HashSet <string> set   = new HashSet <string>();

            LoopByExchange(srcDataPath + "\\DL", codes, set);
            LoopByExchange(srcDataPath + "\\SQ", codes, set);
            LoopByExchange(srcDataPath + "\\ZZ", codes, set);

            string[] varieties = this.dic_Variety_Start.Keys.ToArray <String>();
            for (int i = 0; i < varieties.Length; i++)
            {
                string variety = varieties[i];
                int    start   = this.dic_Variety_Start[variety];

                string   indexId  = variety + "0000";
                CodeInfo codeInfo = CodeInfoUtils.GetCodeInfo(indexId, dataLoader_Variety);
                codeInfo.Start = start;
                codes.Add(codeInfo);

                string miId = variety + "MI";
                codeInfo       = CodeInfoUtils.GetCodeInfo(miId, dataLoader_Variety);
                codeInfo.Start = start;
                codes.Add(codeInfo);
            }

            //for (int i = 0; i < indexCodes.Count; i++)
            //{
            //    CodeInfo codeInfo = indexCodes[i];
            //    if (dic_Variety_Start.ContainsKey(codeInfo.Catelog))
            //        codeInfo.Start = dic_Variety_Start[codeInfo.Catelog];
            //}

            codes.Sort(new CodeInfoComparer());
            return(codes);
        }
Ejemplo n.º 8
0
        public List <CodeInfo> GenerateCodes()
        {
            List <CodeInfo>  codes   = new List <CodeInfo>();
            HashSet <string> hashset = new HashSet <string>();

            LoopDic(srcDataPath, codes, hashset);

            string[] keies = this.dic_Variety_Start.Keys.ToArray <string>();
            for (int i = 0; i < keies.Length; i++)
            {
                string variety = keies[i];
                int    start   = dic_Variety_Start[variety];

                CodeInfo codeInfo = CodeInfoUtils.GetCodeInfo(variety + "0000", dataLoader_Variety);
                codeInfo.Start = start;
                codes.Add(codeInfo);

                CodeInfo codeInfo2 = CodeInfoUtils.GetCodeInfo(variety + "MI", dataLoader_Variety);
                codeInfo2.Start = start;
                codes.Add(codeInfo2);
            }

            //List<VarietyInfo> varieties = dataLoader_Variety.GetAllVarieties();
            //for (int i = 0; i < varieties.Count; i++)
            //{
            //    VarietyInfo variety = varieties[i];
            //    CodeInfo codeInfo = new CodeInfo(variety.Code + "0000", variety.Name + "0000", variety.Code, variety.Name, 0, 0, variety.Exchange, variety.Code + "13");
            //    codes.Add(codeInfo);
            //    CodeInfo codeInfo2 = new CodeInfo(variety.Code + "MI", variety.Name + "MI", variety.Code, variety.Name, 0, 0, variety.Exchange, variety.Code + "MI");
            //    codes.Add(codeInfo2);
            //}

            codes.Sort(new CodeInfoComparer());

            return(codes);
        }