转帖保存,据为己用。
转自:http://blog.myspace.cn/e/406490764.htm
日线数据文件day.dat
数据格式几乎与分析家相同,0到17h为文件头, 从18h开始至40017h每64byte为一条股票数据索引记录,从41000h开始每8KB(8192)为一股票数据存储块,系统对每个股票日线数据存储以存储块为单位进行分配。每个股票数据存储块共存储256条ohlc记录,每条ohlc记录长度为32byte.
文件头
起止地址 数据内容 数据含义 数据类型
00 - 03 F4 9B 13 FC 文件标志 int
04 - 07 00 06 00 00 未知 int
08 - 0B 00 00 00 00 保留 int
0C - 0F 97 04 00 00 证券总数 int
10 - 13 00 18 00 00 未知 int 需添加之起始块号
14 - 17 DB 17 00 00 未知 int 当前最后空块号
索引记录格式
0x18起每64byte为一组索引数据.内容为:
证券代码 byte[10]
ohlc记录数 int
第一个记录块号short
第二个记录块号 short
......
第25个记录块号short
记录块号为FFFF表示未分配.从41000h开始的8KB为第0号数据存储块.
ohlc记录格式
日期 int
开盘价 float
最高价 float
最低价 float
收盘价 float
成交量 float
成交金额 float
上涨家数 short
下跌家数 short
日期字段从1970年01月01日开始的秒数.
5分钟数据文件min.dat
文件名:"MIN.DAT"文件头格式与日线数据文件格式相同
1分钟数据文件min1.dat
文件名:"MIN1.DAT"
文件头格式与日线数据文件格式相同,但每一股票数据块长度是12288(12kB)
STKINFO60.dat
最新行情
起始位置:0x866340,
记录长度:1089(17*64 + 1)
格式:
证券代码 byte[10]
简称 byte[32]
"dm,代码,code,10,0,0,;" +
"jc,简称,string,32,1,10,;" +
"rq,更新时间,datetime,4,5,60,;" +
"zs,昨收,single,4,7,68,;" +
"kp,今开,single,4,8,72,;" +
"zg,最高,single,4,9,76,;" +
"zd,最低,single,4,10,80,;" +
"sp,最新,single,4,11,84,;" +
"sl,总手数,single,4,12,88,;" +
"je,金额,single,4,13,92,;" +
"xss,现手数,single,4,14,96,;" +
"ztj,涨停价,single,4,27,184,;" +
"dtj,跌停价,single,4,28,188,;" +
"np,内盘,single,4,27,192,;" +
"wp,外盘,single,4,28,196,;" +
"mrjg1,买一价,single,4,15,100,;" +
"mrsl1,买一量,single,4,18,120,;" +
"mrjg2,买二价,single,4,16,104,;" +
"mrsl2,买二量,single,4,19,124,;" +
"mrjg3,买三价,single,4,17,108,;" +
"mrsl3,买三量,single,4,20,128,;" +
"mrjg4,买四价,single,4,32,112,;" +
"mrsl4,买四量,single,4,34,132,;" +
"mrjg5,买五价,single,4,33,116,;" +
"mrsl5,买五量,single,4,35,136,;" +
"mcjg1,卖一价,single,4,21,140,;" +
"mcsl1,卖一量,single,4,24,160,;" +
"mcjg2,卖二价,single,4,22,144,;" +
"mcsl2,卖二量,single,4,25,164,;" +
"mcjg3,卖三价,single,4,23,148,;" +
"mcsl3,卖三量,single,4,26,168,;" +
"mcjg4,卖四价,single,4,36,152,;" +
"mcsl4,卖四量,single,4,38,172,;" +
"mcjg5,卖五价,single,4,37,156,;" +
"mcsl5,卖五量,single,4,39,176,";
//"jd,精度,int,4,3,52,;" +
//"scbz,删除标志,int,4,4,56,";
//"unknown,(未知),int,4,31,164,;" +
//",(未知),,48,40,200,;"
分笔成交数据文件report.dat(结构同day.dat,但其中一些数据不是直接保存)
case DataTypes.hqmb:
fileName = "REPORT.DAT";
startAddress = 0x41000;
blockSize = 12272;
recordSize = 52;
codeIsLong = false;
isIndexDataStruct = false;//不完全等同于day.dat结构,因此单独处理
fieldString =
"dm,代码,code,10,0,0,;" +
"rq,日期,datetime,4,0,0,;" +
"zjcj,最近成交价,single,4,1,4,;" +
"zss,总手数,single,4,2,8,calc;" +
"je,金额,single,4,3,12,;" +
"xss,现手数,single,4,2,8,;" +
"mm,内外盘,string,2,16,21,;" +
"mr1jg,买一价,single,1,10,42,;" +
"mr1sl,买一量,single,2,4,22,;" +
"mr2jg,买二价,single,1,11,43,;" +
"mr2sl,买二量,single,2,5,24,;" +
"mr3jg,买三价,single,1,12,44,;" +
"mr3sl,买三量,single,2,6,26,;" +
"mr4jg,买四价,single,1,12,45,;" +
"mr4sl,买四量,single,2,6,28,;" +
"mr5jg,买五价,single,1,12,46,;" +
"mr5sl,买五量,single,2,6,30,;" +
"mc1jg,卖一价,single,1,13,47,;" +
"mc1sl,卖一量,single,2,7,32,;" +
"mc2jg,卖二价,single,1,14,48,;" +
"mc2sl,卖二量,single,2,8,34,;" +
"mc3jg,卖三价,single,1,15,49,;" +
"mc3sl,卖三量,single,2,9,36,;"+
"mc4jg,卖四价,single,1,14,50,;" +
"mc4sl,卖四量,single,2,8,38,;" +
"mc5jg,卖五价,single,1,14,51,;" +
"mc5sl,卖五量,single,2,8,40,;" +
"bs,总笔数,int,2,0,16,"
;
//以上数据类型不是存储类型,程序中不直接用实际数据类型:买/卖X量为short,买/卖X价为byte
//现手数通过当总手数计算而得,应该放在总手数后面
大智慧新一代Level-2 分笔成交数据格式
起止地址 数据内容 数据含义 数据类型
00 - 03 F4 9B 13 FC 日线文件标志 int
04 - 07 10 02 00 00 未知 int
08 - 0B 00 43 DF 46 1970.01.01 00:00:00始的秒数 int
0C - 0F 5D 05 00 00 证券总数 int
10 - 13 ED 20 00 00 未知 int
14 - 17 ED 20 00 00 未知 int
18 - 21 30 30 30 30 30 31 00 00 证券代码 byte[10]
22 - 25 9C 12 00 00 日分笔记录数 int
26 - 57 00 00 BA 03...FF FF 记录块号 char[25]
00041000 记录页起始点,
每记录长: 0x34 = 52
每页记录数: 0xEC = 236
每页长: 每记录长0x34 * 每页记录数0xEC = 0x2FF0 = 12272
地 址 数据内容 数据含义 数据类型
41000 - 41003 35 FA DF 46 1970.01.01 00:00:00 始的秒数 int
41004 - 41007 00 00 18 41 最新价 float
41008 - 4100B 00 80 B4 43 累计成交量 float
4100C - 4100F 80 46 A7 48 累计成交金额 float
41010 - 41011 51 9C 累计成交笔数 char
41012 - 41013 00 00 未知 char
41014 10 累计成交笔数的溢出标志(00|10) byte
41015 80 买入,卖出标识(80|E0买入,C0|A0卖出) byte
41016 - 41017 23 01 委买量1 char
41018 - 41019 8E 5B 委买量2 char
4101A - 4101B 80 27 委买量3 char
4101C - 4101D 8E 5B 委买量4 char
4101E - 4101F B8 40 委买量5 char
41020 - 41021 23 01 委卖量1 char
41022 - 41023 8E 5B 委卖量2 char
41024 - 41025 80 27 委卖量3 char
41026 - 41027 8E 5B 委卖量4 char
41028 - 41029 B8 40 委卖量5 char
4102A 16 委买价1 与成交价的差 byte
4102B 9A 委买价2 与成交价的差 byte
4102C 80 委买价3 与成交价的差 byte
4102D 40 委卖价4 与成交价的差 byte
4102E 30 委卖价5 与成交价的差 byte
4102F 57 委卖价1 与成交价的差 byte
41030 68 委卖价2 与成交价的差 byte
41031 69 委卖价3 与成交价的差 byte
41032 7A 委卖价4 与成交价的差 byte
41033 81 委卖价5 与成交价的差 byte
注意:
2、数据类型为JAVA数据类型定义,实际读数据时应该将数据十六进制取反,如:41000 - 41003的数据为 35 FA DF 46,实际应该读成:
0x46DFFA35 = 1189083701, 这个1189083701值就是距1970.01.01 00:00:00 始的实际秒数。其他int,float,char都是这样取反的。
3、委买卖与成交价的差,是小数点后的整数差,如果买卖标识为80或C0,成交价小数点后是两位(股票),如果买卖标识为E0或A0,
成交价小数点后是三位(权证等)
4、累计成交笔数如果溢出,则41014位上的值不为00,而是10或者20,30等,成交笔数计算方法应为:41014位上的值反转,
10转为01,20转为02。。。 再与41010 - 41011位上的值合并成一个16进制串。
5、记录块号计算方法:char[0] = 0x00 第一个记录块起始地址为:41000h + 0x0000 * 0x2FF0 = 41000h,char[1] = 0x03BA
则第二个记录块起始地址为:41000h + 0x03BA * 0x2FF0 = 0x00077F78
近日发现Level-2的逐笔成交数据是缓存在dzh2/data/sh/TEMP目录下,文件名以证券代码为名,后辍是.L2D,如果重启大智慧,L2D文件会全部被删除,而且临时文件只有在浏览过该证券的逐笔成交后才会生成,不过花的时间也不算太多。
通过数据来分析大盘走势,还有通过行业数据异动,发现基金等大资金的中短期目标,这点也非常之重要。
财务数据(简单)STKINFO60.dat
case DataTypes.cw0:
fileName = "STKINFO60.DAT";
startAddress = 0x4c2a;
blockSize = 2227;
recordSize = 273;//196
codeIsLong = false;
isIndexDataStruct = false;
fieldString =
"dm,代码,code,10,0,0,;" +
"rq,报告期,date,4,0,4,;" +
"gxrq,更新日期,date,4,0,0,;" +
"ssrq,上市日期,date,4,0,8,;" +
"col1,每股收益,single,4,0,12,;" +
"col2,每股净资产,single,4,0,16,;" +
"col3,净资产收益率,single,4,0,20,;" +
"col4,每股经营现金,single,4,0,24,;" +
"col5,每股公积金,single,4,0,28,;" +
"col6,每股未分配,single,4,0,32,;" +
"col7,股东权益比,single,4,0,36,;" +
"col8,净利润同比,single,4,0,40,;" +
"col9,主营收入同比,single,4,0,44,;" +
"col10,销售毛利率,single,4,0,48,;" +
"col11,调整每股净资产,single,4,0,52,;" +
"col12,总资产,single,4,0,56,;" +
"col13,流动资产,single,4,0,60,;" +
"col14,固定资产,single,4,0,64,;" +
"col15,无形资产,single,4,0,68,;" +
"col16,流动负债,single,4,0,72,;" +
"col17,长期负债,single,4,0,76,;" +
"col18,总负债,single,4,0,80,;" +
"col19,股东权益,single,4,0,84,;" +
"col20,资本公积金,single,4,0,88,;" +
"col21,经营现金流量,single,4,0,92,;" +
"col22,投资现金流量,single,4,0,96,;" +
"col23,筹资现金流量,single,4,0,100,;" +
"col24,现金增加额,single,4,0,104,;" +
"col25,主营收入,single,4,0,108,;" +
"col26,主营利润,single,4,0,112,;" +
"col27,营业利润,single,4,0,116,;" +
"col28,投资收益,single,4,0,120,;" +
"col29,营业外收支,single,4,0,124,;" +
"col30,利润总额,single,4,0,128,;" +
"col31,净利润,single,4,0,132,;" +
"col32,未分配利润,single,4,0,136,;" +
"col33,总股本,single,4,0,140,;" +
"col34,无限售股合计,single,4,0,144,;" +
"col35,A股,single,4,0,148,;" +
"col36,B股,single,4,0,152,;" +
"col37,境外上市股,single,4,0,156,;" +
"col38,其他流通股,single,4,0,160,;" +
"col39,限售股合计,single,4,0,164,;" +
"col40,国家持股,single,4,0,168,;" +
"col41,国有法人股,single,4,0,172,;" +
"col42,境内法人股,single,4,0,176,;" +
"col43,境内自然人股,single,4,0,180,;" +
"col44,其他发起人股,single,4,0,184,;" +
"col45,募集法人股,single,4,0,188,;" +
"col46,境外法人股,single,4,0,192,;" +
"col47,境外自然人股,single,4,0,196,;" +
"col48,优先股或其他,single,4,0,200,";
分红送配STKINFO60.dat
case DataTypes.cq:
fileName = "STKINFO60.DAT";
startAddress = 0x44aa;
blockSize = 2227;
recordSize = 20;
codeIsLong = false;
isIndexDataStruct = false;
fieldString =
"dm,代码,code,10,0,0,;" +
"rq,日期,date,4,0,0,;" +
"sgbl,送股比例,single,4,1,4,;" +
"pgbl,配股比例,single,4,2,8,;" +
"pgjg,配股价格,single,4,3,12,;" +
"fh,分红,single,4,4,16,";