bbgo_origin/pkg/bbgo/interact_test.go

29 lines
534 B
Go
Raw Normal View History

2022-01-14 18:52:46 +00:00
package bbgo
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
)
type myStrategy struct {
Symbol string `json:"symbol"`
}
func (m myStrategy) ID() string {
return "mystrategy"
}
func (m *myStrategy) Run(ctx context.Context, orderExecutor OrderExecutor, session *ExchangeSession) error {
return nil
}
func Test_getStrategySignature(t *testing.T) {
signature, err := getStrategySignature(&myStrategy{
Symbol: "BTCUSDT",
})
assert.NoError(t, err)
assert.Equal(t, "bbgo.mystrategy.BTCUSDT", signature)
}