mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-14 15:09:51 +00:00
* orderbook: export orderbook nodes for external strategy inspection * orderbook: Add in methods for locking and unlocking multiple books at the same time e.g. book1.LockWith(book2); defer book1.UnlockWith(book2) * include waiting functionality for depth change alert * backtester: add word. * log: include logger changes to impl with downstream integration * engine: reduce params for loading exchange * assort: rm verbose in tests, change wording in ob, expose sync.waitgroup for ext. sync options * ticker: reduce map look ups and contention when using RW mutex when there are over 80% writes adds find last function to get the latest rate * engine/syncmanager: add in waitgroup for step over for external package calls * cleaup * engine: linter fix * currency/fx: include all references to fiat currencies to default * orderbook: Add in fields to Unsafe type for strategies to detect potential out of sync book operations * syncmanager: changed config variable to display correct time * ordermanager: Add time when none provided * currency/manager: update getasset param to get enabled assets for minor optimizations * ftx: use get all wallet balances for a better accounts breakdown * orderbook: unlock in reverse order * bithumb: fixes bug on market buy and sell orders * bithumb: fix bug for nonce is also time window sensitive * bithumb: get orders add required parameter * bithumb: Add asset type to account struct * currency: improve log output when checking currency and it fails * bithumb: Add error return on incomplete pair * ticker:unexport all service related methods * ticker/currency: fixes * orderbook: fix comment * engine: revert variable name in LoadExchange method * sync_manager: fix panic when enabling disabling manager * engine: fix naming convention of exported function and comments * engine: update comment * orderbook: fix comment for unsafe type
53 lines
1.2 KiB
Go
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.")
|
|
|
|
var cfgs []config.ExchangeConfig
|
|
exchanges := engine.Bot.GetExchanges()
|
|
for x := range exchanges {
|
|
var cfg *config.ExchangeConfig
|
|
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))
|
|
}
|