1 Star 0 Fork 16

龙在江湖/traderStock-gui

forked from macroan/traderStock-gui 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
public.py 1.71 KB
一键复制 编辑 原始数据 按行查看 历史
macroan 提交于 2017-12-04 09:58 . no commit message
#coding=utf-8
import os
import getGlobalVar
import config
g_order_id = 0
def get_orderid():
global g_order_id
g_order_id += 1
return g_order_id
def set_orderid():
global g_order_id
if os.path.exists('./output/maxorderid.txt') and os.path.getsize('./output/maxorderid.txt') > 0:
f = open('./output/maxorderid.txt', 'w')
try:
g_order_id = f.read()
finally:
f.close()
def save_orderid():
global g_order_id
f = open('./output/maxorderid.txt', 'w')
f.write(g_order_id)
f.flush()
f.close()
def setprogressbar(ret):
window = getGlobalVar.getWindow()
if window:
cur = window.progressBar.value()
if ret > cur:
window.progressBar.setValue(ret)
if ret < window.progressBar.maximum():
window.labelret.setText('计算中。。。')
else:
window.labelret.setText('计算完毕!!!')
def cls_progressbar():
window = getGlobalVar.getWindow()
if window:
window.progressBar.setValue(0)
window.labelret.setText('')
def init_succ_var():
meettotalCount = 0
meettotal = {day:{'totalrate':0, 'successcount':0} for day in config.ZF_DAY}
return meettotalCount, meettotal
def compute_succ_zf(df, target, meettotalCount, meettotal):
meettotalCount += 1
taggetclose = df.iloc[target]['close']
for day in config.ZF_DAY:
if (target - day) > -1:
meettotal[day]['totalrate'] += (df.iloc[target-day]['close']-taggetclose)/taggetclose*100
if df.iloc[target-day]['close'] > taggetclose:
meettotal[day]['successcount'] += 1
return meettotalCount
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/yizhengsh/traderStock-gui.git
git@gitee.com:yizhengsh/traderStock-gui.git
yizhengsh
traderStock-gui
traderStock-gui
master

搜索帮助