Esempio n. 1
0
        public combineRule[] GetSelectedCombGroup()
        {
            int len = lst_comb.Items.Count;

            combineRule[] obj = new combineRule[len];
            for (int i = 0; i < len; i++)
            {
                string s = lst_comb.Items[i].ToString();
                obj[i] = combineRule.getCombRule(s);
            }
            return(obj);
        }
Esempio n. 2
0
 private void Simulate(int new_startdate, int new_enddate)
 {
     this.dg_overview.Rows.Clear();
     //仓位股票数量
     holdstocknum = (int)txt_num.Value;
     foreach (int buy_type in Rule.rulebuy_type)
     {
         for (int i = 0; i < pnl_buysell2.GetSelectedCombGroup().Length; i++)
         {
             sm = new SimulateManager(new_startdate, new_enddate, holdstocknum);
             combineRule combinerule = pnl_buysell2.GetSelectedCombGroup()[i];
             //得到所有符合买卖原则的数据
             StockOpeItem[] items = StockAnalysisSQL.GetAnalysis2List(buy_type, new_startdate, new_enddate, combinerule.buy.ToString(), combinerule.sell.ToString(), -0.99,
                                                                      true, //apply default Sell
                                                                      true);
             foreach (StockOpeItem item in items)
             {
                 sm.AddOpeItem(item);
             }
             sm.Simulate(new_startdate, new_enddate);
             sm.SaveToDB(buy_type, combinerule.buy.ToString(), combinerule.sell.ToString());
         }
     }
 }