Files
gocryptotrader/cmd/config_builder/builder.go
Adrian Gallagher 9a4eb9de84 CI: Fix golangci-lint linter issues, add prealloc linter and bump version depends for Go 1.18 (#915)
* Bump CI versions

* Specifically set go version as 1.17.x bumps it to 1.18

* Another

* Adjust AppVeyor

* Part 1 of linter issues

* Part 2

* Fix various linters and improvements

* Part 3

* Finishing touches

* Tests and EqualFold

* Fix nitterinos plus bonus requester jobs bump for exchanges with large number of tests

* Fix nitterinos and bump golangci-lint timeout for AppVeyor

* Address nits, ensure all books are returned on err due to syncer regression

* Fix the wiggins

* Fix duplication

* Fix nitterinos
2022-04-20 13:45:15 +10:00

53 lines
1.2 KiB
Go

package main
import (
"encoding/json"
"log"
"sync"
"github.com/thrasher-corp/gocryptotrader/config"
"github.com/thrasher-corp/gocryptotrader/engine"
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
)
func main() {
var err error
engine.Bot, err = engine.New()
if err != nil {
log.Fatalf("Failed to initialise engine. Err: %s", err)
}
log.Printf("Loading exchanges..")
var wg sync.WaitGroup
for x := range exchange.Exchanges {
name := exchange.Exchanges[x]
err = engine.Bot.LoadExchange(name, &wg)
if err != nil {
log.Printf("Failed to load exchange %s. Err: %s", name, err)
continue
}
}
wg.Wait()
log.Println("Done.")
exchanges := engine.Bot.GetExchanges()
cfgs := make([]config.Exchange, 0, len(exchanges))
for x := range exchanges {
var cfg *config.Exchange
cfg, err = exchanges[x].GetDefaultConfig()
if err != nil {
log.Printf("Failed to get exchanges default config. Err: %s", err)
continue
}
log.Printf("Adding %s", exchanges[x].GetName())
cfgs = append(cfgs, *cfg)
}
data, err := json.MarshalIndent(cfgs, "", " ")
if err != nil {
log.Fatalf("Unable to marshal cfgs. Err: %s", err)
}
log.Println(string(data))
}