This commit is contained in:
Will Charczuk 2016-07-24 09:04:07 -07:00
parent e3ae7fd78f
commit 8fbb8d9775
3 changed files with 42 additions and 2 deletions

View file

@ -310,7 +310,11 @@ func CalculateMarketSecondsBetween(start, end, marketOpen, marketClose time.Time
startMarketClose := NextMarketClose(startEastern, marketClose, isHoliday)
if (startEastern.Equal(startMarketOpen) || startEastern.After(startMarketOpen)) && startEastern.Before(startMarketClose) {
seconds += int64(startMarketClose.Sub(startEastern) / time.Second)
if endEastern.Before(startMarketClose) {
seconds += int64(endEastern.Sub(startEastern) / time.Second)
} else {
seconds += int64(startMarketClose.Sub(startEastern) / time.Second)
}
}
cursor := NextMarketOpen(startMarketClose, marketOpen, isHoliday)