Compare commits

..

4 Commits

Author SHA1 Message Date
injoyai
f381d72ec4 优化Workday.Range 2025-10-30 10:45:26 +08:00
injoyai
5fa572f298 把集合竞价合并到931里面 2025-10-28 08:41:04 +08:00
injoyai
61b2e737b3 把集合竞价从931剥离出来到930 2025-10-27 09:09:19 +08:00
injoyai
5654065954 把集合竞价从931剥离出来到930 2025-10-27 08:49:22 +08:00
3 changed files with 5 additions and 4 deletions

View File

@@ -293,6 +293,7 @@ func (this Klines) Merge(n int) Klines {
if n <= 1 { if n <= 1 {
return this return this
} }
ks := Klines(nil) ks := Klines(nil)
ls := Klines(nil) ls := Klines(nil)
for i := 0; ; i++ { for i := 0; ; i++ {

View File

@@ -210,7 +210,7 @@ func (this Trades) klinesForDay(date time.Time) Klines {
//分组,按 //分组,按
for _, v := range this { for _, v := range this {
ms := minutes(v.Time) ms := minutes(v.Time)
t := conv.Select(ms <= _930, _930, ms) t := conv.Select(ms < _930, _930, ms)
t++ t++
t = conv.Select(t > _1130 && t <= _1300, _1130, t) t = conv.Select(t > _1130 && t <= _1300, _1130, t)
t = conv.Select(t > _1500, _1500, t) t = conv.Select(t > _1500, _1500, t)

View File

@@ -150,11 +150,11 @@ func (this *Workday) RangeYear(year int, f func(t time.Time) bool) {
) )
} }
// Range 遍历指定范围的工作日 // Range 遍历指定范围的工作日,推荐start带上时间15:00,这样当天小于15点不会触发
func (this *Workday) Range(start, end time.Time, f func(t time.Time) bool) { func (this *Workday) Range(start, end time.Time, f func(t time.Time) bool) {
start = conv.Select(start.Before(protocol.ExchangeEstablish), protocol.ExchangeEstablish, start) start = conv.Select(start.Before(protocol.ExchangeEstablish), protocol.ExchangeEstablish, start)
now := IntegerDay(time.Now()) //now := IntegerDay(time.Now())
end = conv.Select(end.After(now), now, end).Add(1) //end = conv.Select(end.After(now), now, end).Add(1)
for ; start.Before(end); start = start.Add(time.Hour * 24) { for ; start.Before(end); start = start.Add(time.Hour * 24) {
if this.Is(start) { if this.Is(start) {
if !f(start) { if !f(start) {