bbgo_origin/pkg/backtest/manifests.go

29 lines
698 B
Go
Raw Normal View History

package backtest
import "encoding/json"
2022-05-10 06:23:11 +00:00
type ManifestEntry struct {
Type string `json:"type"`
Filename string `json:"filename"`
StrategyID string `json:"strategyID"`
StrategyInstance string `json:"strategyInstance"`
StrategyProperty string `json:"strategyProperty"`
}
type Manifests map[InstancePropertyIndex]string
func (m Manifests) MarshalJSON() ([]byte, error) {
2022-05-10 06:23:11 +00:00
var arr []ManifestEntry
for k, v := range m {
2022-05-10 06:23:11 +00:00
arr = append(arr, ManifestEntry{
Type: "strategyProperty",
Filename: v,
StrategyID: k.ID,
StrategyInstance: k.InstanceID,
StrategyProperty: k.Property,
})
}
return json.MarshalIndent(arr, "", " ")
}