Exemple #1
0
        public static MTable getBkList(MongoDataReader w, string sec, DateTime dt, bool FilterTheNoPrice)
        {
            SecIndexClass   sic = new SecIndexClass(sec);
            secIndexBuilder sib = new secIndexBuilder(w, sic);
            MTable          mt  = sib.getBkList(dt);

            if (mt == null || mt.Count == 0)
            {
                return(mt);
            }
            BaseDataProcess_ForMG bdp = new BaseDataProcess_ForMG(w);

            string[]       seccodes = mt["wind_code"].ToList <string>().ToArray();
            RunResultClass rc       = bdp.getSetDataResult(seccodes, "close", dt);
            MTable         ret      = new MTable();
            List <DataRow> NewDrs   = new List <DataRow>();

            for (int i = 0; i < rc.Result.Count; i++)
            {
                DataRow retdr = mt.GetTable().Rows[i];
                DataRow dr    = rc.Result.GetTable().Rows[i];
                if (dr.IsNull("CLOSE") && FilterTheNoPrice)
                {
                    continue;
                }
                NewDrs.Add(retdr);
            }
            ret.FillList(NewDrs.ToArray());
            return(ret);
        }
Exemple #2
0
        public static bool IsSecIndex(MongoDataReader w, string strName, DateTime EndT, out string[] seclist, out string[] secnames)
        {
            seclist  = new string[0];
            secnames = new string[0];
            if (strName == null || strName.Trim().Length == 0)
            {
                return(false);
            }

            SecIndexClass   sic = new SecIndexClass(strName);
            secIndexBuilder sib = new secIndexBuilder(w, sic);
            MTable          mtb = sib.getBkList(EndT);

            if (mtb.Count == 0)
            {
                return(false);
            }

            //throw (new Exception(mtb.ToRowData(0)));
            seclist  = mtb.ToList <string>("wind_code").ToArray();
            secnames = mtb.ToList <string>("sec_name").ToArray();
            return(true);
        }
Exemple #3
0
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            //DataTable table = (DataTable)dataGridView1.DataSource;//数据源
            //string secid = table.Rows[e.RowIndex]["wind_code"].ToString();
            //string SecName = table.Rows[e.RowIndex]["sec_name"].ToString();
            string        secid   = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells["wind_code"].Value.ToString();
            string        SecName = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells["sec_name"].Value.ToString();
            SecIndexClass sic     = new SIIIClass();

            sic.IndexCode = secid;
            secIndexBuilder sib = new secIndexBuilder(this.gb.w, sic);
            MTable          mt  = sib.getBkWeight(this.txt_EndT.Value);

            if (mt == null)
            {
                return;
            }
            DataTable dt = mt.GetTable();

            if (dt == null || dt.Rows.Count == 0 || !dt.Columns.Contains("i_weight"))
            {
                this.Cursor = Cursors.Default;
                MessageBox.Show(secid + "无详细信息!");
                return;
            }
            dt.Columns["i_weight"].DataType = typeof(float);
            dt.Columns.Add("CurrCycleValue", typeof(float));

            string[] sectors = new string[dt.Rows.Count];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                sectors[i] = dt.Rows[i]["wind_code"].ToString();
            }
            KDJGuidClass kdj = new KDJGuidClass(9, 3, 3);

            kdj.cycle    = (Cycle)this.ddl_cycle.SelectedIndex;
            kdj.priceAdj = (PriceAdj)this.ddl_priceAdj.SelectedIndex;
            GuidBuilder_ForWD gb    = new GuidBuilder_ForWD(this.gb.w, kdj);
            MTable            newdt = gb.getRecords(sectors, this.txt_EndT.Value);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["CurrCycleValue"] = newdt.GetTable().Rows[i][0];
            }
            if (this.ddl_cycle.SelectedIndex > 0)
            {
                dt.Columns.Add("LowCycleValue", typeof(float));
                kdj.cycle = (Cycle)this.ddl_cycle.SelectedIndex - 1;
                gb        = new GuidBuilder_ForWD(gb.w, kdj);
                newdt     = gb.getRecords(sectors, this.txt_EndT.Value);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dt.Rows[i]["LowCycleValue"] = newdt.GetTable().Rows[i][0];
                }
            }
            Form dlgfrm = new Form();

            DrawForm(dlgfrm);
            DataGridView ddgrid = new DataGridView();

            dlgfrm.Controls.Add(ddgrid);
            DrawGrid(ddgrid);
            //dataGridView1.CellMouseDoubleClick += new DataGridViewCellMouseEventHandler(dataGridView1_CellMouseDoubleClick);
            ddgrid.DataSource = dt;
            ddgrid.Tag        = dt;
            ddgrid.Show();
            dlgfrm.TopMost = true;
            dlgfrm.Text    = SecName;
            dlgfrm.ShowDialog(this);
            this.Cursor = Cursors.Default;
        }