資源簡介
只有20行的python代碼,可以解析同花順日線文件.
代碼片段和文件信息
#!/usr/bin/env?python3
#coding=utf-8
import?os?io?sys?time?json?base64?struct
fOpend?=?open(‘600000.day‘‘rb‘)
fread?=?fOpend.read();
fOpend.close()
fLen?=?len(fread)
fPoint?=?6?#跳過開頭
dataNumfPointlineLenlineCount?=?struct.unpack_from(‘ print(dataNumfPointlineLenlineCount)
while?fPoint?????dateopenVhighVlowVcloseVmoneyvaluedat8dat9dat10dat11?=?struct.unpack_from(‘<11I‘?fread?fPoint)
????#日期開盤?最高?最低收盤??成交額成交量
????openV?&=?0x0FFFFFFF
????highV?&=?0x0FFFFFFF
????lowV?&=?0x0FFFFFFF
????closeV?&=?0x0FFFFFFF
????print(dateopenVhighVlowVcloseVmoneyvaluedat8dat9dat10dat11)
????fPoint?+=?lineLen
- 上一篇:Python3爬蟲-v2
- 下一篇:python京東搶購二維碼登錄實現
評論
共有 條評論