pull out bollinger settings

This commit is contained in:
c9s 2022-06-22 13:33:15 +08:00
parent b75da154a8
commit 5fe0f5a299
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 10 additions and 7 deletions

View File

@ -36,11 +36,6 @@ func init() {
bbgo.RegisterStrategy(ID, &Strategy{}) bbgo.RegisterStrategy(ID, &Strategy{})
} }
type BollingerSetting struct {
types.IntervalWindow
BandWidth float64 `json:"bandWidth"`
}
type Strategy struct { type Strategy struct {
*bbgo.Graceful *bbgo.Graceful
*bbgo.Notifiability *bbgo.Notifiability
@ -108,11 +103,11 @@ type Strategy struct {
// NeutralBollinger is the smaller range of the bollinger band // NeutralBollinger is the smaller range of the bollinger band
// If price is in this band, it usually means the price is oscillating. // If price is in this band, it usually means the price is oscillating.
// If price goes out of this band, we tend to not place sell orders or buy orders // If price goes out of this band, we tend to not place sell orders or buy orders
NeutralBollinger *BollingerSetting `json:"neutralBollinger"` NeutralBollinger *types.BollingerSetting `json:"neutralBollinger"`
// DefaultBollinger is the wide range of the bollinger band // DefaultBollinger is the wide range of the bollinger band
// for controlling your exposure position // for controlling your exposure position
DefaultBollinger *BollingerSetting `json:"defaultBollinger"` DefaultBollinger *types.BollingerSetting `json:"defaultBollinger"`
// DowntrendSkew is the order quantity skew for normal downtrend band. // DowntrendSkew is the order quantity skew for normal downtrend band.
// The price is still in the default bollinger band. // The price is still in the default bollinger band.

8
pkg/types/bollinger.go Normal file
View File

@ -0,0 +1,8 @@
package types
// BollingerSetting contains the bollinger indicator setting propers
// Interval, Window and BandWidth
type BollingerSetting struct {
IntervalWindow
BandWidth float64 `json:"bandWidth"`
}