2 Star 0 Fork 2

王布衣 / exchange

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
trading_unsafe.go 933 Bytes
一键复制 编辑 原始数据 按行查看 历史
王布衣 提交于 2024-01-11 07:55 . 调整包路径
package exchange
import (
"sort"
)
// unsafeDateIsTradingDay date是否交易日?默认是今天
func unsafeDateIsTradingDay(date ...string) bool {
theDay := Today()
if len(date) > 0 {
theDay = FixTradeDate(date[0])
}
lastDay := unsafeLastTradeDate()
if lastDay == theDay {
return true
}
return false
}
// unsafeLastTradeDate 获得最后一个交易日
func unsafeLastTradeDate() string {
today := IndexToday()
tradeDates := unsafeDates()
end := sort.SearchStrings(tradeDates, today)
datesLength := len(tradeDates)
if end >= datesLength {
end = datesLength - 1
}
lastDay := tradeDates[end]
if lastDay > today {
end = end - 1
}
return tradeDates[end]
}
// 日历是否已到最后
func unsafeCalendarIsEOF() bool {
today := IndexToday()
tradeDates := unsafeDates()
end := sort.SearchStrings(tradeDates, today)
datesLength := len(tradeDates)
if end >= datesLength {
return true
}
return false
}
Go
1
https://gitee.com/quant1x/exchange.git
git@gitee.com:quant1x/exchange.git
quant1x
exchange
exchange
v0.5.3

搜索帮助