bbgo_origin/pkg/backtest/manifests.go

21 lines
455 B
Go
Raw Normal View History

package backtest
import "encoding/json"
type Manifests map[InstancePropertyIndex]string
func (m Manifests) MarshalJSON() ([]byte, error) {
var arr []interface{}
for k, v := range m {
arr = append(arr, map[string]interface{}{
2022-05-10 06:21:19 +00:00
"type": "strategyProperty",
"filename": v,
"strategyId": k.ID,
"strategyInstance": k.InstanceID,
"strategyProperty": k.Property,
})
}
return json.MarshalIndent(arr, "", " ")
}