2 Star 7 Fork 11

王布衣/engine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
feature_f10_subnew.go 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
王布衣 提交于 2024-01-11 11:15 . 适配exchange工具包
package factors
import (
"gitee.com/quant1x/exchange"
"gitee.com/quant1x/gotdx/quotes"
"gitee.com/quant1x/gox/api"
)
const (
SubNewStockYears = 1 // 次新股几年内
)
// 检查在date之前是否存在除权除息
func checkXdxr(list []quotes.XdxrInfo, date string) *quotes.XdxrInfo {
for _, v := range list {
if v.Category == 1 && date >= v.Date {
return &v
}
}
return nil
}
//// IsSubNewStock 检查是否次新股
//func IsSubNewStock(securityCode, date string) bool {
// date = trading.FixTradeDate(date)
// securityCode = proto.CorrectSecurityCode(securityCode)
// f10 := flash.GetL5F10(securityCode, date)
// if f10 == nil {
// return false
// }
// return IsSubNewStockByIpoDate(securityCode, f10.IpoDate, date)
//}
// IsSubNewStockByIpoDate 检查是否次新股
func IsSubNewStockByIpoDate(securityCode, ipoDate, date string) bool {
ipoDate = exchange.FixTradeDate(ipoDate)
date = exchange.FixTradeDate(date)
listingDate, err := api.ParseTime(ipoDate)
if err != nil {
return false
}
tm := listingDate.AddDate(SubNewStockYears, 0, 0)
after := tm.Format(exchange.TradingDayDateFormat)
if date >= after {
return false
}
//xdxrs := base.GetCacheXdxrList(securityCode)
//if len(xdxrs) == 0 {
// return false
//}
//api.SliceSort(xdxrs, func(a, b quotes.XdxrInfo) bool {
// return a.Date > b.Date
//})
//xdxrInfo := checkXdxr(xdxrs, after)
//if xdxrInfo == nil {
// return true
//}
return true
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/quant1x/engine.git
git@gitee.com:quant1x/engine.git
quant1x
engine
engine
v1.3.9

搜索帮助