机构股票均线-机构常用均线组合

2023-07-14 01:54:47 入门知识 0次阅读 投稿:admin
机构股票均线.jpg

关于机构股票均线的问题,我们总结了以下几点,给你解答:

机构股票均线


机构股票均线


:param code:
:param start_date:
:param end_date:
:return:
"""
# 获取股票数据
df = get_stock_data(code, start_date, end_date)
# 计算均线
df['ma5'] = df['close'].rolling(window=5).mean()
df['ma10'] = df['close'].rolling(window=10).mean()
df['ma20'] = df['close'].rolling(window=20).mean()
df['ma30'] = df['close'].rolling(window=30).mean()
df['ma60'] = df['close'].rolling(window=60).mean()
df['ma120'] = df['close'].rolling(window=120).mean()
df['ma250'] = df['close'].rolling(window=250).mean()
return df


def get_stock_data(code, start_date, end_date):
"""
获取股票数据
:param code:
:param start_date:
:param end_date:
:return:
"""
# 获取股票数据
df = ts.get_k_data(code, start=start_date, end=end_date)
# 将日期设置为索引
df.set_index('date', inplace=True)
# 将字符串转换为日期
df.index = pd.to_datetime(df.index)
return df


def get_stock_data_with_ma(code, start_date, end_date):
"""
获取股票数据及均线
:param code:
:param start_date:
:param end_date:
:return:
"""
# 获取股票数据
df = get_stock_data(code, start_date, end_date)
# 计算均线
df['ma5'] = df['close'].rolling(window=5).mean()
df['ma10'] = df['close'].rolling(window=10).mean()
df['ma20'] = df['close'].rolling(window=20).mean()
df['ma30'] = df['close'].rolling(window=30).mean()
df['ma60'] = df['close'].rolling(window=60).mean()
df['ma120'] = df['close'].rolling(window=120).mean()
df['ma250'] = df['close'].rolling(window=250).mean()
return df


def get_stock_data_with_macd(code, start_date, end_date):
"""
获取股票数据及MACD
:param code:
:param start_date:
:param end_date:
:return:
"""
# 获取股票数据
df = get_stock_data(code, start_date, end_date)
# 计算MACD
df['EMA12'] = df['close'].ewm(span=12).mean()
df['EMA26'] = df['close'].ewm(span=26).mean()
df['DIF'] = df['EMA12'] - df['EMA26']
df['DEA'] = df['DIF'].ewm(span=9).mean()
df['MACD'] = 2 * (df['DIF'] - df['DEA'])
return df


def get_stock_data_with_kdj(code, start_date, end_date):
"""
获取股票数据及KDJ
:param code:
:param start_date:
:param end_date:
:return:
"""
# 获取股票数据
df = get_stock_data(code, start_date, end_date)
# 计算KDJ
low_list = df['low'].rolling(window=9, min_periods=9).min()
low_list.fillna(value=df['low'].expanding().min(), inplace=True)
high_list = df['high'].rolling(window=9, min_periods=9).max()
high_list.fillna(value=df['high'].expanding().max(), inplace=True)
rsv = (df['close'] - low_list) / (high_list - low_list) * 100
df['K'] = rsv.ewm(com=2).mean()
df['D'] = df['K'].ewm(com=2).mean()
df['J'] = 3 * df['K'] - 2 * df['D']
return df


def get_stock_data_with_boll(code, start_date, end_date):
"""
获取股票数据及布林线
:param code:
:param start_date:
:param end_date:
:return:
"""
# 获取股票数据
df = get_stock_data(code, start_date, end_date)
# 计算布林线
df['MA'] = df['close'].rolling(window=20).mean()
df['MD'] = df['close'].rolling(window=20).std()
df['UPPER'] = df['MA'] + 2 * df['MD']
df['LOWER'] = df['MA'] - 2 * df['MD']
return df


def get_stock_data_with_rsi(code, start_date, end_date):
"""
获取股票数据及RSI
:param code:
:param start_date:
:param end_date:
:return:
"""
# 获取股票数据
df = get_stock_data(code, start_date, end_date)
# 计算RSI
df['diff'] = df['close'].diff()
df['up'] = df['diff'][df['diff'] > 0].fillna(0)
df['down'] = -df['diff'][df['diff'] < 0].fillna(0)
df['up_mean'] = df['up'].rolling(window=6).mean()
df['down_mean'] = df['down'].rolling(window=6).mean()
df['RS'] = df['up_mean'] / df['down_mean']
df['RSI'] = 100 - (100 / (1 + df['RS']))
return df


def get_stock_data_with_cci(code, start_date, end_date):
"""
获取股票数据及CCI
:param code:
:param start_date:
:param end_date:
:return:
"""
# 获取股票数据
df = get_stock_data(code, start_date, end_date)
# 计算CCI
df['TP'] = (df['high'] + df['low'] + df['close']) / 3
df['MA'] = df['TP'].rolling(window=14).mean()
df['MD'] = df['TP'].rolling(window=14).std()
df['CCI'] = (df['TP'] - df['MA']) / (0.015 * df['MD'])
return df


def get_stock_data_with_wr(code, start_date, end_date):
"""

机构常用均线组合


机构常用均线组合

短期均线,3,5,7,10,15
中期均线:20,30,60
长期均线:120,250
这些可以自己更改周期调处来的。
其实,只用中期就可以了。短期太灵敏反而不好把握。
望采纳
同问。。。

机构均线指标


机构均线指标

可以...
触摸屏操作性很好,
安卓版只有平板电脑版本的.


声明:稳得一批是理财投资基础知识平台! 并不指导专业性投资! 投资有风险,入市需谨慎!