示例#1
0
        /// <summary>
        /// Calculate score of each strategy
        /// </summary>
        /// <param name="history">One stock history</param>
        /// <param name="factory">Strategy Factory</param>
        /// <param name="reader">Bonus imformation</param>
        public void Calc(IStockHistory history, IStrategyFactory factory, IBonusProcessor reader)
        {
            FinanceRunner runner = new FinanceRunner();
            runner.CurrentBonusProcessor = reader;
            runner.Go(history, factory);

            IStrategyJudger judger = new StrategyJudger();
            judger.Judge(runner.Results);

            IStrategyJudger judger2 = new ValidationJudger();
            judger2.Judge(runner.Results);

            AllScores_.AddRange(judger.ScoresArr);
            AllScores_.AddRange(judger2.ScoresArr);
        }
        private void FormStrategyDetail_Load(object sender, EventArgs e)
        {
            AddGridTitle();

            ValidationJudger judger = new ValidationJudger();
            judger.Judge(Results);

            StrategyJudger strategyJudger = new StrategyJudger();
            strategyJudger.Judge(Results);

            InitScoresMapping(judger, strategyJudger);

            foreach (string strategyName in Results.AllStrategyNames)
            {
                IStockValues val = Results.GetResult(strategyName);

                ListViewItem listItem = new ListViewItem(strategyName);
                listItem.SubItems.Add(val.GetOperCount(OperType.Buy).ToString());
                listItem.SubItems.Add(val.GetOperCount(OperType.Sell).ToString());
                listItem.SubItems.Add(FindScore("Buy Signal", strategyName));
                listItem.SubItems.Add(FindScore("Sell Signal", strategyName));
                listItem.SubItems.Add(FindScore("Buy and Sell Signal", strategyName));
                listItem.SubItems.Add(FindScore("Daily Prices Sigma", strategyName));

                listViewStrategy.Items.Add(listItem);
            }
        }