and for market hours as well.

This commit is contained in:
Will Charczuk 2017-01-10 13:52:18 -08:00
parent 98d3996b47
commit dfd8a00283

View File

@ -183,5 +183,10 @@ func (mhr MarketHoursRange) Translate(value float64) int {
totalSeconds := Date.CalculateMarketSecondsBetween(mhr.Min, mhr.GetEffectiveMax(), mhr.GetMarketOpen(), mhr.GetMarketClose(), mhr.HolidayProvider) totalSeconds := Date.CalculateMarketSecondsBetween(mhr.Min, mhr.GetEffectiveMax(), mhr.GetMarketOpen(), mhr.GetMarketClose(), mhr.HolidayProvider)
valueDelta := Date.CalculateMarketSecondsBetween(mhr.Min, valueTimeEastern, mhr.GetMarketOpen(), mhr.GetMarketClose(), mhr.HolidayProvider) valueDelta := Date.CalculateMarketSecondsBetween(mhr.Min, valueTimeEastern, mhr.GetMarketOpen(), mhr.GetMarketClose(), mhr.HolidayProvider)
translated := int((float64(valueDelta) / float64(totalSeconds)) * float64(mhr.Domain)) translated := int((float64(valueDelta) / float64(totalSeconds)) * float64(mhr.Domain))
if r.IsDescending() {
return r.Domain - translated
}
return translated return translated
} }