期货量化交易客户端开源教学第十节——行情列表

行情列表数据

行情列表数据接收

         行情列表接收到的数据根据接收到的数据进行字符处理。为了方便查看行情数据针对每个字段进行显示控制,并可根据显示器自动适配列宽。

发送命令:2

数据接受返回的格式:

2;13;1720682964;000;12021.00;24;12020.00;12020.00;77;0;0;182560;912607;11908.00;12021.00;12059.00;11899.00;0;11911.00;167886;0;11911.00;

数据接受返回的格式:2;商品ID;更新时间;更新毫秒;卖1;卖1量;现价;买1;买1量;涨停板价;跌停板价;成交量;持仓量;今开盘;今收盘;最高价;最低价;当日均价;昨收盘;昨持仓量;成交金额;昨日结算价格;

行情列表数据接收处理代码

if strList.Strings[0] = '2' then
  begin
    try
      for I := 0 to Length(VGStocks) - 1 do
      begin
        if VGStocks[I].id = strList.Strings[1] then
        begin
          try
            strBodong := FloatToStr(VGStocks[I].smallest_fluctuation);
          except
          end;
          VGStocks[I].curr_unix_datetime := strList.Strings[2];
          VGStocks[I].curr_time := FormatDateTime('YYYY-MM-DD hh:mm:ss ',UnixToDateTime(StrToInt(strList.Strings[2])+28800)) + strList.Strings[3];
          if StrToFloat(strList.Strings[4]) <= 0  then
            VGStocks[I].sell_price := '--'
          else
            VGStocks[I].sell_price := FormatDigital(strBodong,strList.Strings[4]);
          VGStocks[I].sell_num := FormatDigital('0',strList.Strings[5]);
          if StrToFloat(strList.Strings[6]) <= 0  then
            VGStocks[I].curr_price := '--'
          else
            VGStocks[I].curr_price := FormatDigital(strBodong,strList.Strings[6]);
          if StrToFloat(strList.Strings[7]) <= 0  then
            VGStocks[I].buy_price := '--'
          else
            VGStocks[I].buy_price := FormatDigital(strBodong,strList.Strings[7]);
          VGStocks[I].buy_num := FormatDigital('0',strList.Strings[8]);
          if StrToFloat(strList.Strings[9]) <= 0 then
            VGStocks[I].harden_price := '--'
          else
            VGStocks[I].harden_price := FormatDigital(strBodong,strList.Strings[9]);
          if StrToFloat(strList.Strings[10]) <= 0 then
            VGStocks[I].dropstop_price := '--'
          else
            VGStocks[I].dropstop_price := FormatDigital(strBodong,strList.Strings[10]);
          VGStocks[I].deal_num := FormatDigital('0',strList.Strings[11]);
          VGStocks[I].position_num := FormatDigital('0',strList.Strings[12]);
          if StrToFloat(strList.Strings[13]) <= 0 then
            VGStocks[I].open_price := '--'
          else
            VGStocks[I].open_price := FormatDigital(strBodong,strList.Strings[13]);
          if StrToFloat(strList.Strings[14]) <= 0 then
            VGStocks[I].close_price := '--'
          else
            VGStocks[I].close_price := FormatDigital(strBodong,strList.Strings[14]);
          if StrToFloat(strList.Strings[15]) <= 0 then
            VGStocks[I].highest_price := '--'
          else
            VGStocks[I].highest_price := FormatDigital(strBodong,strList.Strings[15]);
          if StrToFloat(strList.Strings[16]) <= 0 then
            VGStocks[I].lowest_price := '--'
          else
            VGStocks[I].lowest_price := FormatDigital(strBodong,strList.Strings[16]);
          if StrToFloat(strList.Strings[17]) <= 0 then
            VGStocks[I].average_price := '--'
          else
            VGStocks[I].average_price := FormatDigital(strBodong,strList.Strings[17]);
          if StrToFloat(strList.Strings[18]) <= 0 then
            VGStocks[I].yesterday_close_price := '--'
          else
            VGStocks[I].yesterday_close_price := FormatDigital(strBodong,strList.Strings[18]);
          if FormatDigital('0',strList.Strings[19]) = '0' then
            VGStocks[I].yesterday_position_num := '--'
          else
            VGStocks[I].yesterday_position_num := FormatDigital('0',strList.Strings[19]);
          if StrToFloat(strList.Strings[20]) <= 0 then
            VGStocks[I].deal_jine := '--'
          else
            VGStocks[I].deal_jine := FormatDigital(strBodong,strList.Strings[20]);
          if StrToFloat(strList.Strings[21]) <= 0 then
            VGStocks[I].yesterday_jiesuan := '--'
          else
            VGStocks[I].yesterday_jiesuan := FormatDigital(strBodong,strList.Strings[21]);
          VGStocks[I].ups_downs := FloatToStr( StrToFloat(VGStocks[I].curr_price) - StrToFloat(VGStocks[I].yesterday_jiesuan));   {涨跌=现价-昨结算价}
          VGStocks[I].ups_downs_perc := Format('%0.2f',[StrToFloat(VGStocks[I].ups_downs) / StrToFloat(VGStocks[I].yesterday_jiesuan) * 100]) + '%';
          for J := 0 to Length(ArrMarketFuture) - 1 do
          begin
            if Assigned(ArrMarketFuture[J]) then
              ArrMarketFuture[J].refreshFutureData(I);
          end;

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-13 10:20:06       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-13 10:20:06       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-13 10:20:06       58 阅读
  4. Python语言-面向对象

    2024-07-13 10:20:06       69 阅读

热门阅读

  1. 【第33章】MyBatis-Plus之预防安全漏洞

    2024-07-13 10:20:06       28 阅读
  2. 【安全设备】上网行为管理

    2024-07-13 10:20:06       26 阅读
  3. 智能小车——底层配置

    2024-07-13 10:20:06       27 阅读
  4. PCIe总线的序

    2024-07-13 10:20:06       26 阅读
  5. 怎么知道服务器100M带宽可以支持多少人访问?

    2024-07-13 10:20:06       27 阅读
  6. [AI 大模型] Meta LLaMA-2

    2024-07-13 10:20:06       28 阅读
  7. Oracle逻辑备份

    2024-07-13 10:20:06       23 阅读
  8. c#视觉应用开发中如何在C#中处理图像噪声?

    2024-07-13 10:20:06       28 阅读
  9. 【ceph】ceph-mon重新选举的情况

    2024-07-13 10:20:06       27 阅读
  10. SpringBoot配置Swagger开启页面访问限制

    2024-07-13 10:20:06       26 阅读
  11. MFC常用数据类型类:CRect

    2024-07-13 10:20:06       26 阅读