xfunding: move moving average config out

This commit is contained in:
c9s 2023-03-26 01:02:31 +08:00
parent c6cedde8c9
commit c176e2df5f
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -34,6 +34,23 @@ const (
PositionClosing
)
type MovingAverageConfig struct {
Interval types.Interval `json:"interval"`
// MovingAverageType is the moving average indicator type that we want to use,
// it could be SMA or EWMA
MovingAverageType string `json:"movingAverageType"`
// MovingAverageInterval is the interval of k-lines for the moving average indicator to calculate,
// it could be "1m", "5m", "1h" and so on. note that, the moving averages are calculated from
// the k-line data we subscribed
// MovingAverageInterval types.Interval `json:"movingAverageInterval"`
//
// // MovingAverageWindow is the number of the window size of the moving average indicator.
// // The number of k-lines in the window. generally used window sizes are 7, 25 and 99 in the TradingView.
// MovingAverageWindow int `json:"movingAverageWindow"`
MovingAverageIntervalWindow types.IntervalWindow `json:"movingAverageIntervalWindow"`
}
var log = logrus.WithField("strategy", ID)
func init() {
@ -89,28 +106,6 @@ type Strategy struct {
Low fixedpoint.Value `json:"low"`
} `json:"shortFundingRate"`
SupportDetection []struct {
Interval types.Interval `json:"interval"`
// MovingAverageType is the moving average indicator type that we want to use,
// it could be SMA or EWMA
MovingAverageType string `json:"movingAverageType"`
// MovingAverageInterval is the interval of k-lines for the moving average indicator to calculate,
// it could be "1m", "5m", "1h" and so on. note that, the moving averages are calculated from
// the k-line data we subscribed
// MovingAverageInterval types.Interval `json:"movingAverageInterval"`
//
// // MovingAverageWindow is the number of the window size of the moving average indicator.
// // The number of k-lines in the window. generally used window sizes are 7, 25 and 99 in the TradingView.
// MovingAverageWindow int `json:"movingAverageWindow"`
MovingAverageIntervalWindow types.IntervalWindow `json:"movingAverageIntervalWindow"`
MinVolume fixedpoint.Value `json:"minVolume"`
MinQuoteVolume fixedpoint.Value `json:"minQuoteVolume"`
} `json:"supportDetection"`
SpotSession string `json:"spotSession"`
FuturesSession string `json:"futuresSession"`
Reset bool `json:"reset"`