예제 #1
0
        public static TickData ConvertFromDataRow(DataRow dr)
        {
            TickData td = new TickData();

            td.Code = dr["tick_code"].ToString();
            //td.market = System.Convert.ToByte(dr["tick_market"]);
            td.secInfo  = GlobalValue.GetFutureByCode(td.code)[0];
            td.Time     = System.Convert.ToDateTime(dr["tick_time"]);
            td.Preclose = 0;
            td.Open     = 0;
            td.High     = 0;
            td.Low      = 0;
            td.Ask      = System.Convert.ToDouble(dr["tick_ask1"]);
            td.Bid      = System.Convert.ToDouble(dr["tick_bid1"]);
            td.Last     = Math.Round((td.Ask + td.Bid) / 2, 2, MidpointRounding.AwayFromZero);
            td.Volume   = 0;
            td.Amt      = 0;

            td.isReal = false;
            for (int i = 0; i < 10; i++)
            {
                td.Asks[i]     = System.Convert.ToDouble(dr[string.Format("tick_ask{0}", i + 1)]);
                td.Bids[i]     = System.Convert.ToDouble(dr[string.Format("tick_bid{0}", i + 1)]);
                td.Asksizes[i] = System.Convert.ToDouble(dr[string.Format("tick_asks{0}", i + 1)]);
                td.Bidsizes[i] = System.Convert.ToDouble(dr[string.Format("tick_bids{0}", i + 1)]);
            }
            return(td);
        }
 private void grid_list_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         DataGridViewRow dr     = this.grid_list.Rows[e.RowIndex];
         string          code   = dr.Cells[0].Value.ToString();
         string          name   = dr.Cells[1].Value.ToString();
         string          market = dr.Cells[2].Value.ToString();
         SecurityInfo    si     = GlobalValue.GetFutureByCodeAndMarket(code, market);
         if (Stock_Selected != null)
         {
             Stock_Selected(this, si);
         }
     }
 }