大智慧6.03权息数据格式及读取过程步骤记录

Published

权息数据文件为 full.PWR 基本数据结构如下
struct pwr_Data
{
__time32_t t1;
float f1;
float f2;
float f3;
float f4;
};


导出数据格式为:
时间 送股 配股 配股价 分红
2008-10-31 0.300 0.000 0.000 0.034
2007-06-20 0.100 0.000 0.000 0.009
2003-09-29 0.000 0.000 0.000 0.150
2002-07-23 0.000 0.000 0.000 0.150
2000-11-06 0.000 0.300 8.000 0.000
1999-10-18 0.000 0.000 0.000 0.600
1997-08-25 0.500 0.000 0.000 0.200
1996-05-27 1.000 0.000 0.000 0.000
1995-09-25 0.200 0.000 0.000 0.300
1994-07-11 0.500 0.000 0.000 0.500
1994-07-09 0.000 0.100 5.000 0.000
1993-05-24 0.850 0.100 16.000 0.300
1992-03-23 0.500 0.000 0.000 0.200

full.pwr数据结构 
数据结构

大智慧level2的除权数据文件为\Download\PWR\full.PWR,数据以二进制格式存储,其格式如下 

 

00000000h: 32 C8 43 FF DD 83 CC FF FF FF FF FF 53 5A 30 30 ; 2菴?輧?????SZ00 
00000010h: 30 30 30 31 00 00 00 00 00 00 00 00 80 1F CD 29 ; 0001........?.? 
00000020h: 00 00 00 3F 00 00 00 00 00 00 00 00 CD CC 4C 3E ; ...?........吞L> 
00000030h: 00 10 00 2C 9A 99 59 3F 00 00 00 00 00 00 00 00 ; ...,殭Y?........ 
00000040h: 9A 99 99 3E 00 10 00 2C 00 00 00 00 CD CC CC 3D ; 殭?...,....吞? 
00000050h: 00 00 80 41 00 00 00 00 80 8B 20 2E 00 00 00 3F ; ..?A....??....? 
00000060h: 00 00 00 00 00 00 00 00 00 00 00 3F 80 E8 1D 2E ; ...........???. 
00000070h: 00 00 00 00 CD CC CC 3D 00 00 A0 40 00 00 00 00 ; ....吞?..燖.... 
00000080h: 00 F1 65 30 CD CC 4C 3E 00 00 00 00 00 00 00 00 ; .馿0吞L>........ 
00000090h: 9A 99 99 3E 80 F0 A8 31 00 00 80 3F 00 00 00 00 ; 殭??皎1..??.... 
000000a0h: 00 00 00 00 00 00 00 00 00 CB 00 34 00 00 00 3F ; .........?4...? 
000000b0h: 00 00 00 00 00 00 00 00 CD CC 4C 3E 00 63 0A 38 ; ........吞L>.c.8 
000000c0h: 00 00 00 00 00 00 00 00 00 00 00 00 9A 99 19 3F ; ............殭.? 
000000d0h: 80 F4 05 3A 00 00 00 00 9A 99 99 3E 00 00 00 ; ??:....殭?... 

 

从第13个字节开始就是分红数据,股票代码为8个字节,其后8个字节留空,后面是历次的分红日期及分红方式,最后以"FF FF FF FF"结束,如该股票没有分红记录则其记录长度为最小的20字节。一条分红记录占20个字节,依次是 

日期 4Byte,32位整数,距1970-01-01的秒数 

送股+转增股 4Byte,Single,每股送股数加每股转增股数,具体的方式此文件中没有记录 

配股 4Byte,Single,每股配股数 

配股价 4Byte,Single,每股配股价 

分红 4Byte,Single,每股分红 

 

以下是提取数据的原代码: 

BinaryReader sReader = new BinaryReader(File.Open(@"D:\Program Files\dzh2\Download\PWR\full.PWR", FileMode.Open)); 
sReader.BaseStream.Position = 12; 
int k; 
while(sReader.BaseStream.Length>sReader.BaseStream.Position) 

Console.WriteLine(System.Text.Encoding.Default.GetString(sReader.ReadBytes(8))); 
sReader.BaseStream.Position += 8; 
k = sReader.ReadInt32(); 
while (k > 0) 

Console.WriteLine(DateTime.Parse("1970-01-01").AddSeconds(k)); 
Console.WriteLine(sReader.ReadSingle()); 
Console.WriteLine(sReader.ReadSingle()); 
Console.WriteLine(sReader.ReadSingle()); 
Console.WriteLine(sReader.ReadSingle()); 
if (sReader.BaseStream.Length > sReader.BaseStream.Position) 
k = sReader.ReadInt32(); 
else 
break; 


sReader.Close();