将沪深龙虎榜数据导入通达信的自选板块,并标注于K线图上
原理:python读取前一次处理完的计算5日后涨跌幅输出的csv文件
文件名前加"[paint]"
安照通达信的画图文件和板块文件格式,输出文件
用通达信的导入功能,导入画图文件和板块文件即可
事前数据截图:
处理后所得文件:
导入通达信后板块截图:
k线截图:
代码:
#coding=utf-8
#读取'[paint]'开头的csv文件
#copyright @ WangXinsheng
#http://www.cnblogs.com/wangxinsheng/
import os
import struct
import time
import datetime
def getPriceByte(infile,arg,code,ss,day):
dirc = {"-5":-3,"-3":-2,"-1":-1,"":1,"":2,"":3,"":4,"":5,"":6}
first = 0
second = 0
a = float(arg)
for i in [-5,-3,-1,1,3,5,7,9,11]:
ib = i - 2
if(a>=2**ib and a<2**i):
#print(str(a)+":["+str(2**ib)+","+str(2**i)+"]"+"i:"+str(i)+" ib:"+str(ib))
first = ib
break;
#print(first)
chushu = 2**first
if(arg >= chushu*2):
second = arg / chushu
#print(second)
second = int(second*64)
else:
second