提交
This commit is contained in:
@@ -56,6 +56,15 @@ def ma(close: pd.Series, period: int) -> pd.Series:
|
||||
return close.rolling(period, min_periods=1).mean()
|
||||
|
||||
|
||||
def vol_ratio(volume: pd.Series, period: int = 5) -> pd.Series:
|
||||
"""量比(通达信口径):当日成交量 / 前 N 日均量(不含当日,即 REF(MA(VOL,N),1))。
|
||||
|
||||
>2 约=倍量、<0.7 约=显著缩量;首根无前值、均量为 0(长期停牌)时为 NaN。
|
||||
"""
|
||||
base = volume.rolling(period, min_periods=1).mean().shift(1)
|
||||
return volume / base.replace(0, np.nan)
|
||||
|
||||
|
||||
def ema2(close: pd.Series, span: int = 10) -> pd.Series:
|
||||
"""知行短期趋势线:EMA(EMA(C, span), span)。"""
|
||||
return ema(ema(close, span), span)
|
||||
|
||||
Reference in New Issue
Block a user