Files
gocryptotrader/cmd/config_builder/builder.go
Ryan O'Hara-Reid e99adca86f encoding/json: Add custom JSON package with build tag support for Sonic (#1623)
* tag optional sonic and allow full library conversion

* Add workflow and disallow arm and darwin usage

* Add basic hotswap benchmark

* linter: fix

* use bash

* linter: fix?

* Fix whoopsie, add to make file, also add mention in features list.

* test enforcement

* actually read documentation see if this works

* linter: fix

* linter: fix

* sonic: bump tagged version

* encoding/json: drop build tag arch and os filters

* encoding/json: consolidate tests

* encoding/json: log build tag usage

* rm superfluous builds

* glorious/nits: add template change and regen docs

* glorious/nits: update commentary on nolint directive

* glorious/nits: rm init func and log results in main.go

* Test to actually pull flag in

* linter: fix

* thrasher: nits

* gk: nits 4 goflags goooooooooo!

* gk: nits rn

* make sonic default json implementation

* screen 386

* linter: fix

* Add commentary

* glorious: nits Makefile not working

* gk: nits

* gk: nits whoops

* whoopsirino

* mention 32bit systems won't be sonic

* gk: super-duper nit of extremes

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
2025-02-20 16:05:55 +11:00

55 lines
1.3 KiB
Go

package main
import (
"context"
"log"
"sync"
"github.com/thrasher-corp/gocryptotrader/config"
"github.com/thrasher-corp/gocryptotrader/encoding/json"
"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 i := range exchange.Exchanges {
wg.Add(1)
go func(name string) {
defer wg.Done()
if err = engine.Bot.LoadExchange(name); err != nil {
log.Printf("Failed to load exchange %s. Err: %s", name, err)
}
}(exchange.Exchanges[i])
}
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 = exchange.GetDefaultConfig(context.Background(), exchanges[x])
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))
}