| 
 
| 
 
 
 
 
 
 
| Blog信息 |  
| blog名称:注册会计师(注会)练习软件日志总数:398
 评论数量:116
 留言数量:27
 访问次数:3278583
 建立时间:2005年6月6日
 |   
 
 |  | 
 
|  [delpih编程]取股票日线代码 软件技术
 吕向阳 发表于 2012/9/19 20:14:15  |  
| 
| unit USTOCKS;
interface
uses system.IO;const HS = 85;type  dayline = record    date: double;    startj: double;    maxj: double;    minj: double;    endj: double;    a6: double;    totalsl: double;    a8: double;  end;
type  xSTOCKS = class  private    { Private Declarations }    fcount: integer;    fmax, fmin: double;  public    lines: array of dayline;    procedure GETFROMFILE();    property count: integer read fcount ;    property max: double read fmax;    property min: double read fmin;    function  GETMC(DM:STRING):string;  end;
implementation
procedure xSTOCKS.GETFROMFILE;var fs: filestream;  myreader: binaryreader;  i: integer;  length: integer;begin  fmax := 0;
  fs := filestream.Create('C:\同花顺核新\history\shase\day\600806.day', filemode.Open, fileaccess.Read);  myreader := binaryreader.Create(fs);
//  length := convert.ToInt16((fs.get_Length - 64) / 48);  length := convert.ToInt16((fs.get_Length - 72) / 56);  fcount:=length;  fs.Seek(72, SeekOrigin.&Begin);
  if length >= HS then  begin    setlength(lines, HS);    fs.seek((length - HS) * 56, seekorigin.Current);    fcount := HS;  end  else  begin    setlength(lines, length);    fcount := length;  end;
  for I := 0 to fcount - 1 do  begin    //读取数据    lines[i].date := myreader.ReadInt32;    lines[i].startj := (myreader.ReadInt32 shl 8 shr 8) / 1000;    lines[i].maxj := (myreader.ReadInt32 shl 8 shr 8) / 1000;
    if (fmax < lines[i].maxj) then      fmax := lines[i].maxj;
    lines[i].minj := (myreader.ReadInt32 shl 8 shr 8) / 1000;    if (i = 0) then      fmin := lines[i].minj    else      if (fmin > lines[i].minj) then        fmin := lines[i].minj;
    lines[i].endj := (myreader.ReadInt32 shl 8 shr 8) / 1000;    fs.Seek(36, SeekOrigin.Current);  //  end;  myreader.Close;  fs.Close;end;
 
function xSTOCKS.GETMC(DM: STRING):string;var fs: filestream;  myreader: binaryreader;  i: integer;  length: integer;  GPDM,GPNAME:STRING;
begin  {fmax := 0;
  fs := filestream.Create('C:\同花顺核新\realtime\shase\STOCKNOW.DAT', filemode.Open, fileaccess.Read);  myreader := binaryreader.Create(fs);
  length := convert.ToInt16((fs.get_Length - 64) / 48);  fs.Seek(176, SeekOrigin.&Begin);
//  for I:=0 to LENGTH - 1 do  BEGIN //   fs.Seek(1, SeekOrigin.Current);    GPDM:=copy(MYREADER.ReadString,0);  end;
  myreader.Close;  fs.Close;}  result:='';end;
end. |  
 |  
 
 
 
 |