Skip to content

Commit

Permalink
Merge master, resolving conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
cranktakular committed Apr 14, 2024
2 parents 1d51a2e + e823f9e commit 90e20e1
Show file tree
Hide file tree
Showing 72 changed files with 1,769 additions and 2,517 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/proto-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ jobs:

- name: Setup build depends
run: |
go get github.com/grpc-ecosystem/grpc-gateway/v2/internal/[email protected]
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
- uses: bufbuild/[email protected]
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latest
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
- uses: bufbuild/[email protected]

- name: buf generate
working-directory: ./gctrpc
Expand Down
2 changes: 1 addition & 1 deletion backtester/btcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func setupClient(c *cli.Context) (*grpc.ClientConn, context.CancelFunc, error) {

var cancel context.CancelFunc
c.Context, cancel = context.WithTimeout(c.Context, timeout)
conn, err := grpc.DialContext(c.Context, host, opts...)
conn, err := grpc.NewClient(host, opts...)
return conn, cancel, err
}

Expand Down
2 changes: 1 addition & 1 deletion backtester/btrpc/btrpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

198 changes: 90 additions & 108 deletions backtester/btrpc/btrpc.pb.gw.go

Large diffs are not rendered by default.

50 changes: 31 additions & 19 deletions backtester/btrpc/btrpc_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions backtester/engine/live.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,7 @@ func (d *dataChecker) FetchLatestData() (bool, error) {
if !d.hasUpdatedFunding {
err = d.UpdateFunding(false)
if err != nil {
if err != nil {
log.Errorln(common.LiveStrategy, err)
}
log.Errorln(common.LiveStrategy, err)
}
}

Expand Down
10 changes: 6 additions & 4 deletions backtester/engine/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,16 @@ func (bt *BackTest) SetupFromConfig(cfg *config.Config, templatePath, output str
if err != nil {
return err
}
exch.SetDefaults()
exchBase := exch.GetBase()
exchBase.Verbose = cfg.DataSettings.VerboseExchangeRequests

var dc *gctconfig.Exchange
dc, err = exch.GetDefaultConfig(context.TODO())
dc, err = gctexchange.GetDefaultConfig(context.TODO(), exch)
if err != nil {
return err
}

exchBase := exch.GetBase()
exchBase.Verbose = cfg.DataSettings.VerboseExchangeRequests

err = exch.Setup(dc)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/config_builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func main() {
cfgs := make([]config.Exchange, 0, len(exchanges))
for x := range exchanges {
var cfg *config.Exchange
cfg, err = exchanges[x].GetDefaultConfig(context.Background())
cfg, err = exchange.GetDefaultConfig(context.Background(), exchanges[x])
if err != nil {
log.Printf("Failed to get exchanges default config. Err: %s", err)
continue
Expand Down
19 changes: 0 additions & 19 deletions cmd/exchange_template/wrapper_file.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,6 @@ import (
"github.com/thrasher-corp/gocryptotrader/portfolio/withdraw"
)

// GetDefaultConfig returns a default exchange config
func ({{.Variable}} *{{.CapitalName}}) GetDefaultConfig(ctx context.Context) (*config.Exchange, error) {
{{.Variable}}.SetDefaults()
exchCfg := new(config.Exchange)
exchCfg.Name = {{.Variable}}.Name
exchCfg.HTTPTimeout = exchange.DefaultHTTPTimeout
exchCfg.BaseCurrencies = {{.Variable}}.BaseCurrencies

{{.Variable}}.SetupDefaults(exchCfg)

if {{.Variable}}.Features.Supports.RESTCapabilities.AutoPairUpdates {
err := {{.Variable}}.UpdateTradablePairs(ctx, true)
if err != nil {
return nil, err
}
}
return exchCfg, nil
}

// SetDefaults sets the basic defaults for {{.CapitalName}}
func ({{.Variable}} *{{.CapitalName}}) SetDefaults() {
{{.Variable}}.Name = "{{.CapitalName}}"
Expand Down
2 changes: 1 addition & 1 deletion cmd/gctcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func setupClient(c *cli.Context) (*grpc.ClientConn, context.CancelFunc, error) {
if verbose {
c.Context = metadata.AppendToOutgoingContext(c.Context, "verbose", "true")
}
conn, err := grpc.DialContext(c.Context, host, opts...)
conn, err := grpc.NewClient(host, opts...)
return conn, cancel, err
}

Expand Down
Loading

0 comments on commit 90e20e1

Please sign in to comment.