Read China Stock History Data Of Tdx With Python
下载通达信历史日线数据
在通达信软件菜单中选择下载历史数据->日线数据
在磁盘中查找数据
打开Windows文件管理器,查找*.day,在windows7中可以找到如下目录
C:\Users\<user>\AppData\Local\VirtualStore\Program Files (x86)\CiticCs\new_zx_sum\vipdoc\sz\lday
C:>cd C:\Users\userabc\AppData\Local\VirtualStore\Program Files (x86)\CiticCs\new_zx_sum\vipdoc\sz\lday
C:>dir
2013/02/20 10:36 <DIR> .
2013/02/20 10:36 <DIR> ..
2013/02/20 10:34 896 sz000001.day
...
使用python检查
执行python解释器
C:>python Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> f=open('sz000001.day','rb') # 日期 >>> struct.unpack('l',d[0:4]) (20130104,) #开盘价 (rmb * 100) >>> struct.unpack('l',d[4:8]) (1632,) #最高价 (rmb * 100) >>> struct.unpack('l',d[8:12]) (1645,) #最低价 (rmb * 100) >>> struct.unpack('l',d[12:16]) (1592,) #收盘价 (rmb * 100) >>> struct.unpack('l',d[16:20]) (1599,) #成交额 (rmb) >>> struct.unpack('f',d[20:24]) (717567552.0,) #成交手 ( * 100) >>> struct.unpack('l',d[24:28]) (44385137,) #f记录标志 >>> struct.unpack('l',d[28:32]) (65536,) #下一条记录日期 >>> struct.unpack('l',d[32:36]) (20130107,)
Reference:
http://tech.cncms.com/ruanjian/office/excel/11121.html
http://syue.com/edu/Office/Excel/11338.html
http://oracle-abc.wikidot.com/vbs-china-stock-exchange-data-loader