This commit is contained in:
Will Charczuk 2016-07-27 00:40:22 -07:00
parent 0c049db317
commit 40ff878b79

View File

@ -76,12 +76,18 @@ func (mhr MarketHoursRange) GetHolidayProvider() date.HolidayProvider {
// GetTicks returns the ticks for the range. // GetTicks returns the ticks for the range.
// This is to override the default continous ticks that would be generated for the range. // This is to override the default continous ticks that would be generated for the range.
func (mhr *MarketHoursRange) GetTicks(vf ValueFormatter) []Tick { func (mhr *MarketHoursRange) GetTicks(vf ValueFormatter) []Tick {
// return one tick per day
// figure out how to advance one ticke per market day.
var ticks []Tick var ticks []Tick
cursor := date.On(mhr.MarketClose, mhr.Min) cursor := date.On(mhr.MarketClose, mhr.Min)
maxClose := date.On(mhr.MarketClose, mhr.Max) maxClose := date.On(mhr.MarketClose, mhr.Max)
if mhr.Min.Before(cursor) {
ticks = append(ticks, Tick{
Value: TimeToFloat64(cursor),
Label: vf(cursor),
})
}
for date.BeforeDate(cursor, maxClose) { for date.BeforeDate(cursor, maxClose) {
if date.IsWeekDay(cursor.Weekday()) && !mhr.GetHolidayProvider()(cursor) { if date.IsWeekDay(cursor.Weekday()) && !mhr.GetHolidayProvider()(cursor) {
ticks = append(ticks, Tick{ ticks = append(ticks, Tick{