1 Star 4 Fork 11

王布衣 / pandas

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
series_ewm.go 796 Bytes
Copy Edit Raw Blame History
package pandas
import (
"gitee.com/quant1x/pandas/stat"
)
// EWM provides exponential weighted calculations.
func (s *NDFrame) EWM(alpha stat.EW) stat.ExponentialMovingWindow {
atype := stat.AlphaAlpha
param := 0.00
adjust := alpha.Adjust
ignoreNA := alpha.IgnoreNA
if alpha.Com != 0 {
atype = stat.AlphaCom
param = alpha.Com
} else if alpha.Span != 0 {
atype = stat.AlphaSpan
param = alpha.Span
} else if alpha.HalfLife != 0 {
atype = stat.AlphaHalfLife
param = alpha.HalfLife
} else {
atype = stat.AlphaAlpha
param = alpha.Alpha
}
dest := NewSeries(stat.SERIES_TYPE_FLOAT64, s.name, s.Values())
return stat.ExponentialMovingWindow{
Data: dest,
AType: atype,
Param: param,
Adjust: adjust,
IgnoreNA: ignoreNA,
Cb: alpha.Callback,
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/quant1x/pandas.git
git@gitee.com:quant1x/pandas.git
quant1x
pandas
pandas
v0.9.37

Search

344bd9b3 5694891 D2dac590 5694891