代码拉取完成,页面将自动刷新
同步操作将从 macroan/traderStock-gui 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#coding=utf-8
import public
import talib
import pandas as pd
class Kline:
__instance = None
def __init__(self):
pass
@classmethod
def getInstance(cls):
if(cls.__instance == None):
cls.__instance = Kline()
return cls.__instance
def shape(func_name, df):
df = df[['date', 'open', 'high', 'low', 'close', 'code']]
df = df.sort_values('date', ascending=True)
open_p = df['open'].values
high_p = df['high'].values
low_p = df['low'].values
close_p = df['close'].values
if func_name == 'CDL2CROWS':
ret = talib.CDL2CROWS(open_p, high_p, low_p, close_p)
df['CDL2CROWS'] = pd.Series(ret)
df = df.sort_values('date', ascending=False)
return df
def CDL2CROWS(df):
meettotalCount, meettotal = public.init_succ_var()
df = shape(CDL2CROWS.func_name, df)
dflen = df.shape[0]
for i in xrange(dflen):
if int(df.iloc[i]['CDL2CROWS']) == -100:
meettotalCount = public.compute_succ_zf(df, i, meettotalCount, meettotal)
df.to_csv(df.iloc[0]['code']+'.csv', encoding='gbk')
return meettotalCount, meettotal
#(df.iloc[i]['high']-df.iloc[i]['open'])/(df.iloc[i]['open']-df.iloc[i]['close']) > 3.0) and \
def ZADF(df):
meettotalCount, meettotal = public.init_succ_var()
dflen = df.shape[0]
for i in xrange(dflen):
if i == 0:
continue
if i+2<dflen \
and df.iloc[i]['MA_60'] > df.iloc[i+1]['MA_60'] and df.iloc[i+1]['MA_60'] > df.iloc[i+2]['MA_60'] \
and df.iloc[i]['close'] > df.iloc[i]['MA_60']:
if (df.iloc[i]['close'] < df.iloc[i]['open']*0.95 or (df.iloc[0]['close']==df.iloc[0]['open'] and df.iloc[0]['change']<-0.098)) \
and df.iloc[i-1]['change'] > 0.095:
meettotalCount = public.compute_succ_zf(df, i-1, meettotalCount, meettotal)
return meettotalCount, meettotal
#============================选股==============================
def ZADF_XG(df, code):
retcode = 0
dflen = df.shape[0]
if 2<dflen \
and df.iloc[0]['MA_60'] > df.iloc[1]['MA_60'] and df.iloc[1]['MA_60'] > df.iloc[2]['MA_60'] \
and df.iloc[0]['close'] > df.iloc[0]['MA_60']:
if (df.iloc[0]['close'] < df.iloc[0]['open']*0.95) or (df.iloc[0]['close'] == df.iloc[0]['open'] and df.iloc[0]['change']<-0.098):
#or ((df.iloc[0]['high']-df.iloc[0]['open'])/(df.iloc[0]['open']-df.iloc[0]['close']) > 2.0):
retcode = code
return retcode
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。