Exemple #1
0
        static void Run(Options options)
        {
            List <StockBlockRelationship> relationships = new List <StockBlockRelationship>();

            // load block definitions
            var stockBlockManager = new StockBlockManager();
            var blockConfigReader = new TdxStockBlockConfigReader(options.BlockConfigFile);

            stockBlockManager.AddStockBlocks(blockConfigReader.Blocks);

            // try to load stock block relationships
            if (!string.IsNullOrEmpty(options.HangYeFile))
            {
                relationships.AddRange(
                    new TdxHangYeBlockDataReader(options.HangYeFile, stockBlockManager).Relationships);
            }

            if (!string.IsNullOrEmpty(options.GaiNianFile))
            {
                relationships.AddRange(
                    new TdxBinaryBlockDataReader(options.GaiNianFile).Relationships);
            }

            if (!string.IsNullOrEmpty(options.FengGeFile))
            {
                relationships.AddRange(
                    new TdxBinaryBlockDataReader(options.FengGeFile).Relationships);
            }

            if (!string.IsNullOrEmpty(options.ZhiShuFile))
            {
                relationships.AddRange(
                    new TdxBinaryBlockDataReader(options.ZhiShuFile).Relationships);
            }

            // expand relationships
            if (relationships.Count > 0)
            {
                relationships = stockBlockManager.ExpandRelationships(relationships).ToList();
            }

            // output
            StockBlockRelationship.SaveToFile(options.OutputFile, relationships);
        }
Exemple #2
0
        static StockBlockRelationshipManager LoadStockBlockRelationship(string relationshipFile)
        {
            var relationships = StockBlockRelationship.LoadFromFile(relationshipFile);

            return(new StockBlockRelationshipManager(relationships));
        }