public HotPlateTradeStrategy(string name, string description, PlateMonitor plateMonitor)
     : base(name, description)
 {
     this.ChangeMarketOnDay = true;      //每天都改变市场,即每天交易对象是改变的
     this.plateMonitor      = plateMonitor;
     this.tradeManager      = new TradeManager();
 }
 protected override void Dispose(bool disposing)
 {
     if (this.plateMonitor != null)
     {
         this.plateMonitor.RemoveMonitorForm();
         this.plateMonitor = null;
     }
     if (disposing && (components != null))
     {
         components.Dispose();
     }
     base.Dispose(disposing);
 }
    public void ShowPlateStatistic(PlateMonitor plateMonitor)
    {
        this.plateMonitor = plateMonitor;
        DataTable dtIndustryPlates = new PlateDataTable();
        DataTable dtConceptPlates  = new PlateDataTable();
        DataTable dtAreaPlates     = new PlateDataTable();

        foreach (Plate curPlate in plateMonitor.Plates)
        {
            DataRow dr = null;
            switch (curPlate.Type)
            {
            case 1:
                dr = dtAreaPlates.NewRow();
                break;

            case 2:
                dr = dtIndustryPlates.NewRow();
                break;

            case 3:
                dr = dtConceptPlates.NewRow();
                break;
            }
            dr["ID"]               = curPlate.ID;
            dr["Name"]             = curPlate.Name;
            dr["UpLimitCount"]     = curPlate.UpLimitCount;
            dr["FivePercentCount"] = curPlate.FivePercentCount;
            dr["UpCount"]          = curPlate.UpCount;
            dr["ActiveCount"]      = curPlate.ActiveCount;
            dr["Weight"]           = curPlate.Weight;
            switch (curPlate.Type)
            {
            case 1:
                dtAreaPlates.Rows.Add(dr);
                break;

            case 2:
                dtIndustryPlates.Rows.Add(dr);
                break;

            case 3:
                dtConceptPlates.Rows.Add(dr);
                break;
            }
        }
        DataRow dr1 = dtAreaPlates.NewRow();

        dr1["ID"]               = -1;
        dr1["Name"]             = "全部";
        dr1["UpLimitCount"]     = plateMonitor.UpLimitCountOfAll;
        dr1["FivePercentCount"] = plateMonitor.FivePercentCountOfAll;
        dr1["UpCount"]          = plateMonitor.UpCountOfAll;
        dr1["ActiveCount"]      = plateMonitor.ActiveCountOfAll;
        dr1["Weight"]           = plateMonitor.WeightOfAll;
        dtAreaPlates.Rows.Add(dr1);
        dtAreaPlates.DefaultView.Sort = "UpLimitCount DESC";
        dr1                     = dtIndustryPlates.NewRow();
        dr1["ID"]               = -1;
        dr1["Name"]             = "全部";
        dr1["UpLimitCount"]     = plateMonitor.UpLimitCountOfAll;
        dr1["FivePercentCount"] = plateMonitor.FivePercentCountOfAll;
        dr1["UpCount"]          = plateMonitor.UpCountOfAll;
        dr1["ActiveCount"]      = plateMonitor.ActiveCountOfAll;
        dr1["Weight"]           = plateMonitor.WeightOfAll;
        dtIndustryPlates.Rows.Add(dr1);
        dtIndustryPlates.DefaultView.Sort = "UpLimitCount DESC";
        dr1                     = dtConceptPlates.NewRow();
        dr1["ID"]               = -1;
        dr1["Name"]             = "全部";
        dr1["UpLimitCount"]     = plateMonitor.UpLimitCountOfAll;
        dr1["FivePercentCount"] = plateMonitor.FivePercentCountOfAll;
        dr1["UpCount"]          = plateMonitor.UpCountOfAll;
        dr1["ActiveCount"]      = plateMonitor.ActiveCountOfAll;
        dr1["Weight"]           = plateMonitor.WeightOfAll;
        dtConceptPlates.Rows.Add(dr1);
        dtConceptPlates.DefaultView.Sort = "UpLimitCount DESC";
        this.RefreshPlateData(this.dgvAreas, dtAreaPlates);
        this.RefreshPlateData(this.dgvIndustries, dtIndustryPlates);
        this.RefreshPlateData(this.dgvConcepts, dtConceptPlates);
    }
 public HotPlateTradeStrategy(PlateMonitor plateMonitor)
     : this("HotPlateTradeStrategy", "This is a strategy for trading stocks in hot plate.", plateMonitor)
 {
 }