Skip to content

Commit

Permalink
disable config saving, GetExchangeByName
Browse files Browse the repository at this point in the history
Signed-off-by: Julien 'Lta' BALLET <[email protected]>
  • Loading branch information
elthariel committed May 26, 2017
1 parent 939426b commit 38dcff5
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ func Get() *Bot {
return &bot
}

func (b Bot) GetExchangeByName(name string) exchange.IBotExchange {
for _, exch := range b.Exchanges {
if exch.GetName() == name {
return exch
}
}
return nil
}

func (b *Bot) Wait() {
<-b.shutdown
Shutdown()
Expand Down Expand Up @@ -223,13 +232,15 @@ func HandleInterrupt() {
func Shutdown() {
log.Println("Bot shutting down..")
bot.config.Portfolio = portfolio.Portfolio
err := bot.config.SaveConfig("")

if err != nil {
log.Println("Unable to save config.")
} else {
log.Println("Config file saved successfully.")
}
// Do not save config on Exit
// err := bot.config.SaveConfig("")

// if err != nil {
// log.Println("Unable to save config.")
// } else {
// log.Println("Config file saved successfully.")
// }

log.Println("Exiting.")
os.Exit(1)
Expand Down

0 comments on commit 38dcff5

Please sign in to comment.