mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 00:05:15 +00:00
upgrade golang mockgen to uber mockgen. generate exchange public
This commit is contained in:
parent
ec45ad3bdc
commit
f1a4879253
4
go.mod
4
go.mod
|
@ -72,6 +72,7 @@ require (
|
|||
github.com/bitly/go-simplejson v0.5.1 // indirect
|
||||
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
|
||||
github.com/bytedance/sonic v1.9.1 // indirect
|
||||
github.com/c9s/callbackgen v1.1.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
|
||||
github.com/cockroachdb/apd v1.1.0 // indirect
|
||||
|
@ -79,6 +80,7 @@ require (
|
|||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/denisenkom/go-mssqldb v0.12.3 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/dmarkham/enumer v1.5.9 // indirect
|
||||
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
|
||||
|
@ -117,6 +119,7 @@ require (
|
|||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/nxadm/tail v1.4.8 // indirect
|
||||
github.com/pascaldekloe/name v1.0.0 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
|
@ -141,6 +144,7 @@ require (
|
|||
go.opentelemetry.io/otel v0.19.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v0.19.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v0.19.0 // indirect
|
||||
go.uber.org/mock v0.4.0 // indirect
|
||||
golang.org/x/arch v0.3.0 // indirect
|
||||
golang.org/x/crypto v0.21.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 // indirect
|
||||
|
|
8
go.sum
8
go.sum
|
@ -82,6 +82,8 @@ github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s
|
|||
github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
|
||||
github.com/c-bata/goptuna v0.8.1 h1:25+n1MLv0yvCsD56xv4nqIus3oLHL9GuPAZDLIqmX1U=
|
||||
github.com/c-bata/goptuna v0.8.1/go.mod h1:knmS8+Iyq5PPy1YUeIEq0pMFR4Y6x7z/CySc9HlZTCY=
|
||||
github.com/c9s/callbackgen v1.1.0 h1:Igf1oPY9yYFoZP8YBK6JQ8JqNe6pzczVDY6xzg5rk38=
|
||||
github.com/c9s/callbackgen v1.1.0/go.mod h1:8NRnf1Y3KEaHEaZgznkthi9alQiYCVoliPKc4Xz7A1o=
|
||||
github.com/c9s/requestgen v1.3.6 h1:ul7dZ2uwGYjNBjreooRfSY10WTXvQmQSjZsHebz6QfE=
|
||||
github.com/c9s/requestgen v1.3.6/go.mod h1:QwkZudcv84kJ8g9+E0RDTj+13btFXbTvv2aI+zbuLbc=
|
||||
github.com/c9s/rockhopper/v2 v2.0.3-0.20240124055428-2473c6221858 h1:VLvl82XQCtH12axHdroyrfprPYKtA3TueEWicx8yT4A=
|
||||
|
@ -137,6 +139,8 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm
|
|||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
||||
github.com/dmarkham/enumer v1.5.9 h1:NM/1ma/AUNieHZg74w67GkHFBNB15muOt3sj486QVZk=
|
||||
github.com/dmarkham/enumer v1.5.9/go.mod h1:e4VILe2b1nYK3JKJpRmNdl5xbDQvELc6tQ8b+GsGk6E=
|
||||
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
|
@ -509,6 +513,8 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y
|
|||
github.com/onsi/gomega v1.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ=
|
||||
github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pascaldekloe/name v1.0.0 h1:n7LKFgHixETzxpRv2R77YgPUFo85QHGZKrdaYm7eY5U=
|
||||
github.com/pascaldekloe/name v1.0.0/go.mod h1:Z//MfYJnH4jVpQ9wkclwu2I2MkHmXTlT9wR5UZScttM=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI=
|
||||
github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
|
||||
|
@ -690,6 +696,8 @@ go.opentelemetry.io/otel/trace v0.19.0/go.mod h1:4IXiNextNOpPnRlI4ryK69mn5iC84bj
|
|||
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
|
||||
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
|
|
|
@ -3,8 +3,8 @@ package bbgo
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/fixedpoint"
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/c9s/bbgo/pkg/bbgo (interfaces: OrderExecutorExtended)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -destination=mocks/mock_order_executor_extended.go -package=mocks . OrderExecutorExtended
|
||||
//
|
||||
|
||||
// Package mocks is a generated GoMock package.
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/core"
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
core "github.com/c9s/bbgo/pkg/core"
|
||||
types "github.com/c9s/bbgo/pkg/types"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockOrderExecutorExtended is a mock of OrderExecutorExtended interface.
|
||||
|
@ -40,7 +44,7 @@ func (m *MockOrderExecutorExtended) EXPECT() *MockOrderExecutorExtendedMockRecor
|
|||
// CancelOrders mocks base method.
|
||||
func (m *MockOrderExecutorExtended) CancelOrders(arg0 context.Context, arg1 ...types.Order) error {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
|
@ -50,9 +54,9 @@ func (m *MockOrderExecutorExtended) CancelOrders(arg0 context.Context, arg1 ...t
|
|||
}
|
||||
|
||||
// CancelOrders indicates an expected call of CancelOrders.
|
||||
func (mr *MockOrderExecutorExtendedMockRecorder) CancelOrders(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockOrderExecutorExtendedMockRecorder) CancelOrders(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelOrders", reflect.TypeOf((*MockOrderExecutorExtended)(nil).CancelOrders), varargs...)
|
||||
}
|
||||
|
||||
|
@ -73,7 +77,7 @@ func (mr *MockOrderExecutorExtendedMockRecorder) Position() *gomock.Call {
|
|||
// SubmitOrders mocks base method.
|
||||
func (m *MockOrderExecutorExtended) SubmitOrders(arg0 context.Context, arg1 ...types.SubmitOrder) (types.OrderSlice, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
|
@ -84,9 +88,9 @@ func (m *MockOrderExecutorExtended) SubmitOrders(arg0 context.Context, arg1 ...t
|
|||
}
|
||||
|
||||
// SubmitOrders indicates an expected call of SubmitOrders.
|
||||
func (mr *MockOrderExecutorExtendedMockRecorder) SubmitOrders(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockOrderExecutorExtendedMockRecorder) SubmitOrders(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitOrders", reflect.TypeOf((*MockOrderExecutorExtended)(nil).SubmitOrders), varargs...)
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/fixedpoint"
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
|
|
2
pkg/cache/cache_test.go
vendored
2
pkg/cache/cache_test.go
vendored
|
@ -6,8 +6,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
"github.com/c9s/bbgo/pkg/types/mocks"
|
||||
|
|
|
@ -6,9 +6,9 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
"github.com/c9s/bbgo/pkg/types/mocks"
|
||||
|
|
|
@ -129,6 +129,7 @@ func New(key, secret string) *Exchange {
|
|||
if len(key) > 0 && len(secret) > 0 {
|
||||
client2.Auth(key, secret)
|
||||
futuresClient2.Auth(key, secret)
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
go timeSetterOnce.Do(func() {
|
||||
|
@ -146,7 +147,6 @@ func New(key, secret string) *Exchange {
|
|||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return ex
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/exchange/bybit/bybitapi"
|
||||
"github.com/c9s/bbgo/pkg/exchange/bybit/mocks"
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
bybitapi "github.com/c9s/bbgo/pkg/exchange/bybit/bybitapi"
|
||||
types "github.com/c9s/bbgo/pkg/types"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockStreamDataProvider is a mock of StreamDataProvider interface.
|
||||
|
|
|
@ -3,8 +3,8 @@ package riskcontrol
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/bbgo"
|
||||
"github.com/c9s/bbgo/pkg/bbgo/mocks"
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
"github.com/c9s/bbgo/pkg/bbgo"
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
"github.com/c9s/bbgo/pkg/types/mocks"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
func TestSyncActiveOrders(t *testing.T) {
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/c9s/bbgo/pkg/strategy/grid2 (interfaces: OrderExecutor)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -destination=mocks/order_executor.go -package=mocks . OrderExecutor
|
||||
//
|
||||
|
||||
// Package mocks is a generated GoMock package.
|
||||
package mocks
|
||||
|
@ -11,7 +16,7 @@ import (
|
|||
bbgo "github.com/c9s/bbgo/pkg/bbgo"
|
||||
fixedpoint "github.com/c9s/bbgo/pkg/fixedpoint"
|
||||
types "github.com/c9s/bbgo/pkg/types"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockOrderExecutor is a mock of OrderExecutor interface.
|
||||
|
@ -54,7 +59,7 @@ func (mr *MockOrderExecutorMockRecorder) ActiveMakerOrders() *gomock.Call {
|
|||
// ClosePosition mocks base method.
|
||||
func (m *MockOrderExecutor) ClosePosition(arg0 context.Context, arg1 fixedpoint.Value, arg2 ...string) error {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0, arg1}
|
||||
varargs := []any{arg0, arg1}
|
||||
for _, a := range arg2 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
|
@ -64,16 +69,16 @@ func (m *MockOrderExecutor) ClosePosition(arg0 context.Context, arg1 fixedpoint.
|
|||
}
|
||||
|
||||
// ClosePosition indicates an expected call of ClosePosition.
|
||||
func (mr *MockOrderExecutorMockRecorder) ClosePosition(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
|
||||
func (mr *MockOrderExecutorMockRecorder) ClosePosition(arg0, arg1 any, arg2 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0, arg1}, arg2...)
|
||||
varargs := append([]any{arg0, arg1}, arg2...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClosePosition", reflect.TypeOf((*MockOrderExecutor)(nil).ClosePosition), varargs...)
|
||||
}
|
||||
|
||||
// GracefulCancel mocks base method.
|
||||
func (m *MockOrderExecutor) GracefulCancel(arg0 context.Context, arg1 ...types.Order) error {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
|
@ -83,16 +88,16 @@ func (m *MockOrderExecutor) GracefulCancel(arg0 context.Context, arg1 ...types.O
|
|||
}
|
||||
|
||||
// GracefulCancel indicates an expected call of GracefulCancel.
|
||||
func (mr *MockOrderExecutorMockRecorder) GracefulCancel(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockOrderExecutorMockRecorder) GracefulCancel(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GracefulCancel", reflect.TypeOf((*MockOrderExecutor)(nil).GracefulCancel), varargs...)
|
||||
}
|
||||
|
||||
// SubmitOrders mocks base method.
|
||||
func (m *MockOrderExecutor) SubmitOrders(arg0 context.Context, arg1 ...types.SubmitOrder) (types.OrderSlice, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
|
@ -103,8 +108,8 @@ func (m *MockOrderExecutor) SubmitOrders(arg0 context.Context, arg1 ...types.Sub
|
|||
}
|
||||
|
||||
// SubmitOrders indicates an expected call of SubmitOrders.
|
||||
func (mr *MockOrderExecutorMockRecorder) SubmitOrders(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockOrderExecutorMockRecorder) SubmitOrders(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitOrders", reflect.TypeOf((*MockOrderExecutor)(nil).SubmitOrders), varargs...)
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/fixedpoint"
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
"github.com/c9s/bbgo/pkg/fixedpoint"
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
"github.com/c9s/bbgo/pkg/types/mocks"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
func newStrategy(t *TestData) *Strategy {
|
||||
|
|
|
@ -7,9 +7,9 @@ import (
|
|||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/core"
|
||||
"github.com/c9s/bbgo/pkg/fixedpoint"
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/c9s/bbgo/pkg/types (interfaces: Exchange)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -destination=mocks/mock_exchange.go -package=mocks . Exchange
|
||||
//
|
||||
|
||||
// Package mocks is a generated GoMock package.
|
||||
package mocks
|
||||
|
@ -9,7 +14,7 @@ import (
|
|||
reflect "reflect"
|
||||
|
||||
types "github.com/c9s/bbgo/pkg/types"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockExchange is a mock of Exchange interface.
|
||||
|
@ -38,7 +43,7 @@ func (m *MockExchange) EXPECT() *MockExchangeMockRecorder {
|
|||
// CancelOrders mocks base method.
|
||||
func (m *MockExchange) CancelOrders(arg0 context.Context, arg1 ...types.Order) error {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
|
@ -48,9 +53,9 @@ func (m *MockExchange) CancelOrders(arg0 context.Context, arg1 ...types.Order) e
|
|||
}
|
||||
|
||||
// CancelOrders indicates an expected call of CancelOrders.
|
||||
func (mr *MockExchangeMockRecorder) CancelOrders(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockExchangeMockRecorder) CancelOrders(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelOrders", reflect.TypeOf((*MockExchange)(nil).CancelOrders), varargs...)
|
||||
}
|
||||
|
||||
|
@ -106,7 +111,7 @@ func (m *MockExchange) QueryAccount(arg0 context.Context) (*types.Account, error
|
|||
}
|
||||
|
||||
// QueryAccount indicates an expected call of QueryAccount.
|
||||
func (mr *MockExchangeMockRecorder) QueryAccount(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockExchangeMockRecorder) QueryAccount(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryAccount", reflect.TypeOf((*MockExchange)(nil).QueryAccount), arg0)
|
||||
}
|
||||
|
@ -121,7 +126,7 @@ func (m *MockExchange) QueryAccountBalances(arg0 context.Context) (types.Balance
|
|||
}
|
||||
|
||||
// QueryAccountBalances indicates an expected call of QueryAccountBalances.
|
||||
func (mr *MockExchangeMockRecorder) QueryAccountBalances(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockExchangeMockRecorder) QueryAccountBalances(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryAccountBalances", reflect.TypeOf((*MockExchange)(nil).QueryAccountBalances), arg0)
|
||||
}
|
||||
|
@ -136,7 +141,7 @@ func (m *MockExchange) QueryKLines(arg0 context.Context, arg1 string, arg2 types
|
|||
}
|
||||
|
||||
// QueryKLines indicates an expected call of QueryKLines.
|
||||
func (mr *MockExchangeMockRecorder) QueryKLines(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
|
||||
func (mr *MockExchangeMockRecorder) QueryKLines(arg0, arg1, arg2, arg3 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryKLines", reflect.TypeOf((*MockExchange)(nil).QueryKLines), arg0, arg1, arg2, arg3)
|
||||
}
|
||||
|
@ -151,7 +156,7 @@ func (m *MockExchange) QueryMarkets(arg0 context.Context) (types.MarketMap, erro
|
|||
}
|
||||
|
||||
// QueryMarkets indicates an expected call of QueryMarkets.
|
||||
func (mr *MockExchangeMockRecorder) QueryMarkets(arg0 interface{}) *gomock.Call {
|
||||
func (mr *MockExchangeMockRecorder) QueryMarkets(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryMarkets", reflect.TypeOf((*MockExchange)(nil).QueryMarkets), arg0)
|
||||
}
|
||||
|
@ -166,7 +171,7 @@ func (m *MockExchange) QueryOpenOrders(arg0 context.Context, arg1 string) ([]typ
|
|||
}
|
||||
|
||||
// QueryOpenOrders indicates an expected call of QueryOpenOrders.
|
||||
func (mr *MockExchangeMockRecorder) QueryOpenOrders(arg0, arg1 interface{}) *gomock.Call {
|
||||
func (mr *MockExchangeMockRecorder) QueryOpenOrders(arg0, arg1 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryOpenOrders", reflect.TypeOf((*MockExchange)(nil).QueryOpenOrders), arg0, arg1)
|
||||
}
|
||||
|
@ -181,7 +186,7 @@ func (m *MockExchange) QueryTicker(arg0 context.Context, arg1 string) (*types.Ti
|
|||
}
|
||||
|
||||
// QueryTicker indicates an expected call of QueryTicker.
|
||||
func (mr *MockExchangeMockRecorder) QueryTicker(arg0, arg1 interface{}) *gomock.Call {
|
||||
func (mr *MockExchangeMockRecorder) QueryTicker(arg0, arg1 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryTicker", reflect.TypeOf((*MockExchange)(nil).QueryTicker), arg0, arg1)
|
||||
}
|
||||
|
@ -189,7 +194,7 @@ func (mr *MockExchangeMockRecorder) QueryTicker(arg0, arg1 interface{}) *gomock.
|
|||
// QueryTickers mocks base method.
|
||||
func (m *MockExchange) QueryTickers(arg0 context.Context, arg1 ...string) (map[string]types.Ticker, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{arg0}
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
|
@ -200,9 +205,9 @@ func (m *MockExchange) QueryTickers(arg0 context.Context, arg1 ...string) (map[s
|
|||
}
|
||||
|
||||
// QueryTickers indicates an expected call of QueryTickers.
|
||||
func (mr *MockExchangeMockRecorder) QueryTickers(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
|
||||
func (mr *MockExchangeMockRecorder) QueryTickers(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{arg0}, arg1...)
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryTickers", reflect.TypeOf((*MockExchange)(nil).QueryTickers), varargs...)
|
||||
}
|
||||
|
||||
|
@ -216,7 +221,7 @@ func (m *MockExchange) SubmitOrder(arg0 context.Context, arg1 types.SubmitOrder)
|
|||
}
|
||||
|
||||
// SubmitOrder indicates an expected call of SubmitOrder.
|
||||
func (mr *MockExchangeMockRecorder) SubmitOrder(arg0, arg1 interface{}) *gomock.Call {
|
||||
func (mr *MockExchangeMockRecorder) SubmitOrder(arg0, arg1 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubmitOrder", reflect.TypeOf((*MockExchange)(nil).SubmitOrder), arg0, arg1)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/c9s/bbgo/pkg/types (interfaces: ExchangeOrderQueryService)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -destination=mocks/mock_exchange_order_query.go -package=mocks . ExchangeOrderQueryService
|
||||
//
|
||||
|
||||
// Package mocks is a generated GoMock package.
|
||||
package mocks
|
||||
|
@ -9,7 +14,7 @@ import (
|
|||
reflect "reflect"
|
||||
|
||||
types "github.com/c9s/bbgo/pkg/types"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockExchangeOrderQueryService is a mock of ExchangeOrderQueryService interface.
|
||||
|
@ -45,7 +50,7 @@ func (m *MockExchangeOrderQueryService) QueryOrder(arg0 context.Context, arg1 ty
|
|||
}
|
||||
|
||||
// QueryOrder indicates an expected call of QueryOrder.
|
||||
func (mr *MockExchangeOrderQueryServiceMockRecorder) QueryOrder(arg0, arg1 interface{}) *gomock.Call {
|
||||
func (mr *MockExchangeOrderQueryServiceMockRecorder) QueryOrder(arg0, arg1 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryOrder", reflect.TypeOf((*MockExchangeOrderQueryService)(nil).QueryOrder), arg0, arg1)
|
||||
}
|
||||
|
@ -60,7 +65,7 @@ func (m *MockExchangeOrderQueryService) QueryOrderTrades(arg0 context.Context, a
|
|||
}
|
||||
|
||||
// QueryOrderTrades indicates an expected call of QueryOrderTrades.
|
||||
func (mr *MockExchangeOrderQueryServiceMockRecorder) QueryOrderTrades(arg0, arg1 interface{}) *gomock.Call {
|
||||
func (mr *MockExchangeOrderQueryServiceMockRecorder) QueryOrderTrades(arg0, arg1 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryOrderTrades", reflect.TypeOf((*MockExchangeOrderQueryService)(nil).QueryOrderTrades), arg0, arg1)
|
||||
}
|
||||
|
|
148
pkg/types/mocks/mock_exchange_public.go
Normal file
148
pkg/types/mocks/mock_exchange_public.go
Normal file
|
@ -0,0 +1,148 @@
|
|||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/c9s/bbgo/pkg/types (interfaces: ExchangePublic)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -destination=mocks/mock_exchange_public.go -package=mocks . ExchangePublic
|
||||
//
|
||||
|
||||
// Package mocks is a generated GoMock package.
|
||||
package mocks
|
||||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
|
||||
types "github.com/c9s/bbgo/pkg/types"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockExchangePublic is a mock of ExchangePublic interface.
|
||||
type MockExchangePublic struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockExchangePublicMockRecorder
|
||||
}
|
||||
|
||||
// MockExchangePublicMockRecorder is the mock recorder for MockExchangePublic.
|
||||
type MockExchangePublicMockRecorder struct {
|
||||
mock *MockExchangePublic
|
||||
}
|
||||
|
||||
// NewMockExchangePublic creates a new mock instance.
|
||||
func NewMockExchangePublic(ctrl *gomock.Controller) *MockExchangePublic {
|
||||
mock := &MockExchangePublic{ctrl: ctrl}
|
||||
mock.recorder = &MockExchangePublicMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockExchangePublic) EXPECT() *MockExchangePublicMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// Name mocks base method.
|
||||
func (m *MockExchangePublic) Name() types.ExchangeName {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Name")
|
||||
ret0, _ := ret[0].(types.ExchangeName)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Name indicates an expected call of Name.
|
||||
func (mr *MockExchangePublicMockRecorder) Name() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockExchangePublic)(nil).Name))
|
||||
}
|
||||
|
||||
// NewStream mocks base method.
|
||||
func (m *MockExchangePublic) NewStream() types.Stream {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NewStream")
|
||||
ret0, _ := ret[0].(types.Stream)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// NewStream indicates an expected call of NewStream.
|
||||
func (mr *MockExchangePublicMockRecorder) NewStream() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewStream", reflect.TypeOf((*MockExchangePublic)(nil).NewStream))
|
||||
}
|
||||
|
||||
// PlatformFeeCurrency mocks base method.
|
||||
func (m *MockExchangePublic) PlatformFeeCurrency() string {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "PlatformFeeCurrency")
|
||||
ret0, _ := ret[0].(string)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// PlatformFeeCurrency indicates an expected call of PlatformFeeCurrency.
|
||||
func (mr *MockExchangePublicMockRecorder) PlatformFeeCurrency() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PlatformFeeCurrency", reflect.TypeOf((*MockExchangePublic)(nil).PlatformFeeCurrency))
|
||||
}
|
||||
|
||||
// QueryKLines mocks base method.
|
||||
func (m *MockExchangePublic) QueryKLines(arg0 context.Context, arg1 string, arg2 types.Interval, arg3 types.KLineQueryOptions) ([]types.KLine, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "QueryKLines", arg0, arg1, arg2, arg3)
|
||||
ret0, _ := ret[0].([]types.KLine)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// QueryKLines indicates an expected call of QueryKLines.
|
||||
func (mr *MockExchangePublicMockRecorder) QueryKLines(arg0, arg1, arg2, arg3 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryKLines", reflect.TypeOf((*MockExchangePublic)(nil).QueryKLines), arg0, arg1, arg2, arg3)
|
||||
}
|
||||
|
||||
// QueryMarkets mocks base method.
|
||||
func (m *MockExchangePublic) QueryMarkets(arg0 context.Context) (types.MarketMap, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "QueryMarkets", arg0)
|
||||
ret0, _ := ret[0].(types.MarketMap)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// QueryMarkets indicates an expected call of QueryMarkets.
|
||||
func (mr *MockExchangePublicMockRecorder) QueryMarkets(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryMarkets", reflect.TypeOf((*MockExchangePublic)(nil).QueryMarkets), arg0)
|
||||
}
|
||||
|
||||
// QueryTicker mocks base method.
|
||||
func (m *MockExchangePublic) QueryTicker(arg0 context.Context, arg1 string) (*types.Ticker, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "QueryTicker", arg0, arg1)
|
||||
ret0, _ := ret[0].(*types.Ticker)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// QueryTicker indicates an expected call of QueryTicker.
|
||||
func (mr *MockExchangePublicMockRecorder) QueryTicker(arg0, arg1 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryTicker", reflect.TypeOf((*MockExchangePublic)(nil).QueryTicker), arg0, arg1)
|
||||
}
|
||||
|
||||
// QueryTickers mocks base method.
|
||||
func (m *MockExchangePublic) QueryTickers(arg0 context.Context, arg1 ...string) (map[string]types.Ticker, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []any{arg0}
|
||||
for _, a := range arg1 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "QueryTickers", varargs...)
|
||||
ret0, _ := ret[0].(map[string]types.Ticker)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// QueryTickers indicates an expected call of QueryTickers.
|
||||
func (mr *MockExchangePublicMockRecorder) QueryTickers(arg0 any, arg1 ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]any{arg0}, arg1...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryTickers", reflect.TypeOf((*MockExchangePublic)(nil).QueryTickers), varargs...)
|
||||
}
|
|
@ -1,5 +1,10 @@
|
|||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: github.com/c9s/bbgo/pkg/types (interfaces: ExchangeTradeHistoryService)
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -destination=mocks/mock_exchange_trade_history.go -package=mocks . ExchangeTradeHistoryService
|
||||
//
|
||||
|
||||
// Package mocks is a generated GoMock package.
|
||||
package mocks
|
||||
|
@ -10,7 +15,7 @@ import (
|
|||
time "time"
|
||||
|
||||
types "github.com/c9s/bbgo/pkg/types"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockExchangeTradeHistoryService is a mock of ExchangeTradeHistoryService interface.
|
||||
|
@ -46,7 +51,7 @@ func (m *MockExchangeTradeHistoryService) QueryClosedOrders(arg0 context.Context
|
|||
}
|
||||
|
||||
// QueryClosedOrders indicates an expected call of QueryClosedOrders.
|
||||
func (mr *MockExchangeTradeHistoryServiceMockRecorder) QueryClosedOrders(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
|
||||
func (mr *MockExchangeTradeHistoryServiceMockRecorder) QueryClosedOrders(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryClosedOrders", reflect.TypeOf((*MockExchangeTradeHistoryService)(nil).QueryClosedOrders), arg0, arg1, arg2, arg3, arg4)
|
||||
}
|
||||
|
@ -61,7 +66,7 @@ func (m *MockExchangeTradeHistoryService) QueryTrades(arg0 context.Context, arg1
|
|||
}
|
||||
|
||||
// QueryTrades indicates an expected call of QueryTrades.
|
||||
func (mr *MockExchangeTradeHistoryServiceMockRecorder) QueryTrades(arg0, arg1, arg2 interface{}) *gomock.Call {
|
||||
func (mr *MockExchangeTradeHistoryServiceMockRecorder) QueryTrades(arg0, arg1, arg2 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "QueryTrades", reflect.TypeOf((*MockExchangeTradeHistoryService)(nil).QueryTrades), arg0, arg1, arg2)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user