gitee.com/quant1x/engine@v1.8.4/factors/feature_f10_subnew.go (about)

     1  package factors
     2  
     3  import (
     4  	"gitee.com/quant1x/exchange"
     5  	"gitee.com/quant1x/gotdx/quotes"
     6  	"gitee.com/quant1x/gox/api"
     7  )
     8  
     9  const (
    10  	SubNewStockYears = 1 // 次新股几年内
    11  )
    12  
    13  // 检查在date之前是否存在除权除息
    14  func checkXdxr(list []quotes.XdxrInfo, date string) *quotes.XdxrInfo {
    15  	for _, v := range list {
    16  		if v.Category == 1 && date >= v.Date {
    17  			return &v
    18  		}
    19  	}
    20  	return nil
    21  }
    22  
    23  //// IsSubNewStock 检查是否次新股
    24  //func IsSubNewStock(securityCode, date string) bool {
    25  //	date = trading.FixTradeDate(date)
    26  //	securityCode = proto.CorrectSecurityCode(securityCode)
    27  //	f10 := flash.GetL5F10(securityCode, date)
    28  //	if f10 == nil {
    29  //		return false
    30  //	}
    31  //	return IsSubNewStockByIpoDate(securityCode, f10.IpoDate, date)
    32  //}
    33  
    34  // IsSubNewStockByIpoDate 检查是否次新股
    35  func IsSubNewStockByIpoDate(securityCode, ipoDate, date string) bool {
    36  	ipoDate = exchange.FixTradeDate(ipoDate)
    37  	date = exchange.FixTradeDate(date)
    38  	listingDate, err := api.ParseTime(ipoDate)
    39  	if err != nil {
    40  		return false
    41  	}
    42  	tm := listingDate.AddDate(SubNewStockYears, 0, 0)
    43  	after := tm.Format(exchange.TradingDayDateFormat)
    44  	if date >= after {
    45  		return false
    46  	}
    47  	//xdxrs := base.GetCacheXdxrList(securityCode)
    48  	//if len(xdxrs) == 0 {
    49  	//	return false
    50  	//}
    51  	//api.SliceSort(xdxrs, func(a, b quotes.XdxrInfo) bool {
    52  	//	return a.Date > b.Date
    53  	//})
    54  	//xdxrInfo := checkXdxr(xdxrs, after)
    55  	//if xdxrInfo == nil {
    56  	//	return true
    57  	//}
    58  
    59  	return true
    60  }