dev 3
This commit is contained in:
25
go-client/libs/calc.go
Normal file
25
go-client/libs/calc.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package libs
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
||||
|
||||
func randStr(n int) string {
|
||||
b := make([]rune, n)
|
||||
for i := range b {
|
||||
b[i] = letters[rand.Intn(len(letters))]
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func TradingTime(t time.Time) bool {
|
||||
if t.Weekday() == time.Saturday || t.Weekday() == time.Sunday {
|
||||
return false
|
||||
}
|
||||
second := t.Hour()*3600 + t.Minute()*60 + t.Second()
|
||||
return (second >= 9*3600+30*60 && second <= 11*3600+30*60) ||
|
||||
(second >= 13*3600 && second <= 15*3600)
|
||||
}
|
||||
Reference in New Issue
Block a user