2 Star 7 Fork 11

王布衣/engine

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
feature_f10_subnew.go 1.41 KB
Copy Edit Raw Blame History
王布衣 authored 2023-10-11 09:21 . 数据插件增加get接口
package factors
import (
"gitee.com/quant1x/gotdx/quotes"
"gitee.com/quant1x/gotdx/trading"
"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 = trading.FixTradeDate(ipoDate)
date = trading.FixTradeDate(date)
listingDate, err := api.ParseTime(ipoDate)
if err != nil {
return false
}
tm := listingDate.AddDate(SubNewStockYears, 0, 0)
after := tm.Format(trading.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
v0.4.4

Search