Exemplo n.º 1
0
        void AnalyseHistory()
        {
            // Load from DB
            IEnumerable <int> allStockId = new List <int> {
                600238, 600239, 600240, 600007,
                600008, 600009, 600010, 600019, 600020, 600021, 600022
            };

            StocksHistory histories = new StocksHistory();

            histories.Load(allStockId);

            StockCharMappingAnalyzer analyzer = new StockCharMappingAnalyzer();

            analyzer.Init(histories);

            int firstId = 0;

            foreach (int stockId in allStockId)
            {
                firstId = stockId;
                break;
            }

            IStockHistory history = histories.GetHistory(firstId);

            if (history == null)
            {
                return;
            }

            IStockHistory oneWeekHistory = history.GetPartStockHistory(history.MaxDate.AddDays(-7),
                                                                       history.MaxDate);

            if (oneWeekHistory == null)
            {
                return;
            }

            analyzer.FindMatches(oneWeekHistory);
        }
Exemplo n.º 2
0
        private void RunStrategyOnMultiStocks()
        {
            // Load from DB
            IEnumerable <int> allStockId = new List <int> {
                600238, 600239, 600240, 600007,
                600008, 600009, 600010, 600019, 600020, 600021, 600022
            };

            StocksHistory histories = new StocksHistory();

            histories.Load(allStockId);

            IStrategyFactory factory = StrategyFactoryCreater.Instance().CreateFactory(StrategyFactoryType.Normal);

            ScoresCalculator calc = new ScoresCalculator();

            foreach (IStockHistory hist in histories.GetAllHistories())
            {
                calc.Calc(hist, factory, null);
            }

            calc.ShowResult();
        }