mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
Merge pull request #993 from zenixls2/fix/indicator_for_1s
fix: indicator timeframe 1s
This commit is contained in:
commit
798079070c
|
@ -1179,9 +1179,9 @@ func NewCanvas(title string, intervals ...Interval) *Canvas {
|
|||
interval := Interval1m
|
||||
if len(intervals) > 0 {
|
||||
interval = intervals[0]
|
||||
if interval.Minutes() > 24*60 {
|
||||
if interval.Seconds() > 24*60*60 {
|
||||
valueFormatter = chart.TimeDateValueFormatter
|
||||
} else if interval.Minutes() > 60 {
|
||||
} else if interval.Seconds() > 60*60 {
|
||||
valueFormatter = chart.TimeHourValueFormatter
|
||||
} else {
|
||||
valueFormatter = chart.TimeMinuteValueFormatter
|
||||
|
@ -1227,7 +1227,7 @@ func (canvas *Canvas) Plot(tag string, a Series, endTime Time, length int, inter
|
|||
interval = intervals[0]
|
||||
}
|
||||
for i := length - 1; i >= 0; i-- {
|
||||
shiftedT := e.Add(-time.Duration(i*interval.Minutes()) * time.Minute)
|
||||
shiftedT := e.Add(-time.Duration(i*interval.Seconds()) * time.Second)
|
||||
timeline = append(timeline, shiftedT)
|
||||
}
|
||||
canvas.Series = append(canvas.Series, chart.TimeSeries{
|
||||
|
|
Loading…
Reference in New Issue
Block a user