You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
976 B
30 lines
976 B
package strategy |
|
|
|
import ( |
|
"sig-pub/pkg/indicator" |
|
"sig-pub/pkg/types" |
|
"sig-pub/pkg/types/series" |
|
) |
|
|
|
// 多周期k线策略 |
|
type IIntervalsSigStrategy interface { |
|
New() IIntervalsSigStrategy |
|
Meta() StrategyMeta |
|
Update(ctx IIntervalsSigStrategyContext) |
|
DriverIntervals() []types.Interval // 驱动k线周期, 当驱动周期k线更新时则判断调用Update方法 |
|
SubscribeIntervals() []types.Interval // 订阅k线周期, 当同一时间的订阅周期都更新时调用Update方法 |
|
} |
|
|
|
// ISigStrategyContext 策略外部访问能力 |
|
// klineSeries, Indicator |
|
type IIntervalsSigStrategyContext interface { |
|
Buy() // 发出多信号 |
|
Sell() // 发出空信号 |
|
|
|
// Get [0]当前k线 |
|
Get(interval types.Interval, offset int16) types.Kline |
|
// Series [offset...end] |
|
Series(interval types.Interval, offset, count int16) (klines series.Klines) |
|
// 获取窗口类型指标 |
|
IndicatorW(interval types.Interval, name string, window int16) indicator.IIndicatorSeries |
|
}
|
|
|