mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 08:15:15 +00:00
29 lines
698 B
Go
29 lines
698 B
Go
package backtest
|
|
|
|
import "encoding/json"
|
|
|
|
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) {
|
|
var arr []ManifestEntry
|
|
for k, v := range m {
|
|
arr = append(arr, ManifestEntry{
|
|
Type: "strategyProperty",
|
|
Filename: v,
|
|
StrategyID: k.ID,
|
|
StrategyInstance: k.InstanceID,
|
|
StrategyProperty: k.Property,
|
|
})
|
|
|
|
}
|
|
return json.MarshalIndent(arr, "", " ")
|
|
}
|