Python计算KDJ值,但计算的结果跟通达信软件有一定的差别。
import talib as ta import tushare as ts import pandas as pd dw = ts.get_k_data("601069") print(dw) dw = dw[60:] dw.index = range(len(dw)) dw[‘slowk‘], dw[‘slowd‘] = ta.STOCH(dw[‘high‘].values, dw[‘low‘].values, dw[‘close‘].values, fastk_period=9, slowk_period=3, slowk_matype=1, slowd_period=3, slowd_matype=1) df = pd.DataFrame(data=dw) row = df.iloc[-10:].values print(row)
原文地址:https://www.cnblogs.com/mzpython/p/11484305.html
时间: 2024-10-29 02:43:40