From 99799da07bd2afafc061d410f9fa72b0b0332d75 Mon Sep 17 00:00:00 2001 From: Nikhil Saraf <1028334+nikhilsaraf@users.noreply.github.com> Date: Fri, 14 Feb 2020 17:43:44 -0800 Subject: [PATCH] throw error on startup when FILL_TRACKER_SLEEP_MILLIS is not set but POSTGRES_DB is set (closes #370) --- cmd/trade.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/trade.go b/cmd/trade.go index 355cbdd4c..115ebc0a6 100644 --- a/cmd/trade.go +++ b/cmd/trade.go @@ -485,6 +485,12 @@ func runTradeCmd(options inputs) { var db *sql.DB if botConfig.PostgresDbConfig != nil { + if botConfig.FillTrackerSleepMillis == 0 { + log.Println() + utils.PrintErrorHintf("FILL_TRACKER_SLEEP_MILLIS needs to be set in the trader.cfg file when the POSTGRES_DB is enabled so we can fetch trades to be saved in the db") + logger.Fatal(l, fmt.Errorf("invalid trader.cfg config, need to set FILL_TRACKER_SLEEP_MILLIS")) + } + var e error db, e = database.ConnectInitializedDatabase(botConfig.PostgresDbConfig) if e != nil {