Пример #1
0
 /// <summary>
 /// 复制数据
 /// </summary>
 /// <param name="data">数据</param>
 public void Copy(SecurityLatestDataLV2 data)
 {
     if (data == null)
     {
         return;
     }
     m_allBuyVol    = data.m_allBuyVol;
     m_allSellVol   = data.m_allSellVol;
     m_avgBuyPrice  = data.m_avgBuyPrice;
     m_avgSellPrice = data.m_avgSellPrice;
     m_buyVolume6   = data.m_buyVolume6;
     m_buyVolume7   = data.m_buyVolume7;
     m_buyVolume8   = data.m_buyVolume8;
     m_buyVolume9   = data.m_buyVolume9;
     m_buyVolume10  = data.m_buyVolume10;
     m_buyPrice6    = data.m_buyPrice6;
     m_buyPrice7    = data.m_buyPrice7;
     m_buyPrice8    = data.m_buyPrice8;
     m_buyPrice9    = data.m_buyPrice9;
     m_buyPrice10   = data.m_buyPrice10;
     m_securityCode = data.m_securityCode;
     m_sellVolume6  = data.m_sellVolume6;
     m_sellVolume7  = data.m_sellVolume7;
     m_sellVolume8  = data.m_sellVolume8;
     m_sellVolume9  = data.m_sellVolume9;
     m_sellVolume10 = data.m_sellVolume10;
     m_sellPrice6   = data.m_sellPrice6;
     m_sellPrice7   = data.m_sellPrice7;
     m_sellPrice8   = data.m_sellPrice8;
     m_sellPrice9   = data.m_sellPrice9;
     m_sellPrice10  = data.m_sellPrice10;
 }
Пример #2
0
 /// <summary>
 /// 控件添加方法
 /// </summary>
 public override void OnAdd()
 {
     base.OnAdd();
     if (m_gridTransaction == null)
     {
         m_latestData                    = new SecurityLatestData();
         m_latestDataLV2                 = new SecurityLatestDataLV2();
         m_gridTransaction               = new GridA();
         m_gridTransaction.BackColor     = COLOR.EMPTY;
         m_gridTransaction.BorderColor   = COLOR.EMPTY;
         m_gridTransaction.GridLineColor = COLOR.EMPTY;
         m_gridTransaction.HeaderVisible = false;
         m_gridTransaction.SelectionMode = GridSelectionMode.SelectNone;
         AddControl(m_gridTransaction);
         GridColumn dateColumn = new GridColumn();
         dateColumn.Width = 80;
         m_gridTransaction.AddColumn(dateColumn);
         GridColumn priceColumn = new GridColumn();
         priceColumn.Width = 70;
         m_gridTransaction.AddColumn(priceColumn);
         GridColumn volumeColumn = new GridColumn();
         volumeColumn.Width = 100;
         m_gridTransaction.AddColumn(volumeColumn);
         m_gridTransaction.Update();
     }
 }
Пример #3
0
 /// <summary>
 /// 比较是否相同
 /// </summary>
 /// <param name="data">数据</param>
 /// <returns>是否相同</returns>
 public bool Equal(SecurityLatestDataLV2 data)
 {
     if (data == null)
     {
         return(false);
     }
     if (m_allBuyVol == data.m_allBuyVol &&
         m_allSellVol == data.m_allSellVol &&
         m_avgBuyPrice == data.m_avgBuyPrice &&
         m_avgSellPrice == data.m_avgSellPrice &&
         m_buyVolume6 == data.m_buyVolume6 &&
         m_buyVolume7 == data.m_buyVolume7 &&
         m_buyVolume8 == data.m_buyVolume8 &&
         m_buyVolume9 == data.m_buyVolume9 &&
         m_buyVolume10 == data.m_buyVolume10 &&
         m_buyPrice6 == data.m_buyPrice6 &&
         m_buyPrice7 == data.m_buyPrice7 &&
         m_buyPrice8 == data.m_buyPrice8 &&
         m_buyPrice9 == data.m_buyPrice9 &&
         m_buyPrice10 == data.m_buyPrice10 &&
         m_securityCode == data.m_securityCode &&
         m_sellVolume6 == data.m_sellVolume6 &&
         m_sellVolume7 == data.m_sellVolume7 &&
         m_sellVolume8 == data.m_sellVolume8 &&
         m_sellVolume9 == data.m_sellVolume9 &&
         m_sellVolume10 == data.m_sellVolume10 &&
         m_sellPrice6 == data.m_sellPrice6 &&
         m_sellPrice7 == data.m_sellPrice7 &&
         m_sellPrice8 == data.m_sellPrice8 &&
         m_sellPrice9 == data.m_sellPrice9 &&
         m_sellPrice10 == data.m_sellPrice10)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #4
0
        /// <summary>
        /// 获取实时数据L2
        /// </summary>
        /// <param name="dataInfo"></param>
        /// <param name="datas"></param>
        /// <param name="body"></param>
        /// <param name="bodyLength"></param>
        /// <returns></returns>
        public static int GetLatestDatasLV2(ref LatestDataInfoLV2 dataInfo, List <SecurityLatestDataLV2> datas, byte[] body, int bodyLength)
        {
            Binary binary = new Binary();

            binary.Write(body, bodyLength);
            dataInfo.m_size = binary.ReadInt();
            for (int i = 0; i < dataInfo.m_size; i++)
            {
                SecurityLatestDataLV2 item = new SecurityLatestDataLV2();
                item.m_securityCode = binary.ReadString();
                item.m_allBuyVol    = binary.ReadDouble();
                item.m_avgBuyPrice  = binary.ReadFloat();
                item.m_allSellVol   = binary.ReadDouble();
                item.m_avgSellPrice = binary.ReadFloat();
                item.m_buyVolume6   = binary.ReadInt();
                item.m_buyPrice6    = binary.ReadFloat();
                item.m_buyVolume7   = binary.ReadInt();
                item.m_buyPrice7    = binary.ReadFloat();
                item.m_buyVolume8   = binary.ReadInt();
                item.m_buyPrice8    = binary.ReadFloat();
                item.m_buyVolume9   = binary.ReadInt();
                item.m_buyPrice9    = binary.ReadFloat();
                item.m_buyVolume10  = binary.ReadInt();
                item.m_buyPrice10   = binary.ReadFloat();
                item.m_sellVolume6  = binary.ReadInt();
                item.m_sellPrice6   = binary.ReadFloat();
                item.m_sellVolume7  = binary.ReadInt();
                item.m_sellPrice7   = binary.ReadFloat();
                item.m_sellVolume8  = binary.ReadInt();
                item.m_sellPrice8   = binary.ReadFloat();
                item.m_sellVolume9  = binary.ReadInt();
                item.m_sellPrice9   = binary.ReadFloat();
                item.m_sellVolume10 = binary.ReadInt();
                item.m_sellPrice10  = binary.ReadFloat();
                datas.Add(item);
            }
            binary.Close();
            return(1);
        }
Пример #5
0
 /// <summary>
 /// 调用控件线程方法
 /// </summary>
 /// <param name="args">参数</param>
 public override void OnInvoke(object args)
 {
     base.OnInvoke(args);
     if (args != null)
     {
         CMessage message = (CMessage)args;
         if (message.m_requestID == m_requestID)
         {
             //分时数据
             if (message.m_functionID == QuoteService.FUNCTIONID_QUOTE_PUSHLATESTDATA)
             {
                 LatestDataInfo            dataInfo = new LatestDataInfo();
                 List <SecurityLatestData> datas    = new List <SecurityLatestData>();
                 QuoteService.GetLatestDatas(ref dataInfo, datas, message.m_body, message.m_bodyLength);
                 SecurityLatestData latestData = datas[0];
                 if (latestData != null && latestData.m_securityCode == m_securityCode &&
                     !latestData.Equal(m_latestData))
                 {
                     m_latestData = latestData;
                     //设置保留小数的位数
                     int digit = 2;
                     if (m_latestData.m_securityCode.StartsWith("1") || m_latestData.m_securityCode.StartsWith("5"))
                     {
                         digit = 3;
                     }
                     m_chart.Digit = digit;
                     m_chart.RefreshData();
                 }
             }
             //LV2分时数据
             else if (message.m_functionID == QuoteService.FUNCTIONID_QUOTE_PUSHLATESTDATALV2)
             {
                 LatestDataInfoLV2            dataInfo = new LatestDataInfoLV2();
                 List <SecurityLatestDataLV2> datas    = new List <SecurityLatestDataLV2>();
                 QuoteService.GetLatestDatasLV2(ref dataInfo, datas, message.m_body, message.m_bodyLength);
                 SecurityLatestDataLV2 latestDataLV2 = datas[0];
                 if (latestDataLV2 != null && latestDataLV2.m_securityCode == m_securityCode &&
                     !latestDataLV2.Equal(m_latestDataLV2))
                 {
                     m_latestDataLV2 = latestDataLV2;
                 }
             }
             //成交数据
             else if (message.m_functionID == QuoteService.FUNCTIONID_QUOTE_PUSHTRANSACTIONDATA)
             {
                 String securityCode = "";
                 List <TransactionData> transactionDatas = new List <TransactionData>();
                 QuoteService.GetTransactionDatas(ref securityCode, transactionDatas, message.m_body, message.m_bodyLength);
                 int transactionDatasSize = transactionDatas.Count;
                 for (int i = 0; i < transactionDatasSize; i++)
                 {
                     TransactionData transactionData = transactionDatas[i];
                     DateTime        date            = CStrA.ConvertNumToDate(transactionData.m_date);
                     GridRow         row             = new GridRow();
                     m_gridTransaction.InsertRow(0, row);
                     TransactionDateCell dateCell = new TransactionDateCell();
                     dateCell.Text = date.ToString("HH:mm:ss");
                     row.AddCell(0, dateCell);
                     GridCellStyle dateCellStyle = new GridCellStyle();
                     dateCellStyle.BackColor = COLOR.EMPTY;
                     dateCellStyle.Font      = new FONT("SimSun", 14, true, false, false);
                     dateCellStyle.ForeColor = CDraw.PCOLORS_FORECOLOR2;
                     dateCell.Style          = dateCellStyle;
                     TransactionDataDoubleCell priceCell = new TransactionDataDoubleCell();
                     priceCell.Digit = 2;
                     priceCell.SetDouble(transactionData.m_price);
                     row.AddCell(1, priceCell);
                     GridCellStyle priceCellStyle = new GridCellStyle();
                     priceCellStyle.BackColor = COLOR.EMPTY;
                     priceCellStyle.Font      = new FONT("SimSun", 14, true, false, false);
                     priceCellStyle.ForeColor = CDraw.GetPriceColor(transactionData.m_price, m_latestData.m_lastClose);
                     priceCell.Style          = priceCellStyle;
                     TransactionDataDoubleCell volumeCell = new TransactionDataDoubleCell();
                     volumeCell.SetDouble(transactionData.m_volume);
                     row.AddCell(2, volumeCell);
                     GridCellStyle volumeCellStyle = new GridCellStyle();
                     volumeCellStyle.BackColor = COLOR.EMPTY;
                     volumeCellStyle.Font      = new FONT("SimSun", 14, true, false, false);
                     if (transactionData.m_type == 0)
                     {
                         volumeCellStyle.ForeColor = CDraw.PCOLORS_FORECOLOR;
                     }
                     else if (transactionData.m_type == 1)
                     {
                         volumeCellStyle.ForeColor = CDraw.PCOLORS_UPCOLOR;
                     }
                     else
                     {
                         volumeCellStyle.ForeColor = CDraw.PCOLORS_DOWNCOLOR;
                     }
                     volumeCell.Style = volumeCellStyle;
                 }
                 m_gridTransaction.Update();
             }
         }
         Invalidate();
     }
 }