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.
42 lines
1.1 KiB
42 lines
1.1 KiB
package strategy |
|
|
|
import ( |
|
"sig-pub/pkg/types" |
|
) |
|
|
|
// 多币种多周期策略 |
|
type MultiInstanceRank struct { |
|
IIntervalSigStrategy |
|
rate float64 |
|
rate2 float64 |
|
} |
|
|
|
func (s *MultiInstanceRank) New() ISigStrategy { |
|
return &MultiInstanceRank{} |
|
} |
|
|
|
func (s *MultiInstanceRank) Meta() StrategyMeta { |
|
return StrategyMeta{ |
|
Name: "MultiInstanceRank", |
|
Desc: "多币种多周期策略", |
|
Input: []types.InputArg{ |
|
{Name: "rate", Type: types.InputTypeUFloat, Desc: "上线影线与基线比例"}, |
|
{Name: "rate2", Type: types.InputTypeUFloat, Desc: "上线影线之间比例"}, |
|
}, |
|
} |
|
} |
|
|
|
func (s *MultiInstanceRank) Init(input types.Input) (err error) { // 校验参数, 并根据参数初始化策略 |
|
s.rate = input.Float("rate") |
|
s.rate2 = input.Float("rate2") |
|
return |
|
} |
|
|
|
func (s *MultiInstanceRank) CandlePeriods(ctx IInstanceIntervalSigStrategyContext) (insts []string, iss *types.IntervalState[int16]) { |
|
insts = []string{"BTC_USDT", "SOL_USDT"} |
|
iss = types.NewIntervalState[int16]() |
|
iss.Set(types.Interval5m, 1) |
|
iss.Set(types.Interval15m, 2) |
|
iss.Set(types.Interval30m, 2) |
|
return |
|
}
|
|
|