Exemplo n.º 1
0
        void TestFactory(StrategyFactoryType tp)
        {
            ScoresCalculator calc = new ScoresCalculator();

            IStrategyFactory factory = StrategyFactoryCreater.Instance().CreateFactory(tp);

            FakeStockHistory fsh = new FakeStockHistory();
            fsh.Init();
            calc.Calc(fsh, factory, new FakeIBonusProcessor());
        }
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();
        }
Exemplo n.º 3
0
        private void RunStrategy()
        {
            SetUserDefinedDate();
            log_.Info("==>AutoCompare start. Start Date = " + History_.MinDate.ToLongDateString()
                + ", End Date = " + History_.MaxDate.ToLongDateString());

            if (History_.MinDate >= History_.MaxDate)
            {
                log_.Error("Stock histroy not correct!");
                return;
            }

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

            ScoresCalculator calc = new ScoresCalculator();
            calc.Calc(History_, factory, BonusProcessor_);
            calc.ShowResult();
        }