Skip to content

Commit

Permalink
Merge pull request #96 from ethanchewy/binanceplugin
Browse files Browse the repository at this point in the history
Sets timeEnd to Time.now() if it is larger than the current time
  • Loading branch information
rocketbitz authored Jun 26, 2018
2 parents 006ead1 + f02d05b commit 9134be2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion contrib/binancefeeder/binancefeeder.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ func (bn *BinanceFetcher) Run() {
correctIntervalSymbol = "1Min"
}

//Time end issue
if finalTime.IsZero() {
finalTime = time.Now().UTC()
}

//Replace interval string with correct one with API call
timeInterval := timeIntervalNumsOnly + correctIntervalSymbol

Expand Down Expand Up @@ -226,7 +231,14 @@ func (bn *BinanceFetcher) Run() {

diffTimes := finalTime.Sub(timeEnd)

if diffTimes < 0 {
//Reset time. Make sure you get all data possible
if diffTimes < 0{
timeStart = timeStart.Add(-bn.baseTimeframe.Duration * 300)
timeEnd = finalTime
}


if diffTimes == 0 {
glog.Infof("Got all data from: %v to %v", bn.queryStart, bn.queryEnd)
glog.Infof("Continuing...")
}
Expand Down

0 comments on commit 9134be2

Please sign in to comment.