mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-09 07:26:48 +00:00
New communications package
Support for Slack, SMSGlobal, SMTP and Telegram Supersedes: https://github.com/thrasher-/gocryptotrader/pull/126
This commit is contained in:
committed by
Adrian Gallagher
parent
d34fc9aae8
commit
9d0616d8cf
27
main.go
27
main.go
@@ -15,19 +15,19 @@ import (
|
||||
"github.com/thrasher-/gocryptotrader/currency/forexprovider"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/communications"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges"
|
||||
"github.com/thrasher-/gocryptotrader/portfolio"
|
||||
"github.com/thrasher-/gocryptotrader/smsglobal"
|
||||
)
|
||||
|
||||
// Bot contains configuration, portfolio, exchange & ticker data and is the
|
||||
// overarching type across this code base.
|
||||
type Bot struct {
|
||||
config *config.Config
|
||||
smsglobal *smsglobal.Base
|
||||
portfolio *portfolio.Base
|
||||
exchanges []exchange.IBotExchange
|
||||
comms *communications.Communications
|
||||
shutdown chan bool
|
||||
dryRun bool
|
||||
configFile string
|
||||
@@ -82,21 +82,9 @@ func main() {
|
||||
log.Printf("Bot '%s' started.\n", bot.config.Name)
|
||||
log.Printf("Bot dry run mode: %v.\n", common.IsEnabled(bot.dryRun))
|
||||
|
||||
if bot.config.SMS.Enabled {
|
||||
bot.smsglobal = smsglobal.New(bot.config.SMS.Username, bot.config.SMS.Password,
|
||||
bot.config.Name, bot.config.SMS.Contacts)
|
||||
log.Printf(
|
||||
"SMS support enabled. Number of SMS contacts %d.\n",
|
||||
bot.smsglobal.GetEnabledContacts(),
|
||||
)
|
||||
} else {
|
||||
log.Println("SMS support disabled.")
|
||||
}
|
||||
|
||||
log.Printf(
|
||||
"Available Exchanges: %d. Enabled Exchanges: %d.\n",
|
||||
len(bot.config.Exchanges), bot.config.CountEnabledExchanges(),
|
||||
)
|
||||
log.Printf("Available Exchanges: %d. Enabled Exchanges: %d.\n",
|
||||
len(bot.config.Exchanges),
|
||||
bot.config.CountEnabledExchanges())
|
||||
|
||||
common.HTTPClient = common.NewHTTPClientWithTimeout(bot.config.GlobalHTTPTimeout)
|
||||
log.Printf("Global HTTP request timeout: %v.\n", common.HTTPClient.Timeout)
|
||||
@@ -106,6 +94,10 @@ func main() {
|
||||
log.Fatalf("No exchanges were able to be loaded. Exiting")
|
||||
}
|
||||
|
||||
log.Println("Starting communication mediums..")
|
||||
bot.comms = communications.NewComm(bot.config.GetCommunicationsConfig())
|
||||
bot.comms.GetEnabledCommunicationMediums()
|
||||
|
||||
log.Printf("Fiat display currency: %s.", bot.config.Currency.FiatDisplayCurrency)
|
||||
currency.BaseCurrency = bot.config.Currency.FiatDisplayCurrency
|
||||
currency.FXProviders = forexprovider.StartFXService(bot.config.GetCurrencyConfig().ForexProviders)
|
||||
@@ -124,6 +116,7 @@ func main() {
|
||||
bot.portfolio = &portfolio.Portfolio
|
||||
bot.portfolio.SeedPortfolio(bot.config.Portfolio)
|
||||
SeedExchangeAccountInfo(GetAllEnabledExchangeAccountInfo().Data)
|
||||
|
||||
go portfolio.StartPortfolioWatcher()
|
||||
go TickerUpdaterRoutine()
|
||||
go OrderbookUpdaterRoutine()
|
||||
|
||||
Reference in New Issue
Block a user