Hunter的大杂烩 技术学习笔记

2008-04-05

股票数据格式大全

Filed under: C++,技术话题 — hunter @ 2:08 am

看到一个牛人的blog,收集了大部分炒股软件的数据格式大全,真是为人民服务啊!

http://alantop.5166.info/gpDataFormat.html (http://www.cppblog.com/alantop/)

另外一个blog:

http://www.cnblogs.com/same/articles/722400.html

顺便帖上同花顺的格式,对俺比较有用:)

如何编程实现解析同花顺日线数据格式

日数据为48个字节一天,文件头为64个字节n = (fs.Length – 64) / 48 ‘可得天数,详细代码如下
VB.net 2005
Case 3 ‘同花顺
n = (fs.Length – 64) / 48 ‘文件头占64个字节
LoadDayData = n
ReDim dr(n)
For i = 1 To 8
br.ReadInt64() ‘读8次64位内存块以越过文件头
Next
For i = 1 To n
Dim d As Integer = br.ReadInt32()
j = j + 1
dr(j).stockdate = DateSerial(d / 10000, (d Mod 10000) / 100, d Mod 100) ‘日期占4个字节
dr(j).openor = (br.ReadUInt32 And &HFFFFFFF) / 1000 ‘用无符号32位整型,目前只发现B0开头,所以只 

                                                                             需除以1000,不判断,但最好做个异常分支
dr(j).hightor = (br.ReadUInt32 And &HFFFFFFF) / 1000
dr(j).lowor = (br.ReadUInt32 And &HFFFFFFF) / 1000
dr(j).endor = (br.ReadUInt32 And &HFFFFFFF) / 1000
br.ReadInt32() ‘越过数据,不影响对数据基本数据的获取
dr(j).changor = br.ReadInt32 ‘(单位手数),成交量,也是32位,可以用无符号整型去读
If dr(j).changor < 0 Then '以B0 开头 dr(j).changor = (dr(j).changor And &HFFFFFFF) / 1000 ElseIf dr(j).changor > 0 Then ‘这里需要改进 目前发现 90开头
dr(j).changor = dr(j).changor / 100
Else
‘ ……
End If
br.ReadInt32() ‘把纪录尾端读完,共20个字节
br.ReadInt64()
br.ReadInt64()
‘其实以上越过的数据包含信息为数值,涨幅,振幅,总金额,换手,其实一个日纪录48个字节就只要4个字节未用到的了
Next
case 4 ‘大智慧level2
‘…….

牛人整理的格式文件

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress