Merge pull request #312 from c9s/c9s-patch-1

Fix pointer check
This commit is contained in:
Yo-An Lin 2021-12-07 19:20:15 +08:00 committed by GitHub
commit 7ca9e37270

View File

@ -180,7 +180,7 @@ var BacktestCmd = &cobra.Command{
// if we don't have klines before the start time endpoint, the back-test will fail. // if we don't have klines before the start time endpoint, the back-test will fail.
// because the last price will be missing. // because the last price will be missing.
if syncFromTime.Before(firstKLine.EndTime) { if firstKLine != nil && syncFromTime.Before(firstKLine.EndTime) {
return fmt.Errorf("the sync-from-time you gave %s is earlier than the previous sync-start-time %s. "+ return fmt.Errorf("the sync-from-time you gave %s is earlier than the previous sync-start-time %s. "+
"re-syncing data from the earlier date before your first sync is not support,"+ "re-syncing data from the earlier date before your first sync is not support,"+
"please clean up the kline table and restart a new sync", "please clean up the kline table and restart a new sync",